ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ylan Segal" <y...@digiworks.tv>
Subject RE: Including a common build file with common targets.
Date Tue, 16 Oct 2001 15:45:24 GMT
Maybee I am missing the picture, but the way we do it in our company is:

- Check out the code (This includes a build.xml file).
- Now, build.xml calls a properties file like:
...
<property file="build.properties"/>
...
- Each developer makes his own build.properties file with appropiate values
for his system.

Now, to ensure that all properties are set, I had a little help from this
list in making a check target and a help target that tell the developer what
to include. It looks like:
...

<target name="check" description="Checks if ready to build">
	<property name="check.app.name" value="$${app.name}"/>
	<property name="check.web.home" value="$${web.home}"/>
	<property name="check.build.home" value="$${build.home}"/>
	<property name="check.dist.home" value="$${dist.home"/>
	<property name="check.deploy.home" value="$${deploy.home}"/>
	<property name="check.extlibs.home" value="$${extlibs.home}"/>
	<property name="check.mainlib.file" value="$${mainlib.file}"/>
	<condition property="missing.properties">
		<or>
			<equals arg1="${check.app.name}" arg2="${app.name}"/>
			<equals arg1="${check.web.home}" arg2="${web.home}"/>
			<equals arg1="${check.build.home}" arg2="${build.home}"/>
			<equals arg1="${check.dist.home}" arg2="${dist.home}"/>
			<equals arg1="${check.deploy.home}" arg2="${deploy.home}"/>
			<equals arg1="${check.extlibs.home}" arg2="${extlibs.home}"/>
			<equals arg1="${cehck.mainllib.file}" arg2="${mainlib.file}"/>
		</or>
	</condition>
	<antcall target="help"/>
</target>

<target name="help" if="missing.properties">
	<echo>
	Not all needed properties are set!!!
	This build file needs a build.properies file to set the following
properties:
		app.name - The name of this application
		web.home - The directory where web resource including jsp's are stored.
		build.home - The directory where the build is created.
		dist.home - The directory where distribution files are created.
		deploy.home - The directory where the webapp is deployed to for testing.
		extlibs.home - The directory where external libraries can be found.
		mainlib.file - The file (jar) that contains the main library.
	Other properties can also be set in this file (like build.compiler, etc).
	</echo>
	<fail message="Not all needed properties are set!!!"/>
</target>
...

Would this approach work for you? The developer just has to set the
proerties in a file once. Tip: Just make sure that build.properties is not
checked-in to the cvs because each person on the project has to have a
different one and it would be a mess.

Ylan.

-----Original Message-----
From: Helliwell, Matthew [mailto:Matthew.Helliwell@DRKW.com]
Sent: Tuesday, October 16, 2001 8:48 AM
To: 'ant-user@jakarta.apache.org'
Subject: RE: Including a common build file with common targets.


No doubt you could do it as a single step with a bit of thought, using
<antcall> presumably. However, surely a developer would only need to build
the build file once, when the start work on a component? They'd be no need
to regenerate it for every build.

<check out code>
<generate build file>
<get on with the work>


-----Original Message-----
From: Albertus Vermeulen [mailto:AlbertusV@meb.co.za]
Sent: 16 October 2001 14:47
To: 'ant-user@jakarta.apache.org'
Subject: RE: Including a common build file with common targets.


That would be an interesting approach, but as the guys are busy developing
and building components in our development environment they would basically
only want to configure the very few properties for their project and then be
able to build without needing to have to build their own build files.

I'm not quite that familiar with Ant so maybe you could help me out ...
would your solution mean that the developers would have to go through two
steps ? In other words would they have to do something like:

> ant -buildfile build.common buildfile // This would create a build.xml
file
> ant compile // This would use the generated build.xml file

Or would it be possible to hide it in such a way that the developer could
just type:
> ant compile

And the building of the build.xml file would then be hidden from the
developer ?

-----Original Message-----
From: Helliwell, Matthew [mailto:Matthew.Helliwell@DRKW.com]
Sent: 16 October 2001 03:15
To: 'ant-user@jakarta.apache.org'
Subject: RE: Including a common build file with common targets.


You could always have a build process to build your build file, substituting
the location of the common.xml file for a token.
-----Original Message-----
From: Albertus Vermeulen [mailto:AlbertusV@meb.co.za]
Sent: 16 October 2001 13:55
To: 'ant-user@jakarta.apache.org'
Subject: RE: Including a common build file with common targets.


