views:

369

answers:

2

In ant you can do something like:

<property name="version" value="${some.fake.version}"

<shellscript shell="bash" dir="${build.dir}"> 
   echo "some shell cmds"
   df -h
   ls *
   svn export http://svn.org/somedir              
</shellscript>

Okay, that shell script doesn't do anything, I know, but how would I the property "version" from within that shellscript?

I know you can do all of the above in Java scripting which is better than most uses, but in the real script I'm doing a ton of svn commands which I'll have to shell out for anyway.

+1  A: 

There are some "official" SVN Ant Tasks available if you didn't want to write your own.

Otherwise, since ShellScript extends Exec you could use arguments.

<shellscript shell="bash" dir="${build.dir}"> 
  <arg value="${someproperty}"/>
   echo $1
</shellscript>
Dave Webb
+1  A: 

According to the shellscript documentation:

Embedded ant properties will be converted.

So you can use the ${variable} notation:

<shellscript shell="bash" dir="${build.dir}"> 
   echo "Version: ${version}"
</shellscript>
flicken
That worked. I tried that very same thing first, but I did it on another variable that had problems up the stack, so I wasn't seeing the value. Thank you.
Spyplane