Thanks for that info Patrick!  I had kind of worked out the theory of it
in my playing, but nice to have it confirmed.  Since my build scripts tend
to be a single target that antcalls all the others, this is valuable info
(the fact that I've managed before without it notwithstanding!)  I love
Antform by the way, I now have a nice little front end to my build
process, really cool!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

On Tue, February 14, 2006 1:46 pm, Patrick Martin said:
> Hello,
>
> If you were using antcall to invoke a target containing antform, it is
> a normal behaviour. Targets invoked with antcall cannot set properties
> in the calling target:
>
> <target name="a">
>   <antcall target="b"/>
>   <echo message="p = ${p}" />
> </target>
>
> <target name="b">
>   <property name="p" value="1"/>
> </target>
>
> This will print:
> p = ${p}
>
> if you replace b by a macro or if you set depends="b" on target 'a',
> it will work.
>
> By the way, antform does not respect property immutability. It uses
> property values as defaults and allows the user to change those
> defaults.
>
> Regards,
>
> Patrick M.
>
> On 2/14/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
>> The whole script is a little over 1,000 lines, so posting the whole
>> thing
>> wouldn't be too nice :)  But, here is a trimmed-down version that should
>> give you the info you want...  It should be noted that my Ant scripts
>> are
>> note what one would call "typical"... I do things a little differently,
>> but I prefer it done this way... anyway...
>>
>> <project name="MyProject" default="build" basedir="." >
>>
>>   <property file="build.properties" />
>>   <property file="build_control.properties" />
>>
>>   <path id="classpath">
>>     <pathelement location="../WEB-INF/lib/commons-beanutils.jar" />
>>     <pathelement location="../WEB-INF/lib/struts.jar" />
>>     <pathelement location="../source/temp" />
>>   </path>
>>
>>   <target name="build">
>>     <get_dependencies />
>>     <taskdef resource="net/sf/antcontrib/antcontrib.properties">
>>       <classpath refid="compiletime_classpath" />
>>     </taskdef>
>>     <set_props />
>>     <antcall target="compile_app" inheritRefs="true" />
>>     <antcall target="junit_tests" inheritRefs="true" />
>>     <antcall target="static_analysis_checkstyle" inheritRefs="true" />
>>   </target>
>>
>>   <macrodef name="get_dependencies">
>>     <sequential>
>>       <echo message=" " />
>>       <echo message="Retrieving dependencies..." />
>>       <setproxy proxyhost="${proxy_host}" proxyport="${proxy_port}" />
>>       <typedef classpath="libutils/ant-dependencies.jar"
>>        resource="dependencies.properties" />
>>         <dependencies pathId="compiletime_classpath" verbose="true">
>>                 <dependency group="servletapi" version="2.3" />
>>                 <dependency group="checkstyle" version="4.0-beta5" />
>>                 <dependency group="checkstyle"
>> artifact="checkstyle-optional"
>>                  version="4.0-beta5" />
>>                 <dependency group="antlr" version="2.7.5" />
>>                 <dependency group="regexp" version="1.3" />
>>                 <dependency group="junit" version="3.8.1" />
>>                 <dependency group="ant-contrib" version="20020829" />
>>         </dependencies>
>>       <echo message="Done" />
>>     </sequential>
>>   </macrodef>
>>
>>   <macrodef name="set_props">
>>     <sequential>
>>     <echo message="Setting build control properties..." />
>>     <taskdef name="antform" classname="com.sardak.antform.AntForm"
>>                   classpath="libutils/antform.jar" />
>>                 <antform title="" save="build_control.properties"
>>                   image="../img/appTitle.gif" resetMessage=""
>> okMessage="Build">
>>     <label>Check off the tasks you wish to execute for this build, or
>> close the window to abort the build.  Note that ONE AND ONLY ONE of
>> the options in the first section should MUST be selected.  Also note
>> that the application in exploded format is always set up for Tomcat
>> only, and the EAR is always set up for Websphere only, and both are
>> set up in whatever mode is indicated by the first four items.
>> Security IS NOT enabled in Tomcat.</label>
>>                         <separator />
>>                         <booleanProperty label="Target build for
>> DEVELOPMENT environment
>> (mode_dev)"
>>                           property="appmode_dev" />
>>                         <booleanProperty
>>                           label="Target build for STEST environment
>> (appmode_stest)"
>>                           property="appmode_stest" />
>>                         <booleanProperty
>>                           label="Target build for ATEST environment
>> (appmode_atest)"
>>                           property="appmode_atest" />
>>                         <booleanProperty
>>                           label="Target build for PRODUCTION environment
>> (appmode_prod)"
>>                           property="appmode_prod" />
>>                         <separator />
>>       <booleanProperty
>>                           label="Run CheckStyle on all code
>> (do_static_analysis_checkstyle)"
>>                           property="do_static_analysis_checkstyle" />
>>                         <booleanProperty label="Perform unit tests
>> (do_unit_tests)"
>>                           property="do_unit_tests" />
>>       </antform>
>>                 <echo message="Done" />
>>     </sequential>
>>   </macrodef>
>>
>>   <!-- Compile the app. -->
>>   <target name="compile_app">
>>     <echo message="Compiling app..." />
>>     <delete dir="../WEB-INF/classes/com" />
>>     <mkdir dir="../WEB-INF/classes/com" />
>>     <javac srcdir="${basedir}"
>>      debug="true" debuglevel="lines,vars,source"
>>      destdir="../WEB-INF/classes" deprecation="on"
>>      excludes="junittests/*.*"
>>      classpath="../WEB-INF/lib/log4j.jar">
>>       <classpath refid="classpath" />
>>       <classpath refid="compiletime_classpath" />
>>     </javac>
>>     <echo message="Done" />
>>   </target>
>>
>>   <!-- Perform any JUnit tests required. -->
>>   <target name="junit_tests">
>>     <if>
>>       <equals arg1="${do_unit_tests}" arg2="true" />
>>       <then>
>>         <echo message="Performing JUnit Tests..." />
>>         <javac srcdir="junittests"
>>          destdir="temp" deprecation="on">
>>           <classpath refid="classpath" />
>>           <classpath refid="compiletime_classpath" />
>>         </javac>
>>         <junit printsummary="on" haltonerror="yes" haltonfailure="yes">
>>           <classpath refid="classpath" />
>>           <classpath refid="compiletime_classpath" />
>>           <formatter type="brief" usefile="false" />
>>           <test name="junittests.DisbursementDelegateTestCase" />
>>         </junit>
>>         <echo message="Done" />
>>       </then>
>>       <else>
>>         <echo message="Skipping junit_tests" />
>>       </else>
>>     </if>
>>   </target>
>>
>>   <!-- Performs static code analysis using CheckStyle. -->
>>   <target name="static_analysis_checkstyle">
>>     <if>
>>       <equals arg1="${do_static_analysis_checkstyle}" arg2="true" />
>>       <then>
>>         <echo message="Performing static code analysis using
>> CheckStyle..." />
>>         <delete file="static_analysis_checkstyle.xml" />
>>         <taskdef resource="checkstyletask.properties">
>>           <classpath refid="classpath" />
>>           <classpath refid="compiletime_classpath" />
>>         </taskdef>
>>         <checkstyle config="libutils/checkstyle_checks.xml"
>>          failOnViolation="false">
>>           <classpath refid="classpath" />
>>           <classpath refid="compiletime_classpath" />
>>           <fileset dir="com" includes="**/*.java" />
>>           <formatter type="xml"
>>            toFile="static_analysis_checkstyle.xml" />
>>         </checkstyle>
>>         <echo message="Done" />
>>       </then>
>>       <else>
>>         <echo message="Skipping static_analysis_checkstyle" />
>>       </else>
>>     </if>
>>   </target>
>>
>> </project>
>>
>>
>> And, for completeness, build_control.properties is nothing but:
>>
>> appmode_dev=true
>> do_unit_tests=true
>> do_static_analysis_checkstyle=true
>>
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>> AIM: fzammetti
>> Yahoo: fzammetti
>> MSN: [EMAIL PROTECTED]
>>
>> On Tue, February 14, 2006 12:33 pm, Ivan \"Rambius\" Ivanov said:
>> > Hello Frank,
>> >
>> > --- "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote:
>> >
>> >> I don't know if it's the right way to do it, or if
>> >> there is some reason
>> >> not to do it this way, but I found a solution... I
>> >> took the contents of
>> >> the target that executed Antform and put it in a
>> >> macrodef... doing that,
>> >> the properties DO get changed as expected.
>> > Can you post your code? I got interesed because
>> > properties are immutable, no matter where you send
>> > them - in a ordinary target or in a macrodef.
>> >
>> > Regards
>> > Ivan
>> >
>> > __________________________________________________
>> > Do You Yahoo!?
>> > Tired of spam?  Yahoo! Mail has the best spam protection around
>> > http://mail.yahoo.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to