Is it possible to run a particular ant script from scons?
For example running this script from the command line works
/usr/local/bin/ant release -f /Users/dev/pic/src/platform/android/java/build.xml
is it possible to have this successfully run in scons? I try this:
env.Command('local.properties', [], "/usr/local/bin/ant release -f /Users/dev/pic/src/platform/android/java/build.xml")
but that fails because it doesn't output the local.properties file with the correct SDK location
BUILD FAILED
/Users/dev/pic/src/platform/android/java/build.xml:55: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable.
But those variables are correct. Is there a way to overcome this obstacle using scons?
It depends on how and when you want to execute ant
, but yes it is indeed possible.
If you want to execute this ant
script every time SCons
executes, then you can use the SCons Execute() function, as follows:
env.Execute("/usr/local/bin/ant release -f /Users/dev/pic/src/platform/android/java/build.xml")
This will execute every time, with no target/source dependency checking.
If you only want this ant script to execute if a certain target is out of date, then use the SCons Command() function as follows:
env.Command(target='local.properties',
source='/Users/dev/pic/src/platform/android/java/build.xml',
action='/usr/local/bin/ant release -f $SOURCE')
Im not sure if I got the source and target files correct, you may need to fix it.
Notice that SCons
only works with sources and targets that are in or below the SCons
project directory hierarchy. The root of said hierarchy is where the SConstruct
script is located.