TheWaterProgrammer
TheWaterProgrammer

Reputation: 8229

How to use ant command line to pick my custom build.xml

I have a QtApp for android which I build command line using the following command. It builds using ant. All great. Builds fine. Runs fine. Following the core command which creates & signs the apk for me.

ANT_OPTIONS=" -ant"
Path/To/androiddeployqt --sign /Path/to/MyKey.keystore MyAlias --storepass MyPassword --output android --verbose --input /path/to/android-libMyQtApp.so-deployment-settings.json $ANT_OPTIONS

Next, I have a few versioning customisations to do for which I need to create my own build.xml & make ant pick my custom build.xml. I read through the following ant official page which describes usage of -buildfile & states that you can mention the directory containing your custom build.xml. https://ant.apache.org/manual/running.html

As I want to use my custom build.xml which I created in my project directory, I made the following change in the command.

ANT_OPTIONS=" -ant -buildfile '/Directory/containing/my_build.xml'"
Path/To/androiddeployqt --sign /Pathto/MyKey.keystore MyAlias --storepass MyPassword --output android --verbose --input /path/to/android-libMyQtApp.so-deployment-settings.json $ANT_OPTIONS

But ant still picks up the default generated build.xml. What is wrong in my ANT_OPTIONS ? Does androiddeployqt dis-allow me from passing extra ant command line options ?

Or, is it possible to create an ant.properties file so that ant picks up my custom build commands ? I just want to increment the version number of my android app

Upvotes: 2

Views: 5093

Answers (1)

Rao
Rao

Reputation: 21359

As per apache-ant documentation there are three options available to choose the build script if that is not default name (build.xml).

 -buildfile <file>      use given buildfile
    -file    <file>              ''
    -f       <file>              ''

And you can see below that all the above versions are working:

- bash $~/Documents/so$ ant -buildfile build-regex.xml 
Buildfile: /home/apps/Documents/so/build-regex.xml

myTarget:
     [echo] D:/MyFolder/abc/

BUILD SUCCESSFUL
Total time: 0 seconds
- bash $~/Documents/so$ ant -f build-regex.xml 
Buildfile: /home/apps/Documents/so/build-regex.xml

myTarget:
     [echo] D:/MyFolder/abc/

BUILD SUCCESSFUL
Total time: 0 seconds
- bash $~/Documents/so$ ant -file build-regex.xml 
Buildfile: /home/apps/Documents/so/build-regex.xml

myTarget:
     [echo] D:/MyFolder/abc/

BUILD SUCCESSFUL
Total time: 0 seconds

You tried the option -buildfile and it is strange it did not work. You may try -f or -file option.

Upvotes: 4

Related Questions