ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cohen" <Ste...@ignitesports.com>
Subject RE: Newbie help <property>
Date Fri, 28 Dec 2001 16:15:39 GMT
I know you said never mind, but I'm not sure what your solution is and
whether it doesn't make things needlessly more complicated.  On the
other hand, your solution may amount to the same thing as mine, I'm not
sure.

My solution uses the <param> element of <antcall> and the fact that you
can always accomplish anything with another level of indirection.  As
far as I can tell, the only motivation behind your expand-properties is
to avoid copying the same boilerplate to each project.  A good way to do
that in ant is to do that boilerplate in a surrounding target and pass
its results in as params via antcall.  Note that these params are passed
into any child targets as well (but not to parents).

Like this:

  <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-template">
        <param name="build-target" value="build-somehugeproject" />
        <param name="project-name" value="core\somehugeproject"/>
      </antcall> 
      <sequential>
        <antcall target="build-template">
          <param name="build-target" value="build-someproject" />
          <param name="project-name" value="utilities\someproject"/>
        </antcall> 
        
        <antcall target="build-template">
          <param name="build-target" value="build-someotherproject" />
          <param name="project-name"
value="utilities\someotherproject"/>
        </antcall> 
      </sequential>
    </parallel>
  </target>

<target name="build-template" />
    <antcall target="${build-target}">
        <param name="project-path" value="${basedir}\${project-name}"/>
        <param name="project-path-src" value="${project-path}src\"/>
        <param name="project-path-javadoc"
value="${project-path}javadoc\"/>
    </antcall>
</target>        


  <target name="build-somehugeproject">
        ... meat of target
  </target>

  <target name="build-someproject">
        ... meat of target
  </target>

  <target name="build-someotherproject">
        ... meat of target
  </target>



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



-----Original Message-----
From: John Volkar [mailto:jvolkar@etransport.com]
Sent: Friday, December 28, 2001 9:17 AM
To: Ant Users List
Subject: RE: Newbie help <property>


Never mind, I've worked around this by having "expand-properties" do an
<antcall> to another intermediate <target> that finishes up.

John Volkar


-----Original Message-----
From: John Volkar [mailto:jvolkar@etransport.com]
Sent: Friday, December 28, 2001 7:45 AM
To: ant-user@jakarta.apache.org
Subject: Newbie help <property>


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>

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


--
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