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

做~自己de王妃 提交于 2019-12-21 03:24:09

问题


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!


回答1:


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"



回答2:


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.




回答3:


It seems that if only path parameter is specified (for example android update project --path . when called from the project directory) only local.properties and proguard.cfg files are updated.



来源:https://stackoverflow.com/questions/8790286/is-there-a-way-to-generate-ant-file-local-properties-without-overwriting-build-x

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!