ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Bug 3129
Date Tue, 10 Sep 2002 15:49:10 GMT
I stand correct Stefan ;-) Thanks for straightening me out. Here's a Which
task (summarily tested) that does perform as expected. Cheers, --DD

Debug output (minus class loader stuff) of summary test:
+User task: which     com.lgc.buildmagic.Which
Setting project property: -which-defined -> true

   +Task: which
Searching P:\com_lgc\dsp\dsp-core\tools\ant\bin
Setting project property: ant.bat ->
Set property expected = P:/com_lgc/dsp/dsp-core/tools/ant/bin/ant.bat
Setting project property: expected ->
Set property ant.batU = P:/com_lgc/dsp/dsp-core/tools/ant/bin/ant.bat
Setting project property: ant.batU ->
Condition true; setting found to true
Setting project property: found -> true
   +Task: which
Searching C:\WINNT\system32
Searching C:\WINNT
Searching C:\WINNT\System32\Wbem
Searching C:\pro\exceed\Accessories
Searching C:\pro\bin
Setting project property: cvs.exe -> C:\pro\bin\cvs.exe
cvs.exe = C:\pro\bin\cvs.exe

Summary test:
  <target name="test-which" depends="compile, -which">
    <which property="ant.bat" basename="ant.bat">
      <searchpathelement location="${ant.home}/bin" />
    <pathconvert targetos="unix" property="expected">
      <path path="${ant.home}/bin/ant.bat" />
    <pathconvert targetos="unix" property="ant.batU">
      <path path="${ant.bat}" />
    <condition property="found">
      <equals arg1="${ant.batU}" arg2="${expected}" />
    <fail message="ant.bat = ${ant.batU} != ${expected}"
          unless="found" />

    <which property="cvs.exe" basename="cvs.exe" searchpath="${env.Path}" />
    <echo message="cvs.exe = ${cvs.exe}" />

  <target name="-which" unless="-which-defined">
    <taskdef name="which" classname="com.lgc.buildmagic.Which"
             classpath="${classes}" />
    <property name="-which-defined" value="true" />

-----Original Message-----
From: Stefan Bodewig [] 
Sent: Tuesday, September 10, 2002 1:18 AM
Subject: Re: Bug 3129

On Mon, 9 Sep 2002, Dominique Devienne <> wrote:

> You can get the absolute pathname of your executable on Win32 using:
> <available property="ssh.exe" file="ssh.exe" filepath="${env.Path}"
> />
> and use ${ssh.exe} thereafter.

Are you sure?

I'd think this property would be either unset or "true" after that
task.  Yep:

[bodewig@bodewig bodewig]$ cat > /tmp/ssh.xml 
<project default="foo">
  <target name="foo">
    <property environment="env"/>
    <available property="ssh" file="ssh" filepath="${env.PATH}"/>
[bodewig@bodewig bodewig]$ ant -f /tmp/ssh.xml -verbose
Apache Ant version 1.6alpha compiled on September 9 2002
Buildfile: /tmp/ssh.xml
 [property] Loading Environment env.
[available] Found: ssh in /usr/bin
     [echo] true

Total time: 3 seconds


View raw message