Jim,

Unfortunately that won't work for us. As I mentioned in my initial post:

"In the archives&faq I have seen recommendations to use a command of the
following syntax:
<!DOCTYPE project [<!ENTITY common SYSTEM "file:./common.xml">]>

Unfortunately for me I don't have a fixed location for the common.xml file.
I need to use an environment variable to specify the location (i.e.
something like: file:${SOME_DIR}/common.xml )and therefor the above doesn't
work for me.

Using <property environment="ENV"/> I can access environment properties from
a shared location but unfortunately not the common targets I need. <property
file="${ENV.DEVELOP_HOME}/tools/make/.antproperties"/>

Does anyone have some ideas? I saw someone mention the Jakarta-Taglibs
project, but I could not see where any files made reference to the
common.xml file ?"

Do you have any ideas as to something else I could try ?

Albertus
-----Original Message-----
From: Jim Jackl-Mochel [mailto:jmochel@foliage.com]
Sent: 16 October 2001 02:03
To: ant-user@jakarta.apache.org
Subject: Re: Including a common build file with common targets.


We uyse a common confi.ant file that is brought in via entity reference from
a common location. I believe the method is descrivbed  in the FAQ.

Jim
----- Original Message -----
From: Albertus Vermeulen
To: 'ant-user@jakarta.apache.org'
Sent: Tuesday, October 16, 2001 7:00 AM
Subject: RE: Including a common build file with common targets.


Hi Jerry,

Thanks for your input, your solution would mean less lines in the build.xml
files, but doesn't really provide me with the solution I'm looking for. I'm
really looking for an equavalent of include in makefiles. In our development
environment we have seperate components that developers are working on. They
all need to make the same targets, but for their own projects. We currently
maintain these "make" targets in one file and this ensures that there is
very little clutter in the Makefiles of each developer. This can't be
changed when we move to Ant.

Do you or anyone else have any other suggestions I might try ? Are there any
features of Ant which I've missed in the docs that might help me out ?

Albertus
-----Original Message-----
From: Li, Jerry [mailto:Jerry.Li@WorldChain.com]
Sent: 15 October 2001 06:14
To: 'ant-user@jakarta.apache.org'
Subject: RE: Including a common build file with common targets.


I have put all my common targets into build_cfg.xml, and call it in my local
build.xml as the following:

<project default="compile" basedir=".">
<!-- =================================================================== -->
<!-- Initialization target -->
<!-- =================================================================== -->
<target name="init">
<tstamp/>
<property environment="ENV"/>
<property name="ANTCONF_DIR" value="${ENV.WORK_DIR}/src"/>
<property name="SRC" value="${user.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<ant antfile="${ANTCONF_DIR}/build_cfg.xml" target="compile"/>
</target>
</project>

Please note that I am using the ENV to specify where my build_cfg.xml.
jerry
-----Original Message-----
From: Albertus Vermeulen [mailto:AlbertusV@meb.co.za]
Sent: Monday, October 15, 2001 8:58 AM
To: 'ant-user@jakarta.apache.org'
Subject: Including a common build file with common targets.


Hi,
I'm new to Ant and would like to move our current Makefiles to Ant. I have a
requirement to be able to include common properties and targets from a
shared file.
In the archives&faq I have seen recommendations to use a command of the
following syntax:
<!DOCTYPE project [<!ENTITY common SYSTEM "file:./common.xml">]>
Unfortunately for me I don't have a fixed location for the common.xml file.
I need to use an environment variable to specify the location (i.e.
something like: file:${SOME_DIR}/common.xml )and therefor the above doesn't
work for me.
Using <property environment="ENV"/> I can access environment properties from
a shared location but unfortunately not the common targets I need.
<property file="${ENV.DEVELOP_HOME}/tools/make/.antproperties"/>
Does anyone have some ideas? I saw someone mention the Jakarta-Taglibs
project, but I could not see where any files made reference to the
common.xml file ?
Any help would be greatly appreciated.
Albertus


--------------------------------------------------------------------------
Note: The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify us immediately by replying to the message and deleting it from
your computer. Thank you.
--------------------------------------------------------------------------


----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail
disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------



----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail
disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------


Mime
View raw message