ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Les Hughes <leslie.hug...@rubus.com>
Subject RE: Ant with Perforce
Date Fri, 09 Mar 2001 13:51:17 GMT
Sure, here's an example. I'm not saying this is the *best* way, just one way
:-)

In perforce consider a depot laid out:-

//projects/myproject/main/buildsystem/conf/nt/build.properties
//projects/myproject/main/buildsystem/conf/unix/build.properties
//projects/myproject/main/buildsystem/etc/build.xml
//projects/myproject/main/src

Each props file is customised per environment
	proj.dir=D:/projects/myproject
	src.dir=${proj.dir}/src
	build.dir=${proj.dir}/build
for NT and
	proj.dir=/export/myproject
	src.dir=${proj.dir}/src
	build.dir=${proj.dir}/build
for Unix.

Your client spec for your Unix box would map
//projects/myproject/main/buildsystem/conf/unix/...
/export/myproject/buildsystem/conf/...
similarly your NT would look something like
//projects/myproject/main/buildsystem/conf/nt/...
/export/myproject/buildsystem/conf/...

You Ant buildfile could look something like (below)
Then running p4 sync on either client automagically maps out the correct
build.props. Think of this as 
bootstrapping the buildsystem for your project. You can then run ant with
the correct props. for your env. which will probably involve another
<p4sync/> task to grab the actual project source. I find it a lot easier to
think of the buildsystem as a separate project which builds other (related)
projects.

<?xml version="1.0"?>

<project name="myproject" default="main" basedir="..">

<!-- Import plaform specific build properties -->
    <property file="../conf/build.properties" />
	
    <target name="main" depends="init, compile, deploy">
	    <echo message="Build Done. Check logfile" />
    </target>	    
	
	<target name="init" depends="clean">
	  <!-- Import platform filters -->
        <filter filtersfile="conf/filter.properties" />

	  <!-- make build dir structure -->
		<mkdir dir="${build.dir}" />
		<mkdir dir="${build.dir}/classes" />
      </target>
	
	<target name="compile">
		<javac srcdir="${src.dir}/java"
			destdir="${build.dir}/classes"
			optimize="off"
			debug="off"
			classpath="${classpath}" />
	</target>
etc...
etc...
</project>

Enjoy,

Les




> -----Original Message-----
> From: msew [mailto:msew@ev1.net]
> Sent: 09 March 2001 13:30
> To: leslie.hughes@rubus.com
> Subject: RE: Ant with Perforce
> 
> 
> any chance you could send me those 2 files? :-)
> 
> the build.props and the filters.properties
> 
> examples always make one's life a little nicer :-)
> 
> 
> thanks!!!
> 
> 
> msew
> 
> 
> At 11:29 03/09/2001 +0000, you wrote:
> >Hey Diane, Didn't know you're a Perforce guru :-)
> >
> >The ant tasks simply wrap p4 functionality. If you can p4 sync
> >//depot/myproject/main/src/... or whatever on the cmd line 
> then you can just
> >copy that view into the <p4sync 
> view="//depot/myproject/main/src/..."> task.
> >
> >Your clientspec could then have a mapping something like
> >
> >//depot/myproject/... /home/me/myproject/...
> >
> >and your src dir would end up in /home/me/myproject/main/src/...
> >
> >One cool thing (usage pattern?) about p4 is that you can map out a
> >per-platform props file into the same physical location 
> using a different
> >clientspec for each machine/environment. That way your build 
> script needs
> >only to have a <properties file="build.props"/> (and even a <filters
> >filtersfile="filters.properties"/>) which automagically 
> changes to reflect
> >specific settings for that particular machine (it's easier 
> to do it than to
> >explain it :-)
> >
> >Bye,
> >
> >Les
> >
> >
> >
> > > -----Original Message-----
> > > From: Diane Holt [mailto:holtdl@yahoo.com]
> > > Sent: 08 March 2001 19:22
> > > To: ant-user@jakarta.apache.org
> > > Subject: Re: Ant with Perforce
> > >
> > >
> > > --- "M.A.Dunphy" <madunphy@bigfoot.com> wrote:
> > > > We are looking at p4 an our scm and I've been 
> struggling with it and
> > > > ant's integration all day and getting nowhere fast.
> > > >
> > > > The build file previously worked in a sandbox environment,
> > > i.e depending
> > > > on where you ran the build, the source code would be 
> fetched to a
> > > > relative path (using VSS) and built from there.
> > > >
> > > > Now I'm trying to do the same with p4, but cant see how to
> > > fetch code to
> > > > a location relative to where we are running ant?
> > >
> > > With Perforce, you do things based on a client workspace. If
> > > you want to
> > > write me directly, I can give you some general ideas, but
> > > ultimately, how
> > > you end up dealing with things will depend on your 
> particular setup.
> > >
> > > Diane
> > >
> > > =====
> > > (holtdl@yahoo.com)
> > >
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Get email at your own domain with Yahoo! Mail.
> > > http://personal.mail.yahoo.com/
> > >
> 

Mime
View raw message