OK, that seems to work, though the build.version is coming back "exported"

At least it's now writing.  And I am getting the dates.  Progress.  Thanks!

Andrew

On Jul 12, 2011, at 2:53 PM, Chuck Hill wrote:

> 
> On Jul 12, 2011, at 11:37 AM, Andrew Kinnie wrote:
> 
>> OK, just to clarify, I am a borderline illiterate when it comes to Ant,
> 
> Add Learning Ant to your To Do list.
> 
> 
>> in that, I know, mostly and fairly vaguely, that it provides an xml script 
>> to build apps for deployment.
>> 
>> And how to spell it.  I think.
>> 
>> So, just so I understand, you are saying that the first thing I have, 
>> immediately after my <project name="MyApp" default="build" basedir="."> tag
> 
> I'd add it to the target that builds the app, before the woapplication task.
> 
> 
>> , I add
>> 
>>>         <exec dir=".."
>>>               executable="svnversion"
>>>               outputproperty="svn.committed.max"
>>>               errorproperty="svnversion.error">
>>>               <arg line="-n"/>
>>>         </exec>
>> 
>> Then at the bottom of the existing woapplication tag, right after the close 
>> tag:
>>> 
>>> 
>>>        </woapplication>
>>>             
>> 
>> I add this:
>> 
>>>         <chmod 
>>> file="${dest.dir}${file.separator}${build.app.name}.woa${file.separator}${build.app.name}"
>>>  perm="755"/>
>>> 
>>>         <!-- This is not set in Eclipse builds to speed things up so we
>>>              create a default value here indicating this.                -->
>>>         <property name="svn.committed.max" value="unknown eclipse build" />
>>> 
>>>         <!-- Add the revision number, date, and time to the Properties file 
>>> -->
>>>         <concat destfile="${java.properties.file}" append="true">
>>> build.version=${svn.committed.max}
>>> build.date=${DSTAMP}
>>> build.time=${TSTAMP}
>>> </concat>
>>>     </target>
>> 
>> Then do I need to add or change anything in my properties file?  
> 
> You need to define java.properties.file
> 
> 
>> Clearly my previous 
>> 
>>>>    public String revisionNumber = 
>>>> ERXProperties.stringForKey("RevisionNumber");
>>>>    public String buildNumber = ERXProperties.stringForKey("BuildNumber");
>> 
>> 
>> won't work with this, so I would use "build.version" "build.date and 
>> "build.time" as my properties to access the information.
> 
> That or rename them in the XML above.
> 
> 
>> 
>> So I now have:
>> 
>>      public String buildDate = ERXProperties.stringForKey("build.date");
>>      public String buildTime = ERXProperties.stringForKey("build.time");
>>      public String buildVersion = 
>> ERXProperties.stringForKey("build.version");
>> 
>> and
>> 
>>      public String buildVersion(){
>>              System.out.println("buildVersion " + buildVersion + " and 
>> buildDate is " + buildDate);
>>              return buildVersion;
>>      }
>> 
>>      public String buildDate(){
>>              return buildDate;
>>      }
>>      
>>      public String buildTime(){
>>              return buildTime;
>>      }
>> 
>> Correct?  Or is there something else I would need?  (I ask, because looking 
>> at it, it would seem that it is supposed to be writing the information to 
>> the Properties file, but nothing is being added to it, and I am getting 
>> empty strings)
> 
> You will probably need to do some Ant debugging.  :-)
> 
> <echo>....</echo>
> 
> 
> Chuck
> 
> 
>>> On Jul 12, 2011, at 10:50 AM, Andrew Kinnie wrote:
>>> 
>>>> I am trying to add an svn commit number to the front page of my basically 
>>>> headless push app.  However, I am apparently doing something stupid and 
>>>> missing something obvious.
>>>> 
>>>> I added this to the top of the build.xml script for the app (after the 
>>>> project tag):
>>>> 
>>>>    <!-- Write current build and revision #s into Properties file. -->
>>>>    <target name="updateBuildNumber">
>>>> 
>>>>    <exec executable="svnversion" dir="" outputproperty="svn.revision" />
>>>>    <echo>Revision: ${svn.revision}</echo>
>>>>    <replaceregexp file="Resources/Properties"
>>>>            match="RevisionNumber=(.*)"
>>>>            replace="RevisionNumber=${svn.revision}" />
>>>>            <property environment="env" />
>>>>            <echo>Build Number: ${env.BUILD_NUMBER}</echo>
>>>>            <replaceregexp file="Resources/Properties"
>>>>            match="BuildNumber=(.*)"
>>>>            replace="BuildNumber=${env.BUILD_NUMBER}" />
>>>>    </target>
>>>> 
>>>> I added this to my Properties file for the app (At the top):
>>>> 
>>>> RevisionNumber=x
>>>> BuildNumber=x
>>>> 
>>>> However, the script is not substituting, and I am not getting anything 
>>>> other than "x" with the following code in my Main.java class
>>>> 
>>>>    public String revisionNumber = 
>>>> ERXProperties.stringForKey("RevisionNumber");
>>>>    public String buildNumber = ERXProperties.stringForKey("BuildNumber");
>>>> 
>>>>    public String revisionNumber(){
>>>>            System.out.println("buildNumber is " + buildNumber + " and 
>>>> revisionNumber is " + revisionNumber);
>>>>            return revisionNumber;
>>>>    }
>>>> 
>>>> What blindingly obvious thing am I missing?
>>>> 
>>>> Andrew
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      ([email protected])
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>>>> 
>>>> This email sent to [email protected]
>>> 
>>> -- 
>>> Chuck Hill             Senior Consultant / VP Development
>>> 
>>> Come to WOWODC this July for unparalleled WO learning opportunities and 
>>> real peer to peer problem solving!  Network, socialize, and enjoy a great 
>>> cosmopolitan city.  See you there!  http://www.wocommunity.org/wowodc11/
>>> 
>> 
> 
> -- 
> Chuck Hill             Senior Consultant / VP Development
> 
> Come to WOWODC this July for unparalleled WO learning opportunities and real 
> peer to peer problem solving!  Network, socialize, and enjoy a great 
> cosmopolitan city.  See you there!  http://www.wocommunity.org/wowodc11/
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to