You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by John Volkar <jv...@etransport.com> on 2001/12/28 13:44:43 UTC

Newbie help

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Newbie help

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "John Volkar" <jv...@etransport.com>
To: <an...@jakarta.apache.org>
Sent: Friday, December 28, 2001 4:44 AM
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?
>

save them to a file with <propertyfile>; load them back using <property
file>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>