有没有一种方法来生成Ant文件local.properties而不覆盖的build.xml?而不、方法来、文件、Ant

2023-09-05 02:01:20 作者:夜空中最亮的星

我已经生成的Ant的build.xml我的Andr​​oid项目,使用 Android的更新项目--name< PROJECT_NAME> --target< target_ID> --path路径/要/你/项目/ (根据http://developer.android.com/guide/developing/other-ide.html)然后修改了我的build.xml(一些定制code是有),所以我的build.xml在VCS。

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.

但为了执行构建我需要local.properties文件,该文件也是由生成的Andr​​oid更新项目等build.xml文件被覆盖。

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是不是可以签入到VCS。

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

有没有办法只生成local.properties以便开发人员(或构建服务器)可以检查出code和建设使用的build.xml从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?

谢谢!

推荐答案

不要把local.properties到VCS:生成它时,它已经不存在(一个干净的检出后,例如),通过运行

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 .

因此​​Android能够用正确的路径SDK生成它。 ant.properties或project.properties的用意是要放在VCS与任何你需要固定在每一个可能的构建环境。

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.

如果您不希望build.xml文件进行修改,修改的版本标签进入不同的东西为它的默认值,即1。例如:

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 -->

如果你看一下这个build.xml的意见,它指出说:

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"