There are off-the-peg example from class library build script.
You can check it out at
https://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk/make/properties.xml
.
FYI
<cite>
...
<!-- Conditions for operating systems -->
<condition property="is.windows">
<os family="Windows" />
</condition>
<condition property="is.linux">
<os name="linux" />
</condition>
<condition property="is.macosx">
<os name="mac os x" />
</condition>
<condition property="is.freebsd">
<os name="freebsd" />
</condition>
<condition property="is.aix">
<os name="aix" />
</condition>
<condition property="is.unix">
<os family="unix" />
</condition>
<condition property="is.zos">
<os name="z/OS" />
</condition>
<!-- Normalized operating system family -->
<condition property="hy.os.family" value="windows">
<isset property="is.windows" />
</condition>
<property name="hy.os.family" value="unix" />
<!-- Normalized operating system name -->
<!-- this special case makes sense -->
<condition property="hy.os" value="windows">
<isset property="is.windows"/>
</condition>
<condition property="hy.os" value="linux">
<os name="linux" />
</condition>
<condition property="hy.os" value="freebsd">
<os name="freebsd" />
</condition>
<condition property="hy.os" value="macosx">
<isset property="is.macosx"/>
</condition>
<condition property="hy.os" value="aix">
<os name="aix" />
</condition>
<condition property="hy.os" value="zos">
<isset property="is.zos"/>
</condition>
<property name="hy.os" value="${os.name}" />
<!-- Conditions for different architectures -->
<condition property="is.x86_64">
<or>
<equals arg1="x86_64" arg2="${os.arch}"/>
<equals arg1="amd64" arg2="${os.arch}"/>
</or>
</condition>
<condition property="is.x86">
<and>
<not>
<isset property="is.x86_64" />
</not>
<or>
<equals arg1="x86" arg2="${os.arch}"/>
<equals arg1="i386" arg2="${os.arch}"/>
</or>
</and>
</condition>
<condition property="is.ia64">
<equals arg1="ia64" arg2="${os.arch}"/>
</condition>
<condition property="is.ppc32">
<or>
<equals arg1="${os.arch}" arg2="ppc32" />
<equals arg1="${os.arch}" arg2="ppc" />
</or>
</condition>
<condition property="is.ppc64">
<equals arg1="${os.arch}" arg2="ppc64" />
</condition>
<condition property="is.s390x">
<equals arg1="${os.arch}" arg2="s390x" />
</condition>
<condition property="is.s390">
<equals arg1="${os.arch}" arg2="s390" />
</condition>
<condition property="is.64bit">
<or>
<isset property="is.ia64" />
<isset property="is.x86_64" />
<isset property="is.ppc64" />
<isset property="is.s390x" />
</or>
</condition>
<condition property="is.32bit">
<or>
<isset property="is.x86" />
<isset property="is.ppc32" />
<isset property="is.s390" /> <!-- 31bit of course -->
</or>
</condition>
<condition property="hy.bits" value="32">
<isset property="is.32bit" />
</condition>
<property name="hy.bits" value="64" />
<!-- Normalized architecture name -->
<condition property="hy.arch" value="x86_64">
<isset property="is.x86_64" />
</condition>
<condition property="hy.arch" value="x86">
<and>
<isset property="is.x86" />
<isset property="is.32bit" />
</and>
</condition>
<condition property="hy.arch" value="ppc32">
<isset property="is.ppc32" />
</condition>
<property name="hy.arch" value="${os.arch}" />
<!-- Normalized platform name -->
<property name="hy.platform" value="${hy.os}.${hy.arch}"/>
<property name="hy.platform.path" value="${hy.os}/${hy.arch}"/>
<condition property="exe.suffix" value=".exe">
<isset property="is.windows"/>
</condition>
<property name="exe.suffix" value="" />
<condition property="shlib.prefix" value="">
<isset property="is.windows"/>
</condition>
<property name="shlib.prefix" value="lib" />
<condition property="shlib.suffix" value=".dll">
<isset property="is.windows"/>
</condition>
<condition property="shlib.suffix" value=".dylib">
<isset property="is.macosx"/>
</condition>
<property name="shlib.suffix" value=".so" />
<condition property="progdb.suffix" value=".pdb">
<isset property="is.windows" />
</condition>
<condition property="linklib.suffix" value=".lib">
<isset property="is.windows"/>
</condition>
<condition property="linklib.suffix" value=".x">
<isset property="is.zos" />
</condition>
<condition property="linklib.suffix" value=".dylib">
<isset property="is.macosx"/>
</condition>
<property name="linklib.suffix" value=".so" />
<property name="manifest.suffix" value=".manifest" />
<condition property="make.command" value="nmake.exe">
<isset property="is.windows"/>
</condition>
<condition property="make.command" value="gmake">
<or>
<isset property="is.aix"/>
<isset property="is.freebsd"/>
</or>
</condition>
<property name="make.command" value="make" />
<condition property="make.arg" value="/nologo">
<isset property="is.windows"/>
</condition>
<property name="make.arg" value="" />
...
<cite>
2007/11/1, Sean Qiu <[EMAIL PROTECTED]>:
>
> Or make "if" support "and" operation.
>
> As we all know, ant has two build-in properties: os.name and os.arch.
> BTI can compare there two properties with the ones from the "if"
> parameter.
> In this way, it is easier to decide whether it is required to download the
> archive.
> The order of os.name and os.arch doesn't matter, such as
>
> <my-dependency-linux
> url=" http://host.of/my-dependency.zip"
> md5="87A617D7E65979AE01B5ACE4649EB40B"
> dir="my-dep-dir"
> inc="*/lib/*.jar"
> if="is.x86, is.windows"
> />
>
> And the candidate values for "if" could be is.${os.name} or is.{os.arch}.
> Any comments? Suggestions?
>
>
> 2007/11/1, Stepan Mishura < [EMAIL PROTECTED]>:
> >
> > On 11/1/07, Sean Qiu < [EMAIL PROTECTED]> wrote:
> > > The following parameters from our build script could be a proper
> > candidate,
> > > although i think we probably will only need some of them.
> > >
> > > is.windows
> > > is.unix
> > > is.linux
> > > is.freebsd
> > > is.macosx
> > > is.aix
> > > is.zos
> > > is.32bit
> > > is.64bit
> > > is.x86
> > > is.x86_64
> > > is.ia64
> > > is.ppc32
> > > is.ppc64
> > > is.s390
> > > is.s390x
> > >
> >
> > Yep, we may also add:
> > is.windows_x86
> > is.windows_x86_64
> > is.linux_x86
> > is.linux_x86_64
> >
> > Thanks,
> > Stepan.
> >
> > >
> > > 2007/11/1, Regis < [EMAIL PROTECTED]>:
> > > >
> > > > +1
> > > >
> > > > Stepan Mishura wrote:
> > > > > On 11/1/07, Sean Qiu <[EMAIL PROTECTED]> wrote:
> > > > >> Hi, BTI gurus
> > > > >>
> > > > >> As we know, some tests need to start a server before process
> > testing,
> > > > such
> > > > >> as our jetty scenario test.
> > > > >> The question is sometimes the server isn't always implemented by
> > java.
> > > > It
> > > > >> may be platform-dependent.
> > > > >>
> > > > >> Shall we add a new parameter to the dependence module of BTI?
> Such
> > as
> > > > >>
> > > > >> <external>
> > > > >> <my-dependency-windows
> > > > >> url="http://host.of/my-dependency.zip "
> > > > >> md5="87A617D7E65979AE01B5ACE4649EB40B"
> > > > >> dir="my-dep-dir"
> > > > >> inc="*/lib/*.jar"
> > > > >> os="windows"
> > > > >> />
> > > > >> </external>
> > > > >>
> > > > >> <external>
> > > > >> <my-dependency-linux
> > > > >> url=" http://host.of/my-dependency.zip"
> > > > >> md5="87A617D7E65979AE01B5ACE4649EB40B"
> > > > >> dir="my-dep-dir"
> > > > >> inc="*/lib/*.jar"
> > > > >> os="linux"
> > > > >> />
> > > > >> </external>
> > > > >>
> > > > >> In this case, BTI can download only one of them according to the
> > > > current
> > > > >> operating system.
> > > > >> Does it make sense? Or just find a java-implemented
> > > > platform-independent
> > > > >> alternative?
> > > > >
> > > > > I think it makes sense to add it. I also thought what that and
> what
> > > > > kind of parameter should be added. I'd propose adding *if*
> condition
> > > > > to the current scheme. I think it is more flexible, for example
> > > > >
> > > > > <my-dependency-linux
> > > > > url="http://host.of/my-dependency.zip"
> > > > > md5="87A617D7E65979AE01B5ACE4649EB40B"
> > > > > dir="my-dep-dir"
> > > > > inc="*/lib/*.jar"
> > > > > if="is.64bit"
> > > > > />
> > > > >
> > > > > Thanks,
> > > > > Stepan.
> > > > >
> > > > >> --
> > > > >> Sean Qiu
> > > > >> China Software Development Lab, IBM
> > > > >>
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Sean Qiu
> > > China Software Development Lab, IBM
> >
>
>
>
> --
> Sean Qiu
> China Software Development Lab, IBM
>
--
Spark Shen
China Software Development Lab, IBM