Build dependencies: A different approach
Build dependencies: A different approach
- Subject: Build dependencies: A different approach
- From: Timo Hoepfner <email@hidden>
- Date: Fri, 24 Apr 2009 17:17:25 +0200
Hi,
we're currently setting up Hudson as build server for our projects.
Everything is working great, but managing the dependencies is a pain.
After giving maven another rather short shot yesterday, I ended up
coding a ruby script which determines the dependencies for a project,
brings them in a buildable order and then simply calls ant from
within the project folder.
[mbp:~] th% deps.rb -h
Usage: deps [options]
Required arguments:
-b, --build-dir=ARG Path to build the projects into
-p, --project=ARG Name of the project to build
-r, --root-dir=ARG Path to root directory
Can be specified more than once
Optional arguments:
-d, --debug Don't build, just determine
dependencies
-a, --ant=ARG Path to ant (optional)
-w, --woproject-jar=ARG Path to woproject.jar
-o, --properties=ARG Path to the woproperties file
to use
-h, --help Show this message
[mbp:~] th% deps.rb --root-dir=Wonder --build-dir=TestBuild --
project=AjaxExample --debug
Building build 'ERJars' in /Users/th/Wonder/Frameworks/Core/ERJars
Building build 'JavaWOExtensions' in /Users/th/Wonder/Frameworks/Core/
JavaWOExtensions
Building build 'ERExtensions' in /Users/th/Wonder/Frameworks/Core/
ERExtensions
Building build 'Ajax' in /Users/th/Wonder/Frameworks/Ajax/Ajax
Building build 'ERPrototypes' in /Users/th/Wonder/Frameworks/Core/
ERPrototypes
Building build 'JavaMemoryAdaptor' in /Users/th/Wonder/Frameworks/
EOAdaptors/JavaMemoryAdaptor
Building build 'AjaxExample' in /Users/th/Wonder/Examples/Ajax/
AjaxExample
Done
What does it do?
You give the script a number of root folders, which it then scans for
Eclipse's .classpath files. Currently it scans the first 5 levels of
folders, as that's the required depth for Wonder when its root dir is
checked out into your workspace and you specify the workspace as root.
It then "parses" the classpath files to get the dependencies for each
project within the root folders. This also means, the dependencies
must be specified as WOFramework, not as Project.
It then determines all direct and indirect dependencies of the
project to be built.
Finally it looks for a project which can be build (has no
dependencies), builds it by changing in it's project dir and calling
"ant build", setting the "build.dir", "wo.external.root" and
"wo.external.frameworks" properties all to the path specified on the
command line.
This way, when the build is successful, it ends up in the
wo.external.frameworks dir and can be accessed by the following builds.
Of course this only works, if there is a build.xml for each
framework, the out-of-the-box build.xml files from wolips are fine.
After the build, the project is removed from the pending dependencies
of the remaining projects and the process is repeated until nothing
is left to be done.
The current version of the script can be found here: <https://
gist.github.com/c0c98422d3089c3ea310>
I'm sure there is still a lot to improve, but it appears to be
working ok in our tests. And it doesn't need another configuration
file which needs to be maintained.
Let me know what you think.
Timo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden