ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ylan Segal" <y...@digiworks.tv>
Subject RE: depences?
Date Mon, 05 Nov 2001 23:11:28 GMT
You can set a default in your build file, like for example jikes:

....
<target name="compile">
	<property name="build.compiler" value="jikes"/>
	<javac ....>
	</javac>
</target>
....

The example above will always compile with jikes, unless you call:
ant compiler -Dbuild.compiler=otherCompiler

In which case, otherCompiler will be used.. why? because properties are
inmutable in ant, once they are set, they can't be changed, and since you
are setting the property in the command line, it is processed before the
build.xml.

Is that good enough for you?


Ylan.

> -----Original Message-----
> From: Rafal Kedziorski [mailto:rafcio@polonium.de]
> Sent: Monday, November 05, 2001 4:59 PM
> To: Ant Users List
> Subject: RE: depences?
>
>
> hallo,
>
> At 16:49 05.11.2001 -0600, Ylan Segal wrote:
> >you only need one javac task and one target, ant will use the compiler
> >specified in the build.compiler property.. you can set this property in a
> >number of ways.. in a target being called , from the command line
> >with: -Dbuild.compiler=somecompiler, from a properties file, etc.
> >
> >I use the same javac task and a properties file. In the
> properties files my
> >build.compiler property is set to jikes.. when I want to use sun
> compiler, I
> >either change the file, or I call ant myTarget -Dbuild.compiler=modern
> >
> >It works pretty well for me.
>
> I know, but I want make it optionaly in my build.xml without changing the
> property file.
>
>
> Rafal
>
> >Ylan Segal.
> >
> > > -----Original Message-----
> > > From: Rafal Kedziorski [mailto:rafcio@polonium.de]
> > > Sent: Monday, November 05, 2001 4:39 PM
> > > To: ant-user@jakarta.apache.org
> > > Subject: depences?
> > >
> > >
> > > hallo,
> > >
> > > I have following peoblem.
> > >
> > > I can compile my project with javac or jikes.
> > >
> > >      <!--
> > >
> =================================================================== -->
> > >      <!--
> > > JAVAC
>       -->
> > >      <!--
> > >
> =================================================================== -->
> > >      <target name="javac" depends="prepare">
> > >          <property name="build.compiler" value="classic"/>
> > >          <javac srcdir="${dir.src}"
> > >            ...
> > >          </javac>
> > >      </target>
> > >
> > >      <!--
> > >
> =================================================================== -->
> > >      <!--
> > > JIKES
>       -->
> > >      <!--
> > >
> =================================================================== -->
> > >      <target name="jikes" depends="prepare">
> > >          <property name="build.compiler" value="jikes"/>
> > >          <javac srcdir="${dir.src}"
> > >            ...
> > >          </javac>
> > >      </target>
> > >
> > > But how can I make only one target for creating jar which depends on
> > > "javac" or "jikes" target?
> > >
> > >      <!--
> > > ================================================================== -->
> > >      <!-- Compiles the source directory and creates a .jar
> > > file              -->
> > >      <!--
> > > ================================================================== -->
> > >      <target name="jar" depends="?????">
> > >          <jar jarfile="${dir.lib}/${jar.name}.jar">
> > >            ...
> > >          </jar>
> > >      </target>
> > >
> > > Is this possible?
> > >
> > >
> > > Best Regards,
> > > Rafal
> > >
> > >
> > > --
> > > 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>
>
>


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