----- Original Message -----
From: "Bill Meyer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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


Reply via email to