ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nico Seessle" <>
Subject Re: Platform specific targets???
Date Mon, 30 Apr 2001 22:14:49 GMT
----- Original Message -----
From: "Bill Meyer" <>
To: <>
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
> 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,
> 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 name="onlyOnUnix" if="pathSeparatorIs/">
    <echo message="Unix"/>



View raw message