ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob Fix" <jakob....@gmail.com>
Subject Re: command line target available from inside build script?
Date Tue, 28 Feb 2006 15:47:28 GMT
Jan, thanks for this.  I appreciate it.

Still, searching my year-long-or-so gmail ant-users account containing
a couple of thousand messages for terms as generic in the context of
ant as "property", "target" and "name" yields so many unrelated
results that it's difficult to find the "Nadel im Heuhaufen".


On 2/28/06, Jan.Materne@rzf.fin-nrw.de <Jan.Materne@rzf.fin-nrw.de> wrote:
> >sure I did. however, searching for "property target available ant"
> >does not necessarily return a satisfying answer.
> >
> >http://ant.apache.org/manual/using.html#built-in-props
> >doesn't list the target property or something similar ...
> >
> >sorry for looking in the wrong places :-)
>
> A search inside the mailing archive is a good place.
> I did just now, but TheAimsGroup only shows
>   "Message-body searching has been temporarily disabled."
>
> http://marc.theaimsgroup.com/?l=ant-user&w=2&r=1&s=target%20name%20prope
> rty&q=b
>
> Also a search inside jGuru is a good source.
> But also only
>   "Sorry... search database offline briefly
>   We're updating the search database at the moment. Please try again
> later."
>
> http://www.jguru.com/search/results.jsp?resource=jGuru:forum&resource=jG
> uru:faq&reviewed=any&view=byrelevance&query=ant%20target%20name%20proper
> ty
>
>
> So in short:
> - there is no property with the target name(s)
> - create a wrapper which passes the target additional as property
>
> I have found an example on my machine...
>
>
> Jan
>
>
>
> ant2.bat
> ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
> @echo off
> set opts=
>
> :loop
> if "%1"=="" goto run
> if "%opts%" neq "" set opts=%opts%::
> set opts=%opts%%1
> shift
> goto loop
>
> :run
> call ant -Dtargetnames=%opts% %*
> set opts=
> ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
>
>
> build.xml
> ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
> <project name="targetnamesAsProperty" default="target1">
>     <target name="target1">
>         <echo>Target 1</echo>
>         <echo>Targetnames = ${targetnames}</echo>
>     </target>
>     <target name="target2">
>         <echo>Target 2</echo>
>         <echo>Targetnames = ${targetnames}</echo>
>     </target>
>     <target name="target3">
>         <echo>Target 3</echo>
>         <echo>Targetnames = ${targetnames}</echo>
>     </target>
> </project>
> ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----



--
cheers,
Jakob.

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


Mime
View raw message