Re: Manipulating Anthill OS build numbers

Eric Minick <[email protected]> Fri, 31 Mar 2006 10:36:54 -0700
Newsgroups gmane.comp.java.anthill
Message-ID <[email protected]>
Ah. My mistake. The 'newVersion' variable is used down below to 
construct the link to the log file. I'd leave the variable assignment 
but remove the appending to the emailSubject.

....
   emailSubject.append(_buildDef.getProject().getProjectName());
   String newVersion = _buildDef.getVersion();
   /*
   if (newVersion != null) {
       emailSubject.append(" ").append(newVersion);
   }
   */
   emailSubject.append(" build ");
....

-- Eric


Res Pons wrote:

> Eric
>
> I commented out the section you showed me but now I don't get ANY 
> build emails at all :O
>
> Here's a snippte of the resultemail.pgl and where I commented out that 
> section only:
>
> --------------------------------------
> <%@ import="com.urbancode.anthill.BuildDefinition" %>
> <%@ import="com.urbancode.anthill.ProjectProperties" %>
> <%@ import="com.urbancode.anthill.adapter.Revision" %>
> <%@ import="java.io.*" %>
> <%
>    // build subject
>    BuildDefinition _buildDef = (BuildDefinition) 
> context.get("buildDefinition");
>
>    StringBuffer emailSubject = new StringBuffer();
>    emailSubject.append(_buildDef.getProject().getProjectName());
>    /*String newVersion = _buildDef.getVersion();
>    if (newVersion != null) {
>        emailSubject.append(" ").append(newVersion);
>    }*/
>    emailSubject.append(" build ");
>    if (_buildDef.getErrorFlag()) {
>        emailSubject.append("failed");
>    } else {
>        emailSubject.append("succeeded");
>    }
>
>    subject = emailSubject.toString();
>
>    // build body
>
>    ProjectProperties properties = _buildDef.getProject().getProperties();
>    StringBuffer logMessage = _buildDef.getLogMessageBuffer();
>    List revList = null;
>
>    // get the revisions and add them to the email
>    revList = _buildDef.getRevisionList();
>    Revision rev = null;
>    StringBuffer revLog = new StringBuffer();
>    if (revList != null) {
>            for (int i = 0; i < revList.size(); i++) {
>                    rev = (Revision) revList.get(i);
>                    revLog.append(rev.toString()).append("\n");
>            }
>    }
>    logMessage.append(revLog.toString());
>
>    String buildLogFileName = properties.getBuildLogDir()
>    + _buildDef.getName() + "-"
>    + newVersion + "-build.log";
>
>    File buildLog = new File(buildLogFileName);
>    String buildLogString = "";
>    if (buildLog.exists() &&  buildLog.length() <= Integer.MAX_VALUE) {
>           FileInputStream fis = new FileInputStream(buildLog);
>
>           int buffersize = (int)buildLog.length();
>           byte[] contents = new byte[buffersize];;
>
>           long n = fis.read(contents, 0, buffersize);
>           fis.close();
>           fis = null;
>
>           buildLogString = new String(contents);
>    }
>    String body = logMessage.toString() +
>            "\n-------------------------------------\n"
>            + buildLogFileName +
>            buildLogString;
> %>
> <%=body%>
> --------------------------------------
>
> ----Original Message Follows----
> From: Eric Minick <[email protected]>
> Reply-To: Anthill user list <anthill-IWHQxnLZ/[email protected]>
> To: Anthill user list <anthill-IWHQxnLZ/[email protected]>
> Subject: Re: [Anthill] Manipulating Anthill OS build numbers
> Date: Thu, 30 Mar 2006 13:39:16 -0700
> MIME-Version: 1.0
> Received: from lists.urbancode.com ([64.34.169.154]) by 
> bay0-mc11-f2.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); 
> Thu, 30 Mar 2006 12:41:30 -0800
> Received: (qmail 19914 invoked by uid 510); 30 Mar 2006 20:43:01 -0000
> Received: from anthill-bounces-IWHQxnLZ/[email protected] by 
> caladin.urbancode.com by uid 504 with qmail-scanner-1.20  
> (spamassassin: 2.61.  Clear:RC:1(127.0.0.1):.  Processed in 0.018117 
> secs); 30 Mar 2006 20:43:01 -0000
> Received: from localhost (HELO caladin.urbancode.com) (127.0.0.1)  by 
> lists.urbancode.com with SMTP; 30 Mar 2006 20:43:01 -0000
> Received: (qmail 19888 invoked by uid 510); 30 Mar 2006 20:42:59 -0000
> Received: from [email protected] by caladin.urbancode.com by uid 504 
> withqmail-scanner-1.20 (spamassassin: 2.61.  
> Clear:RC:0(207.99.47.54):SA:0(0.1/5.0):. Processed in 0.519536 secs); 
> 30 Mar 2006 20:42:59 -0000
> Received: from host54a.simplicato.com (207.99.47.54)by 
> lists.urbancode.com with SMTP; 30 Mar 2006 20:42:58 -0000
> Received: from localhost (localhost.simplicato.com [127.0.0.1])by 
> host54a.simplicato.com (Postfix) with ESMTP id 41E286C0485for 
> <anthill-IWHQxnLZ/[email protected]>; Thu, 30 Mar 2006 15:41:21 -0500 (EST)
> Received: from host54a.simplicato.com ([127.0.0.1])by localhost 
> (host54a.simplicato.com [127.0.0.1]) (amavisd-new,port 10024) with 
> ESMTP id 39681-08 for <anthill-IWHQxnLZ/[email protected]>;Thu, 30 Mar 2006 
> 15:41:21 -0500 (EST)
> Received: from [192.168.0.101] 
> (c-67-190-19-249.hsd1.co.comcast.net[67.190.19.249])by 
> host54a.simplicato.com (Postfix) with ESMTP id DDE156C042Dfor 
> <anthill-IWHQxnLZ/[email protected]>; Thu, 30 Mar 2006 15:41:20 -0500 (EST)
> X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
> Return-Path: <[email protected]>
> Delivered-To: mailman-anthill-IWHQxnLZ/[email protected]
> User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
> X-Accept-Language: en-us, en
> References: <[email protected]>
> X-Virus-Scanned: by amavisd-new at simplicato.com
> X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) 
> on caladin.urbancode.com
> X-Spam-Level:
> X-Spam-Status: No, hits=0.1 required=5.0 tests=RCVD_IN_SORBS 
> autolearn=no version=2.61
> X-BeenThere: anthill-IWHQxnLZ/[email protected]
> X-Mailman-Version: 2.1.4
> Precedence: list
> List-Id: Anthill user list <anthill.lists.urbancode.com>
> List-Unsubscribe: 
> <http://lists.urbancode.com/mailman/listinfo/anthill>,<mailto:anthill-request-IWHQxnLZ/[email protected]?subject=unsubscribe> 
>
> List-Archive: <http://lists.urbancode.com/pipermail/anthill>
> List-Post: <mailto:anthill-IWHQxnLZ/[email protected]>
> List-Help: <mailto:anthill-request-IWHQxnLZ/[email protected]?subject=help>
> List-Subscribe: 
> <http://lists.urbancode.com/mailman/listinfo/anthill>,<mailto:anthill-request-IWHQxnLZ/[email protected]?subject=subscribe> 
>
> Errors-To: anthill-bounces-IWHQxnLZ/[email protected]
> X-OriginalArrivalTime: 30 Mar 2006 20:41:30.0967 (UTC) 
> FILETIME=[5356C670:01C6543A]
>
> It's probably easiest to just clip these out of the emails. In the 
> conf directory, there is a file called resultEmail.pgl which you can 
> edit with a text editor. It's what builds the email.
>
> You could remove the version information by removing the lines:
>    String newVersion = _buildDef.getVersion();
>    if (newVersion != null) {
>        emailSubject.append(" ").append(newVersion);
>    }
>
> You could also comment them out using standard java comment sytax.
>
> Cheers,
> Eric
>
> Res Pons wrote:
>
>> Hi Guys
>>
>> Is there anyway to either manipulate AH's build numbers in the 
>> (com.urbancode.anthill.adapter.UrbanCodeVersionAdapter Properties) 
>> tab to a non-numeric value?  I currently use a file named 
>> anthill.build.number and initilialized it at 1 at start of each of my 
>> projects where it's incremented with each build and it sends an email 
>> with the project name and this number in the email's subject line.  
>> The real build numbers are manipulated in my ant build.xml and echoed 
>> in the body of the emails.  Naturally this confuses everyone.  I 
>> either like to do away with numeric values or prevent the emails to 
>> put anything in their subject line.  Any suggestions?
>>
>> Thanks. :)
>>
>> _________________________________________________________________
>> Is your PC infected? Get a FREE online computer virus scan from 
>> McAfee® Security. 
>> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>>
>> _______________________________________________
>> Anthill mailing list
>> Anthill-IWHQxnLZ/[email protected]
>> http://lists.urbancode.com/mailman/listinfo/anthill
>
>
>
> _______________________________________________
> Anthill mailing list
> Anthill-IWHQxnLZ/[email protected]
> http://lists.urbancode.com/mailman/listinfo/anthill
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's 
> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
> _______________________________________________
> Anthill mailing list
> Anthill-IWHQxnLZ/[email protected]
> http://lists.urbancode.com/mailman/listinfo/anthill