You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Nico Seessle <ni...@apache.org> on 2001/05/01 00:14:49 UTC
Re: Platform specific targets???
----- Original Message -----
From: "Bill Meyer" <BM...@HNS-NET.com>
To: <an...@jakarta.apache.org>
Sent: Monday, April 30, 2001 11:06 PM
Subject: Platform specific targets???
> Does anyone have an example of a target that is only executed on a
specific
> platform?
>
> For example- I have a module of code that is JNI based and I only want it
> built on Unix. There are no native binaries available on Windows NT so it
> wouldn't make sense to execute the target to build the JNI code on NT,
only
> Unix.
>
How do you want to detect "Unix"? If file separator == "/" is enough for
you, you might use something like:
<?xml version="1.0"?>
<project name="PROJECT" default="test" basedir=".">
<property name="pathSeparatorIs${file.separator}" value="1"/>
<target name="test" depends="onlyOnDosWindows,onlyOnUnix"/>
<target name="onlyOnDosWindows" if="pathSeparatorIs\">
<echo message="DOS/Windows"/>
</target>
<target name="onlyOnUnix" if="pathSeparatorIs/">
<echo message="Unix"/>
</target>
</project>
Nico