Merge change 22676 into eclair

* changes:
  Ant properties names legacy support
This commit is contained in:
Android (Google) Code Review
2009-08-25 16:52:21 -07:00
2 changed files with 27 additions and 5 deletions

View File

@@ -61,8 +61,12 @@ public final class SetupTask extends ImportTask {
// ant property with the path to the android.jar // ant property with the path to the android.jar
private final static String PROPERTY_ANDROID_JAR = "android.jar"; private final static String PROPERTY_ANDROID_JAR = "android.jar";
// LEGACY - compatibility with 1.6 and before
private final static String PROPERTY_ANDROID_JAR_LEGACY = "android-jar";
// ant property with the path to the framework.jar // ant property with the path to the framework.jar
private final static String PROPERTY_ANDROID_AIDL = "android.aidl"; private final static String PROPERTY_ANDROID_AIDL = "android.aidl";
// LEGACY - compatibility with 1.6 and before
private final static String PROPERTY_ANDROID_AIDL_LEGACY = "android-aidl";
// ant property with the path to the aapt tool // ant property with the path to the aapt tool
private final static String PROPERTY_AAPT = "aapt"; private final static String PROPERTY_AAPT = "aapt";
// ant property with the path to the aidl tool // ant property with the path to the aidl tool
@@ -82,9 +86,12 @@ public final class SetupTask extends ImportTask {
String sdkLocation = antProject.getProperty(ProjectProperties.PROPERTY_SDK); String sdkLocation = antProject.getProperty(ProjectProperties.PROPERTY_SDK);
// check if it's valid and exists // check if it's valid and exists
if (sdkLocation == null || sdkLocation.length() == 0) {
sdkLocation = antProject.getProperty(ProjectProperties.PROPERTY_SDK_LEGACY);
if (sdkLocation == null || sdkLocation.length() == 0) { if (sdkLocation == null || sdkLocation.length() == 0) {
throw new BuildException("SDK Location is not set."); throw new BuildException("SDK Location is not set.");
} }
}
File sdk = new File(sdkLocation); File sdk = new File(sdkLocation);
if (sdk.isDirectory() == false) { if (sdk.isDirectory() == false) {
@@ -152,8 +159,9 @@ public final class SetupTask extends ImportTask {
String androidJar = androidTarget.getPath(IAndroidTarget.ANDROID_JAR); String androidJar = androidTarget.getPath(IAndroidTarget.ANDROID_JAR);
antProject.setProperty(PROPERTY_ANDROID_JAR, androidJar); antProject.setProperty(PROPERTY_ANDROID_JAR, androidJar);
antProject.setProperty(PROPERTY_ANDROID_AIDL, String androidAidl = androidTarget.getPath(IAndroidTarget.ANDROID_AIDL);
androidTarget.getPath(IAndroidTarget.ANDROID_AIDL)); antProject.setProperty(PROPERTY_ANDROID_AIDL, androidAidl);
antProject.setProperty(PROPERTY_AAPT, androidTarget.getPath(IAndroidTarget.AAPT)); antProject.setProperty(PROPERTY_AAPT, androidTarget.getPath(IAndroidTarget.AAPT));
antProject.setProperty(PROPERTY_AIDL, androidTarget.getPath(IAndroidTarget.AIDL)); antProject.setProperty(PROPERTY_AIDL, androidTarget.getPath(IAndroidTarget.AIDL));
antProject.setProperty(PROPERTY_DX, androidTarget.getPath(IAndroidTarget.DX)); antProject.setProperty(PROPERTY_DX, androidTarget.getPath(IAndroidTarget.DX));
@@ -188,6 +196,16 @@ public final class SetupTask extends ImportTask {
// find the file to import, and import it. // find the file to import, and import it.
String templateFolder = androidTarget.getPath(IAndroidTarget.TEMPLATES); String templateFolder = androidTarget.getPath(IAndroidTarget.TEMPLATES);
// legacy support
if (androidTarget.getVersion().getApiLevel() <= 4) { // 1.6 and earlier
antProject.setProperty(PROPERTY_ANDROID_JAR_LEGACY, androidJar);
antProject.setProperty(PROPERTY_ANDROID_AIDL_LEGACY, androidAidl);
String appPackage = antProject.getProperty(ProjectProperties.PROPERTY_APP_PACKAGE);
if (appPackage != null && appPackage.length() > 0) {
antProject.setProperty(ProjectProperties.PROPERTY_APP_PACKAGE_LEGACY, appPackage);
}
}
// Now the import section. This is only executed if the task actually has to import a file. // Now the import section. This is only executed if the task actually has to import a file.
if (mDoImport) { if (mDoImport) {
// make sure the file exists. // make sure the file exists.

View File

@@ -37,7 +37,11 @@ public final class ProjectProperties {
public final static String PROPERTY_TARGET = "target"; public final static String PROPERTY_TARGET = "target";
public final static String PROPERTY_APK_CONFIGS = "apk.configurations"; public final static String PROPERTY_APK_CONFIGS = "apk.configurations";
public final static String PROPERTY_SDK = "sdk.dir"; public final static String PROPERTY_SDK = "sdk.dir";
// LEGACY - compatibility with 1.6 and before
public final static String PROPERTY_SDK_LEGACY = "sdk-location";
public final static String PROPERTY_APP_PACKAGE = "application.package"; public final static String PROPERTY_APP_PACKAGE = "application.package";
// LEGACY - compatibility with 1.6 and before
public final static String PROPERTY_APP_PACKAGE_LEGACY = "application-package";
public static enum PropertyType { public static enum PropertyType {
BUILD("build.properties", BUILD_HEADER), BUILD("build.properties", BUILD_HEADER),
@@ -88,8 +92,8 @@ public final class ProjectProperties {
"# This file is only used by the Ant script.\n" + "# This file is only used by the Ant script.\n" +
"\n" + "\n" +
"# You can use this to override default values such as\n" + "# You can use this to override default values such as\n" +
"# 'source-folder' for the location of your java source folder and\n" + "# 'source.dir' for the location of your java source folder and\n" +
"# 'out-folder' for the location of your output folder.\n" + "# 'out.dir' for the location of your output folder.\n" +
"\n" + "\n" +
"# You can also use it define how the release builds are signed by declaring\n" + "# You can also use it define how the release builds are signed by declaring\n" +
"# the following properties:\n" + "# the following properties:\n" +