On Jun 16, 2007, at 9:26 PM, Q wrote:

I am reworking the WAR and SSDD targets in a build.xml file and am trying to add some error checking. I can verify that individual files like web.xml and LICENSE exist, but I also want to check if all the required frameworks in my ant.frameworks.wo.wolocalroot file exist as jars in /Library/WebObjects/lib while building the war file (like xcode does).

I can create the file list I need to check easily enough, but I am not sure how to get ant to verify that a list of files exist, or even iterate over a list checking them individually. I would prefer to do this without having to add additional taskdef dependencies other than woproject.

Any suggestions?

--
Seeya...Q

Quinton Dolan - [EMAIL PROTECTED]
Gold Coast, QLD, Australia
Ph: +61 419 729 806


It is possible to do "if-then-else" style logic in ant. It is just extremely awkward. To tell the truth, every time I need to do it, I need to re-learn it. It is just very non-intuitive. You want to look very carefully at the documentation for the <condition> task, the <available> task and a few others. Maybe a third-party task handles it more nicely.

Ant is much happier trying to find a resource for you. If you want to check whether the /System/Library/Frameworks/JavaFoundation.framework directory exists and fail if it does not, that is a bit awkward. If you want to say find the framework in one place, or else in another, or finally in a third, ant is much happier about doing that.

For example:

% cat build.xml
<project name="questions">
     <target name="one">
<available file="/System/Library/Frameworks/ JavaFoundation.framework" property="FoundationFound" /> <fail unless="FoundationFound" message="Foundation does not exist!" />
     </target>

     <target name="two">
<available file="/System/Library/Frameworks/ NSNothing.framework" property="NothingFound" /> <fail unless="NothingFound" message="Nothing does not exist, so something exists?" />
     </target>
</project>
%
% ant one
Buildfile: build.xml

one:

BUILD SUCCESSFUL
Total time: 0 seconds
%
% ant two
Buildfile: build.xml

two:

BUILD FAILED
/Users/ray/foo/build.xml:9: Nothing does not exist, so something exists?

Total time: 0 seconds
%
%

The words in the "unless" are the names of properties. One can, of course, set a property to equal the property name. One ends up expressing the "if-then-else" logic by setting properties and keying actions off of them.

Not exactly crystal clear, no? But it is possible. It just ends up looking weird.

- ray
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to