am 06146645: Make ApkBuilder create filenames supported by older rules.

Merge commit '0614664583142fc9b83288734893a508823b3efd'

* commit '0614664583142fc9b83288734893a508823b3efd':
  Make ApkBuilder create filenames supported by older rules.
This commit is contained in:
Xavier Ducrohet
2009-08-26 15:57:49 -07:00
committed by Android Git Automerger
3 changed files with 31 additions and 20 deletions

View File

@@ -205,8 +205,26 @@ public class ApkBuilderTask extends Task {
// for reuse by other targets (signing/zipaligning) // for reuse by other targets (signing/zipaligning)
Path path = new Path(antProject); Path path = new Path(antProject);
// The createApk method uses mBaseName for the base name of the packages (resources
// and apk files).
// The generated apk file name is
// debug: {base}[-{config}]-debug-unaligned.apk
// release: {base}[-{config}]-unsigned.apk
// Unfortunately for 1.5 projects and before the 'install' ant target expects the name
// of the default debug package to be {base}-debug.apk
// In order to support those package, we look for the 'out-debug-unaligned-package'
// property. If this exist, then we generate {base}[-{config}]-debug-unaligned.apk
// otherwise we generate {base}[-{config}]-debug.apk
// FIXME: Make apkbuilder export the package name used instead of
// having to keep apkbuilder and the rules file in sync
String debugPackageSuffix = "-debug-unaligned.apk";
if (antProject.getProperty("out-debug-unaligned-package") == null) {
debugPackageSuffix = "-debug.apk";
}
// first do a full resource package // first do a full resource package
createApk(apkBuilder, null /*configName*/, null /*resourceFilter*/, path); createApk(apkBuilder, null /*configName*/, null /*resourceFilter*/, path,
debugPackageSuffix);
// now see if we need to create file with filtered resources. // now see if we need to create file with filtered resources.
// Get the project base directory. // Get the project base directory.
@@ -219,7 +237,8 @@ public class ApkBuilderTask extends Task {
Map<String, String> apkFilters = apkSettings.getResourceFilters(); Map<String, String> apkFilters = apkSettings.getResourceFilters();
if (apkFilters.size() > 0) { if (apkFilters.size() > 0) {
for (Entry<String, String> entry : apkFilters.entrySet()) { for (Entry<String, String> entry : apkFilters.entrySet()) {
createApk(apkBuilder, entry.getKey(), entry.getValue(), path); createApk(apkBuilder, entry.getKey(), entry.getValue(), path,
debugPackageSuffix);
} }
} }
} }
@@ -244,11 +263,12 @@ public class ApkBuilderTask extends Task {
* @param resourceFilter the resource configuration filter to pass to aapt (if configName is * @param resourceFilter the resource configuration filter to pass to aapt (if configName is
* non null) * non null)
* @param path Ant {@link Path} to which add the generated APKs as {@link PathElement} * @param path Ant {@link Path} to which add the generated APKs as {@link PathElement}
* @param debugPackageSuffix suffix for the debug packages.
* @throws FileNotFoundException * @throws FileNotFoundException
* @throws ApkCreationException * @throws ApkCreationException
*/ */
private void createApk(ApkBuilderImpl apkBuilder, String configName, String resourceFilter, private void createApk(ApkBuilderImpl apkBuilder, String configName, String resourceFilter,
Path path) Path path, String debugPackageSuffix)
throws FileNotFoundException, ApkCreationException { throws FileNotFoundException, ApkCreationException {
// All the files to be included in the archive have already been prep'ed up, except // All the files to be included in the archive have already been prep'ed up, except
// the resource package. // the resource package.
@@ -274,7 +294,7 @@ public class ApkBuilderTask extends Task {
} }
if (mSigned) { if (mSigned) {
filename = filename + "-debug-unaligned.apk"; filename = filename + debugPackageSuffix;
} else { } else {
filename = filename + "-unsigned.apk"; filename = filename + "-unsigned.apk";
} }

View File

@@ -1,7 +1,8 @@
0.9.2: 0.9.3:
- New wizard to create Android JUnit Test Projects. - New wizard to create Android JUnit Test Projects.
- New AVD wizard. - New AVD wizard.
- SDK Updater - SDK Updater
- zipalign support
0.9.1: 0.9.1:
- Added an AVD creation wizard to ADT. It is automatically displayed during a launch if no compatible AVDs are found. - Added an AVD creation wizard to ADT. It is automatically displayed during a launch if no compatible AVDs are found.

View File

@@ -235,15 +235,7 @@
<!-- Installs the package on the default emulator/device --> <!-- Installs the package on the default emulator/device -->
<target name="install" depends="debug" <target name="install" depends="debug"
description="Installs the debug package onto a running emulator or device. This can only be used if the application has not yet been installed."> description="Installs/reinstalls the debug package onto a running emulator or device. This can only be used if the application has not yet been installed.">
<echo>Installing ${out.debug.package} onto default emulator or device...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg path="${out.debug.package}" />
</exec>
</target>
<target name="reinstall" depends="debug" description="Installs the debug package on a running emulator or device that already has the application.">
<echo>Installing ${out.debug.package} onto default emulator or device...</echo> <echo>Installing ${out.debug.package} onto default emulator or device...</echo>
<exec executable="${adb}" failonerror="true"> <exec executable="${adb}" failonerror="true">
<arg value="install" /> <arg value="install" />
@@ -286,12 +278,10 @@
<echo> debug: Builds the application and signs it with a debug key.</echo> <echo> debug: Builds the application and signs it with a debug key.</echo>
<echo> release: Builds the application. The generated apk file must be</echo> <echo> release: Builds the application. The generated apk file must be</echo>
<echo> signed before it is published.</echo> <echo> signed before it is published.</echo>
<echo> install: Installs the debug package onto a running emulator or</echo> <echo> install: Installs/reinstall the debug package onto a running</echo>
<echo> device. This can only be used if the application has</echo> <echo> emulator or device.</echo>
<echo> not yet been installed.</echo> <echo> If the application was previously installed, the</echo>
<echo> reinstall: Installs the debug package on a running emulator or</echo> <echo> signatures must match.</echo>
<echo> device that already has the application.</echo>
<echo> The signatures must match.</echo>
<echo> uninstall: Uninstalls the application from a running emulator or</echo> <echo> uninstall: Uninstalls the application from a running emulator or</echo>
<echo> device.</echo> <echo> device.</echo>
</target> </target>