aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/android_rules.xml10
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java3
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java17
3 files changed, 18 insertions, 12 deletions
diff --git a/scripts/android_rules.xml b/scripts/android_rules.xml
index 1f5daac..be53264 100644
--- a/scripts/android_rules.xml
+++ b/scripts/android_rules.xml
@@ -201,7 +201,15 @@
</target>
<!-- Uinstall the package from the default emulator -->
- <target name="uninstall">
+ <target name="uninstall.check">
+ <condition property="uninstall.run">
+ <isset property="application-package" />
+ </condition>
+ </target>
+ <target name="uninstall.error" depends="uninstall.check" unless="uninstall.run">
+ <echo>Unable to run 'ant unintall', application-package is not defined in build.properties</echo>
+ </target>
+ <target name="uninstall" depends="uninstall.error" if="uninstall.run">
<echo>Uninstalling ${application-package} from the default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="uninstall" />
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
index 1e16a83..916fa7c 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
@@ -199,9 +199,10 @@ public class ProjectCreator {
defaultProperties.setAndroidTarget(target);
defaultProperties.save();
- // create an empty build.properties
+ // create a build.properties file with just the application package
ProjectProperties buildProperties = ProjectProperties.create(folderPath,
PropertyType.BUILD);
+ buildProperties.setProperty(ProjectProperties.PROPERTY_APP_PACKAGE, packageName);
buildProperties.save();
// create the map for place-holders of values to replace in the templates
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
index 33f8837..d71491c 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
@@ -22,7 +22,6 @@ import com.android.sdklib.SdkManager;
import java.io.File;
import java.io.FileOutputStream;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.HashMap;
@@ -38,6 +37,7 @@ public final class ProjectProperties {
public final static String PROPERTY_TARGET = "target";
public final static String PROPERTY_APK_CONFIGS = "apk-configurations";
public final static String PROPERTY_SDK = "sdk-location";
+ public final static String PROPERTY_APP_PACKAGE = "application-package";
public static enum PropertyType {
BUILD("build.properties", BUILD_HEADER),
@@ -85,15 +85,9 @@ public final class ProjectProperties {
"# This file must be checked in Version Control Systems, as it is\n" +
"# integral to the build system of your project.\n" +
"\n" +
- "# The name of your application package as defined in the manifest.\n" +
- "# Used by the 'uninstall' rule.\n"+
- "#application-package=com.example.myproject\n" +
- "\n" +
- "# The name of the source folder.\n" +
- "#source-folder=src\n" +
- "\n" +
- "# The name of the output folder.\n" +
- "#out-folder=bin\n" +
+ "# You can use this to override default values such as\n" +
+ "# 'source-folder' for the location of your java source folder and\n" +
+ "# 'out-folder' for the location of your output folder.\n" +
"\n";
private final static Map<String, String> COMMENT_MAP = new HashMap<String, String>();
@@ -116,6 +110,9 @@ public final class ProjectProperties {
"# location of the SDK. This is only used by Ant\n" +
"# For customization when using a Version Control System, please read the\n" +
"# header note.\n");
+ COMMENT_MAP.put(PROPERTY_APP_PACKAGE,
+ "# The name of your application package as defined in the manifest.\n" +
+ "# Used by the 'uninstall' rule.\n");
}
private final String mProjectFolderOsPath;