ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Volkar <jvol...@etransport.com>
Subject Newbie help <property>
Date Fri, 28 Dec 2001 12:44:43 GMT
Okay, once more...

It seems that properties are only inheritable "downwards" thru a series of
<antcall>'s.  I can see why this is (you would not want child targets
messing up parent target property settings.  However, I have a situation
where I want a child <target> to set properties that I want to use in the
parent <target>.  (see "expand-properties" in the attached sample)  

How could I allow a child target to set a property that would then be
visible to a calling target?

John Volkar


The following is a shortened part of a master build script that will
eventualy have 40-50 separate steps in it's "build-sequence".  The default
<target> for the project is specified as "quicktest".  

The following is the series of calls made for "someproject"...  My problem
is in expand-properties, it fabricates several properties from one base
propery and I do not want to repeat that expansion logic everywhere, so my
original intent was to use <target name="expand-properties"> as a sort-of
subroutine.

quicktest
  build-sequence
    prepare-environment  
    build-someproject
      build-targets-quicktest
        expand-properties
        cleanup-project
        vssget-project
        antbuild-project
        cleanup-project


  <target name="quicktest">
    <property name="build-targets" value="build-targets-quicktest"/>
    <antcall target="build-sequence"/>
  </target>


  <target name="build-sequence">
    <antcall target="prepare-environment"/>   
    <parallel>
      <antcall target="build-somehugeproject"/>
      <sequential>
        <antcall target="build-someproject"/>
        <antcall target="build-someotherproject"/>
      </sequential>
    </parallel>
  </target>


  <target name="build-somehugeproject">
    <property name="project-name" value="core\somehugeproject"/>
    <antcall target="${build-targets}"/>
  </target>

  <target name="build-someproject">
    <property name="project-name" value="utilities\someproject"/>
    <antcall target="${build-targets}"/>
  </target>

  <target name="build-someotherproject">
    <property name="project-name" value="utilities\someotherproject"/>
    <antcall target="${build-targets}"/>
  </target>



  <target name="build-targets-quicktest">
    <antcall target="expand-properties"/>
    <antcall target="cleanup-project"/>
    <antcall target="vssget-project"/>
    <antcall target="antbuild-project"/>
    <antcall target="cleanup-project"/>
  </target>


  <target name="expand-properties">
    <property name="project-path" value="${basedir}\${project-name}"/>
    <property name="project-path-src" value="${project-path}src\"/>
    <property name="project-path-javadoc" value="${project-path}javadoc\"/>
  </target>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message