I have a legacy ant file that I need to modify, and I hope you can help.
Currently, the source directories are defined in path elements that are later passed for compile:
I need to granularize this and specify in a properties file which packages should be used for different compile types - for example "compile1" should only compile package1 stuff, "compile2" another set of packages, and "compile" - all of them.
So something like this
Is there a way to put conditions like this?
Or maybe at the <path> level, only include the source directories based on the specified properties?
I have used two mechanism to do things like this. One is to have different properties files that assign different value and then choose which properties file to use for the build. The other is to use the <condition> task to selectively set properties. If that is not enough of a hint, let us know...
What I figured out yesterday, before you answered is something like this:
(I even had a more complicated problem, with sub-packages)
the properties files specifies which "modules" to add
Is this the correct way and what you meant about <condition> ? Is there a easier way to do this, or perhaps a more elegant one? (with less code, so those reading it afterwards can comprehend what happens easier? )
Later edited to add that this approach gives me unpredictable behaviour, for example I set in my properties file only "build-b" and I still got, for some reason stuff from "a-1". Can't figure out why
In other words, conditionally set a property to your desired source base directory and pass that property value off to javac.
Joined: May 07, 2003
Thanks for your reply!
Your code looks much better and is way more readable than mine, so if I can trouble you a little more:
Unfortunately, my "src" is composed of several such packages for each case, so I need a way to coalesce several paths into one "variable", or to conditionally append more directories to the "src".
For example, for the case "one.a.1", I'd need a package "common.a", then "one.a.1","one.a.1.i","one.a.1.ii","some.other.package" - you get the picture.
Thanks again, in advance
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: ant beginner - conditionally select paths