Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to generate ant file local.properties without overwriting build.xml?

Tags:

android

ant

I've generated ant build.xml for my android project, using android update project --name <project_name> --target <target_ID> --path path/to/your/project/ (according to http://developer.android.com/guide/developing/other-ide.html) and then modified my build.xml (some custom code is there). So my build.xml is in the VCS.

But in order to perform a build I need local.properties file, which is also generated by android update project and so build.xml gets overwritten.

local.properties is not to be checked into the VCS.

Is there a way to only generate the local.properties so that developers (or a build server) can check out the code and build the project using build.xml from VCS?

Thanks!

like image 428
Fedor Avatar asked Jan 09 '12 14:01

Fedor


People also ask

What is Basedir in build xml?

The 'basedir' is the base directory from which any relative directories used within the Ant build file are referenced from. If this is omitted the parent directory of the build file will be used.

How do I build an Ant build xml?

Create Ant build fileIn the Project tool window, select the directory, where the build file should be created. Right-click the directory and from the context menu, select New | File ( Alt+Insert ). In the New File dialog, specify the name of the new file with the xml extension, for example, build. xml.

Can you write a build xml?

How do I write build. xml file? here is a sample build. xml you just need to know important element e.g. project ,target ,property and task and the order in which different target gets executed to start with basic build procedure.


2 Answers

Do not put local.properties into the VCS: generate it whenever it does not exist already (after a clean checkout, for instance), by running

android update project -p .

so android can generate it with the right path to the sdk. ant.properties or project.properties are meant to be put in VCS with whatever you need fixed on every possible build environment.

If you do not want the build.xml to be modified, change the version-tag entry to something different to its default value, which is 1. For instance:

<!-- version-tag: custom -->

If you have a look at the build.xml comments, it states that by saying:

 ***********************
 ****** IMPORTANT ******
 ***********************
     In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
     in order to avoid having your file be overridden by tools such as "android update project"
like image 180
David Santiago Turiño Avatar answered Oct 08 '22 13:10

David Santiago Turiño


Given that it (in general) only contains a single property, sdk.dir, pointing to the developer's Android SDK root, I'm inclined to say that it's not asking too much for the developers to just create it by hand.

like image 26
slyfox Avatar answered Oct 08 '22 14:10

slyfox