Thanks for helping with this issue
BPM
-----Original Message-----
From: Scot P. Floess [mailto:[email protected]]
Sent: Monday, June 06, 2011 1:58 PM
To: Brian McCann
Subject: RE: How change variable based on environment variable value
Sorry, that should be:
<project name="Buildbox" default="setJOF" basedir=".">
...
</project>
On Mon, 6 Jun 2011, Scot P. Floess wrote:
>
> What about something like this:
>
> <project name="Buildbox" default="build" basedir=".">
> <!--
> Import a special target set for master build files.
> This overrides the standard targets defined in
> build-common-targets which is pulled in through
> the build-imports.xml process.
> -->
>
> <!--<import file="tools/build-master-targets.xml" />
> <import file="build-imports.xml" />-->
>
> <property environment="env"/>
>
> <target name="setJOF" if="env.BUILD_BOX">
> <property name="JOF" value="F:/Inetpub/wwwroot/wo30"/>
> <echo>${JOF}</echo>
> </target>
>
> <!--
> A filelist defines an ordered list that is used to
> encode the project build order that should be used
> -->
> <!--<filelist id="children.filelist" dir=".">
> <file name="JOF"/>
> </filelist>-->
> </project>
>
>
> In Linux, I ran this and it worked...
>
> Pre-setting the environment variable BUILD_BOX:
>
> Buildfile: /home/sfloess/development/tmp/ant/build.xml
>
> setJOF:
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
>
>
> Now setting the environment variable BUILD_BOX:
>
> export BUILD_BOX=foo
>
> [sfloess @ fedora-workstation] /home/sfloess/development/tmp/ant> ant
> Buildfile: /home/sfloess/development/tmp/ant/build.xml
>
> setJOF:
> [echo] F:/Inetpub/wwwroot/wo30
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
>
> You definitely had one issue - in your "if" attribute you need to denote
the
> property name if its set (not the value of the property)...
>
>
>
>
> On Mon, 6 Jun 2011, Brian McCann wrote:
>
>> Hi Scott,
>>
>> Thanks for pointing that out I've been calling the targets manually on
the
>> commandline.
>> even if I got them to work the build file would still have failed due to
no
>> depends
>> Thanks,
>> BPM
>>
>> -----Original Message-----
>> From: Scot P. Floess [mailto:[email protected]]
>> Sent: Monday, June 06, 2011 12:47 PM
>> To: Brian McCann
>> Cc: 'Ant Users List'
>> Subject: RE: How change variable based on environment variable value
>>
>>
>> I don't see how either target checkbuildbox nor setJOF is called... Your
>> default target is set to "build" - how are you executing when you run
ant?
>>
>> I'd like to see your depends, etc...
>>
>>
>> On Mon, 6 Jun 2011, Brian McCann wrote:
>>
>>> Hi,
>>> This is the complete build.xml file.
>>>
>>> Thanks,
>>> BPM
>>> ==========================================================
>>> <project name="Buildbox" default="build" basedir=".">
>>> <!--
>>> Import a special target set for master build files.
>>> This overrides the standard targets defined in
>>> build-common-targets which is pulled in through
>>> the build-imports.xml process.
>>> -->
>>>
>>> <!--<import file="tools/build-master-targets.xml" />
>>> <import file="build-imports.xml" />-->
>>>
>>>
>>> <!-- check for value of BUILD_BOX -->
>>> <target name="checkbuildbox" description="Checks if the build is
>>> running on the Build Machine">
>>> <!-- check to see that the property gets set -->
>>> <property environment="env"/>
>>> <property name="BUILD_BOX" value="${env.BUILD_BOX}"/>
>>> <echo>${env.BUILD_BOX}</echo>
>>> </target>
>>>
>>> <target name="setJOF" if="${env.BUILD_BOX}">
>>> <property name="JOF" value="F:/Inetpub/wwwroot/wo30"/>
>>> <echo>${JOF}</echo>
>>> </target>
>>>
>>>
>>> <!--
>>> A filelist defines an ordered list that is used to
>>> encode the project build order that should be used
>>> -->
>>> <!--<filelist id="children.filelist" dir=".">
>>> <file name="JOF"/>
>>> </filelist>-->
>>> </project>
>>>
==========================================================================
>>>
>>> -----Original Message-----
>>> From: Scot P. Floess [mailto:[email protected]]
>>> Sent: Monday, June 06, 2011 12:09 PM
>>> To: Ant Users List
>>> Subject: Re: How change variable based on environment variable value
>>>
>>>
>>> Any chance we can see the complete build.xml?
>>>
>>> On Mon, 6 Jun 2011, Brian McCann wrote:
>>>
>>>> Hi,
>>>> Below is xml from my build.xml file. I'm trying to set a property value
>>>> based on the condition
>>>> that the build.xml file is being run on the build box. I created a
system
>>>> variable and set it to true on a Win XP SP3 build system.
>>>> I tested this part of the xml and the code "
>>> <echo>${env.BUILD_BOX}</echo>"
>>>> works and returns the correct value of "True"
>>>> for the variable "${env.BUILD_BOX}". The problem is the second target
>>>> "setJOF" is not setting the "JOF" property value to
>>>> "F:/Inetpub/wwwroot/wo30".
>>>> The xml "<echo>${JOF}</echo>" returns no value.
>>>>
>>>> In a nutshell I'm trying to do is check if the buld.xml is running on
the
>>>> buildbox (not a developers box). If it's running on the buildbox change
>>> the
>>>> value of a property to
>>>> a path unique to the buildbox which overrides the path property value
in
>>> the
>>>> build.user.properties file. If it's not running on the buildbox use the
>>>> value of the
>>>> property set in the build.user.properties file.
>>>>
>>>> Any help on this would be greatly appreciated.
>>>> Thanks,
>>>>
>>>> BPM
>>>>
>>>> Build.xml :
>>>>
>>>> <!-- check for value of BUILD_BOX -->
>>>>
>>>> <target name="checkbuildbox" description="Checks if the build is
>>>> running on the Build Machine">
>>>>
>>>> <!-- check to see that
the
>>>> property gets set -->
>>>>
>>>> <property
>>>> environment="env"/>
>>>>
>>>> <property
name="BUILD_BOX"
>>>> value="${env.BUILD_BOX}"/>
>>>>
>>>>
>>>> <echo>${env.BUILD_BOX}</echo>
>>>>
>>>> </target>
>>>>
>>>>
>>>>
>>>> <target name="setJOF" if="${env.BUILD_BOX}">
>>>>
>>>> <property name="JOF" value="F:/Inetpub/wwwroot/wo30"/>
>>>>
>>>> <echo>${JOF}</echo>
>>>>
>>>> </target>
>>>>
>>>>
>>>>
>>>> build.userproperties:
>>>> JOF=C:/Inetpub/wwwroot/wo30
>>>>
>>>>
>>>>
>>>>
>>>
>>> Scot P. Floess RHCT (Certificate Number 605010084735240)
>>> Chief Architect FlossWare http://sourceforge.net/projects/flossware
>>> http://flossware.sourceforge.net
>>> https://github.com/organizations/FlossWare
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>> Scot P. Floess RHCT (Certificate Number 605010084735240)
>> Chief Architect FlossWare http://sourceforge.net/projects/flossware
>> http://flossware.sourceforge.net
>> https://github.com/organizations/FlossWare
>>
>>
>
> Scot P. Floess RHCT (Certificate Number 605010084735240)
> Chief Architect FlossWare http://sourceforge.net/projects/flossware
> http://flossware.sourceforge.net
> https://github.com/organizations/FlossWare
>
Scot P. Floess RHCT (Certificate Number 605010084735240)
Chief Architect FlossWare http://sourceforge.net/projects/flossware
http://flossware.sourceforge.net
https://github.com/organizations/FlossWare
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]