有没有办法在不覆盖build.xml的情况下生成ant文件local.properties? [英] Is there a way to generate ant file local.properties without overwriting build.xml?

查看:27
本文介绍了有没有办法在不覆盖build.xml的情况下生成ant文件local.properties?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我的 android 项目生成了 ant build.xml,使用 android update project --name <project_name>--target --path path/to/your/project/(根据 http://developer.android.com/guide/developing/other-ide.html),然后修改了我的 build.xml(有一些自定义代码).所以我的 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 文件,该文件也是由 android update project 生成的,因此 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 以便开发人员(或构建服务器)可以检查代码并使用 VCS 的 build.xml 构建项目?

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,请将 version-tag 条目更改为与其默认值 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"

这篇关于有没有办法在不覆盖build.xml的情况下生成ant文件local.properties?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