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 Fri, 08 Aug 2003 11:40:19 GMT
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.
-- 
Svetlin


> -----Original Message-----
> From: peter reilly [mailto:peter.reilly@corvil.com] 
> Sent: Friday, August 08, 2003 12:47 PM
> To: Ant Users List
> Subject: Re: dynamically setting path id (name)
> 
> 
> Sorry about my last e-mail, I meant to
> explain a little more.
> 
> The id field of <path id="x"> gets resolved
> at parse time and not at run-time.
> This is to allow the element to be accessed outside
> of the normal execution run.
> 
> So one cannot do <path id="${project.name}.compile.path"/>.
> 
> One would need to do:
> <project name="projecta">
> 
>    <path id ="projecta.compile.path">
>      <pathelement path=...../>
>    </path>
> </project>
> 
> and assuming project.name is set to "projecta" in the caller build
>     <ant dir="${mountpoint.projects}"
>        antfile="extract-libpaths.xml"
>        target="getProjectLibs">
>      </ant>
>      <!-- compile the source -->
>      <javac
>        srcdir="${project.src.dir}"
>        destdir="${project.build.classes.dir}"
>        debug="${project.build.debug}">
>        <classpath refid="${project.name}.compile.classpath"/>
>      </javac>
> 
> WARNING: I have not run the above script!
> 
> Peter
> 
> On Friday 08 August 2003 11:17, Svetlin Stanchev wrote:
> > You are perfectly right.
> >
> > I messed up by including not matching versions of the 
> compile target 
> > and extract-libpaths.xml. Let me try again, please.
> > I want to compile a sequence of projects referred to by 
> ${project.name}
> > and I have extract-libpaths.xml which finds out all libs needed for
> > compilation of any individual project. ${project.name} is 
> known in the
> > compile target and the <ant/> task by default is passing it to the
> > extract-libpaths.xml.
> > Now how can I set the id of the path in 
> extract-libpaths.xml based on
> > the project name so that I can refer to it from the 
> <javac/> task inside
> > the compile target of build.xml?
> >
> > Using in both extract-libpaths.xml and build.xml: 
> > project-compile-classpath I get:
> > BUILD FAILED
> > file:<my_build_file_with_compile_target> Reference
> > project-compile-classpath not found.
> > (probably because in extract-libpaths.xml I am setting the id before
> > associating it with a path?)
> >
> > But using in both places directly: ${project.name}.compile.classpath
> > also fails with the error message attached below.
> > (that is why I thought <path id.../> does not allow dynamic 
> setting of
> > the id using ant properties, but the id value should be set in a
> > property before associating it with a path instead)
> >
> > I do not see another way to dynamically set the id of the path with 
> > the project name in extract-libpaths.xml so that I can use 
> it in the 
> > compile target. Hope I did not mess-up again...
> >
> > I'll appreciate further suggestions,
> 
> 
> ---------------------------------------------------------------------
> 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