ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svetlin Stanchev" <stanc...@360t.com>
Subject RE: dynamically setting path id (name)
Date Mon, 11 Aug 2003 09:36:08 GMT
Yes, I am using the same idea -- constructing and storing (compile)
classpath per project in a project-specific subdir in an intermediate
file.
However, I wanted to avoid that by trying to construct in memory a
dynamic path based on a (changing) project name, in an ant-contrib
foreach loop.

As Peter explained though, path id gets resolved static, so I can't do
that :-(.

Thanks Daniel,

-- 
Svetlin


> -----Original Message-----
> From: Daniel H A Lima [mailto:lima@cit.com.br] 
> Sent: Friday, August 08, 2003 3:20 PM
> To: Ant Users List
> Subject: Re: dynamically setting path id (name)
> 
> 
>     I don't know if i understood your problem but i've used a 
> property 
> file to store classpath information between the two .xml. The task 
> "pathconvert" replaces "windows-like" directory separator ( "\" ).
>     I don't like so much of my solution :-), but...
> 
> <?xml version="1.0"?>
> <project name="path" default="main" basedir=".">
>    <target name="main">
>       <property name="project.name" value="my_proj"/>
>       <ant antfile="nested_path.xml" target="set_nested_path"/>
>       <property file="${project.name}.classpath"/>
> 
>        <!-- This only show nested.path contents -->
>       <path id="p">
>          <pathelement location="${nested.path}"/>
>       </path>
>       <property name="p" refid="p"/>
>       <echo message="path = ${p}"/>
>    </target>
> </project>
> 
> <?xml version="1.0"?>
> <project name="nested_path" default="set_nested_path" basedir=".">
>    <target name="set_nested_path">
>      <pathconvert dirsep="/" property="tmp_classpath">
>         <path id="tmp_id">
>            <fileset dir=".">
>               <include name="*"/>
>            </fileset>
>            <pathelement location="path.xml:nested_path.xml"/>
>        </path>
>      </pathconvert>
>      <echo message="nested.path=${tmp_classpath}" 
> file="${project.name}.classpath"/>
>    </target>
> </project>
> 
> 
> 
> Svetlin Stanchev wrote:
> 
> >Well, this is exactly what I have now (if I understand you 
> correctly). 
> >I have currently a project-specific directory with a props.xml file 
> >inside it containing a definition of the project's compile path with 
> >fixed id. If a project name or smth else changes, I need to edit it 
> >there manually.
> >
> >However, for the actual project build of java projects 
> (because I have 
> >others too) I am using a "build template" which gets copied to the 
> >project directory and from there it loads the props.xml.
> >
> >But, now I have extract-libpaths.xml which gives me back the compile 
> >classpath (along with other info) based on external JBuilder 
> settings. 
> >So why not make evth automatic by somehow dynamically setting the 
> >classpath attribute of javac?
> >
> >This way, from the masterbuild based on a list of projects I 
> can create 
> >a project dir for each, copy the modified template, find out with 
> >extract-libpaths.xml dynamically from the JBuilder configs 
> the needed 
> >compile classpath, compile, make distributables, delete 
> project dir if 
> >needed, over. I don't want to maintain manually a JBuilder<->Ant lib 
> >and other mappings for dozens of projects!
> >
> >Well, if path id gets resolved static, then I can't use ant 
> properties 
> >in it. Then I guess I have no choice but to create these 
> same props.xml
> >manually using xmltask or smth similar before I try calling 
> the project
> >build using props.xml (because I am using ant 1.5 with also 
> static XML
> >fragments).
> >
> >If somebody has a better idea, please let me know.
> >
> >Thank you, Peter.
> >  
> >
> 
> -- 
> ______________________________________________
> 
> Daniel Henrique Alves Lima, Software Engineer
> CiT Systems - Software enabling  the e-world
> lima@cit.com.br
> http://www.cit.com.br
> Phone: +55 19 3737 4596
>        +55 19 3737 4500
> Fax:   +55 19 3737 4501          
> ______________________________________________________________
> ___________
> 
> "Spike once ask me... What does it take for a soldier to become a 
>  leader... What differentiates the two ?
>  There is no difference. Sometimes certain soldiers are 
> chosen to lead  other soldiers. (...) But they never stop 
> being soldiers.  Because when the stakes are high... When the 
> battle burns... When  the death seems near... You either 
> fight or your don't. You're either a  soldier or you're not. 
> (...) I'm a soldier. I fight. That's what i do."
> 
> 	            Optimus Prime : TF - G1 : DW 
> ______________________________________________________________
> ___________
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 


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


Mime
View raw message