On project creation, put the app package in build.properties
This enabled 'ant uninstall' to work. Also, add an error message to the uninstall rules in case the property is not defined. BUG: 2050451
This commit is contained in:
@@ -201,7 +201,15 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Uinstall the package from the default emulator -->
|
<!-- 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>
|
<echo>Uninstalling ${application-package} from the default emulator...</echo>
|
||||||
<exec executable="${adb}" failonerror="true">
|
<exec executable="${adb}" failonerror="true">
|
||||||
<arg value="uninstall" />
|
<arg value="uninstall" />
|
||||||
|
|||||||
@@ -199,9 +199,10 @@ public class ProjectCreator {
|
|||||||
defaultProperties.setAndroidTarget(target);
|
defaultProperties.setAndroidTarget(target);
|
||||||
defaultProperties.save();
|
defaultProperties.save();
|
||||||
|
|
||||||
// create an empty build.properties
|
// create a build.properties file with just the application package
|
||||||
ProjectProperties buildProperties = ProjectProperties.create(folderPath,
|
ProjectProperties buildProperties = ProjectProperties.create(folderPath,
|
||||||
PropertyType.BUILD);
|
PropertyType.BUILD);
|
||||||
|
buildProperties.setProperty(ProjectProperties.PROPERTY_APP_PACKAGE, packageName);
|
||||||
buildProperties.save();
|
buildProperties.save();
|
||||||
|
|
||||||
// create the map for place-holders of values to replace in the templates
|
// create the map for place-holders of values to replace in the templates
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.android.sdklib.SdkManager;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -38,6 +37,7 @@ 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-location";
|
public final static String PROPERTY_SDK = "sdk-location";
|
||||||
|
public final static String PROPERTY_APP_PACKAGE = "application-package";
|
||||||
|
|
||||||
public static enum PropertyType {
|
public static enum PropertyType {
|
||||||
BUILD("build.properties", BUILD_HEADER),
|
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" +
|
"# This file must be checked in Version Control Systems, as it is\n" +
|
||||||
"# integral to the build system of your project.\n" +
|
"# integral to the build system of your project.\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"# The name of your application package as defined in the manifest.\n" +
|
"# You can use this to override default values such as\n" +
|
||||||
"# Used by the 'uninstall' rule.\n"+
|
"# 'source-folder' for the location of your java source folder and\n" +
|
||||||
"#application-package=com.example.myproject\n" +
|
"# 'out-folder' for the location of your output folder.\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" +
|
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
private final static Map<String, String> COMMENT_MAP = new HashMap<String, String>();
|
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" +
|
"# location of the SDK. This is only used by Ant\n" +
|
||||||
"# For customization when using a Version Control System, please read the\n" +
|
"# For customization when using a Version Control System, please read the\n" +
|
||||||
"# header note.\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;
|
private final String mProjectFolderOsPath;
|
||||||
|
|||||||
Reference in New Issue
Block a user