ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From supareno <reno.rkc...@free.fr>
Subject Re: Setting ant property with bash command result
Date Mon, 28 Sep 2009 21:05:41 GMT
altern a écrit :
> How could I set ant property the value which is the result of bash script
> execution? For example, I need to have target which utilizes svn and bash
> utilities in order to control build execution. Speaking more specifically,
> target that I'm trying to create will be used to define, whether there are
> modified files in deployed application via command:
>
> svn stat | awk -F ''  ' $1=="A" || $1 == "C" || $1=="M" || $1 == "D" || $1
> == "R"
>   
altern,

i don't really understand the command but did you try "| xargs" like this
 svn stat <your_svn_project>  | awk -F ''  ' $1=="A" || $1 == "C" || 
$1=="M" || $1 == "D" || $1 == "R"' | xargs -t -i ant -Dsrc='{}'

the xargs command will launch your ant build file with the result of the 
awk command as property for src....

i tried with this build file and it works ;-)

<project name="fooProject" default="echoproperty" basedir=".">
    <description>
        simple example build file launched with xargs
    </description>
  <!-- set global properties for this build -->
  <property name="src" value=""/>
  <target name="echoproperty">
    <echo>the property send to the build file is: ${src}</echo>
  </target>
</project>

more links on xargs:
http://sidvind.com/wiki/Xargs_by_example
http://en.wikipedia.org/wiki/Xargs
http://www.computerhope.com/unix/xargs.htm

hope this help

supareno


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message