> From: Rhino [mailto:[EMAIL PROTECTED]
>
> Can you tell me what search words to use for finding some of these
many
> examples that you say are in the archives? I spent considerable time
> looking
> in the archive already, using search terms like 'conditional property'
and
> so forth but none of them revealed a clear example that resembled what
I
> am trying to do.

Here's an old example I grabbed from a build file of a friend.

  <!-- Set platform-specific properties -->
  <target name="set_platform_properties"
          depends="set_platform,
                   set_properties_windows,
                   set_properties_linux,
                   set_properties_solaris"/>
  <target name="set_platform">
    <condition property="os.is.windows">
      <os family="windows"/>
    </condition>
    <condition property="os.is.linux">
      <os name="Linux"/>
    </condition>
    <condition property="os.is.solaris">
      <os name="SunOS"/>
    </condition>
  </target>
  <target name="set_properties_windows" if="os.is.windows">
    <property name="platform" value="win32"/>
    <property name="can.jni" value="true"/>
  </target>
  <target name="set_properties_linux" if="os.is.linux">
    <property name="platform" value="linux"/>
    <property name="can.jni" value="true"/>
  </target>
  <target name="set_properties_solaris" if="os.is.solaris">
    <property name="platform" value="solaris"/>
    <property name="can.jni" value="true"/>
  </target>

I personally have my own version of <property> that supports
different builtin conditions, so I rarely need the technique
anymore ;-) --DD

    <bm:property name="host">
      <value osFamily="windows" value="${env.COMPUTERNAME}" />
      <value osFamily="unix"    value="${env.HOSTNAME}" />
    </bm:property>

    <bm:property name="cvs"> <!-- Use TortoiseCVS' cvs.exe on Windows
-->
      <value os="win32" location="C:\Program Files\TortoiseCVS\cvs.exe"
/>
      <default value="cvs" />
    </bm:property>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to