Adds the path to the debug keystore to the apk_manifest.
--
MOS_MIGRATED_REVID=124510100
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
index 0bb7ebb..e31c1bb 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
@@ -628,6 +628,7 @@
.add(splitDeployInfo)
.build();
+ Artifact debugKeystore = androidSemantics.getApkDebugSigningKey(ruleContext);
Artifact apkManifest =
ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.APK_MANIFEST);
createApkManifestAction(
@@ -637,7 +638,8 @@
androidCommon,
resourceClasses,
resourceApk,
- nativeLibs);
+ nativeLibs,
+ debugKeystore);
Artifact apkManifestText =
ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.APK_MANIFEST_TEXT);
@@ -648,7 +650,8 @@
androidCommon,
resourceClasses,
resourceApk,
- nativeLibs);
+ nativeLibs,
+ debugKeystore);
androidCommon.addTransitiveInfoProviders(
builder, androidSemantics, resourceApk, zipAlignedApk, apksUnderTest);
@@ -818,7 +821,8 @@
AndroidCommon androidCommon,
JavaTargetAttributes resourceClasses,
ResourceApk resourceApk,
- NativeLibs nativeLibs) {
+ NativeLibs nativeLibs,
+ Artifact debugKeystore) {
Iterable<Artifact> jars = IterablesChain.concat(
resourceClasses.getArchiveInputs(true), androidCommon.getRuntimeJars());
@@ -832,7 +836,8 @@
sdk,
jars,
resourceApk,
- nativeLibs);
+ nativeLibs,
+ debugKeystore);
ruleContext.registerAction(manifestAction);
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ApkManifestAction.java b/src/main/java/com/google/devtools/build/lib/rules/android/ApkManifestAction.java
index a378988..3a8294e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/ApkManifestAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/ApkManifestAction.java
@@ -42,7 +42,8 @@
AndroidSdkProvider sdk,
Iterable<Artifact> jars,
ResourceApk resourceApk,
- NativeLibs nativeLibs) {
+ NativeLibs nativeLibs,
+ Artifact debugKeystore) {
return ImmutableList.<Artifact>builder()
.add(sdk.getAapt().getExecutable())
@@ -66,6 +67,7 @@
.add(resourceApk.getArtifact())
.add(resourceApk.getManifest())
.addAll(nativeLibs.getAllNativeLibs())
+ .add(debugKeystore)
.build();
}
@@ -76,6 +78,7 @@
private final Iterable<Artifact> jars;
private final ResourceApk resourceApk;
private final NativeLibs nativeLibs;
+ private final Artifact debugKeystore;
/**
* @param owner The action owner.
@@ -85,6 +88,7 @@
* @param jars All the jars that would be merged and dexed and put into an APK.
* @param resourceApk The ResourceApk for the .ap_ that contains the resources that would go into
* an APK.
+ * @param debugKeystore The debug keystore.
* @param nativeLibs The natives libs that would go into an APK.
*/
public ApkManifestAction(
@@ -94,14 +98,16 @@
AndroidSdkProvider sdk,
Iterable<Artifact> jars,
ResourceApk resourceApk,
- NativeLibs nativeLibs) {
- super(owner, makeInputs(sdk, jars, resourceApk, nativeLibs), outputFile, false);
+ NativeLibs nativeLibs,
+ Artifact debugKeystore) {
+ super(owner, makeInputs(sdk, jars, resourceApk, nativeLibs, debugKeystore), outputFile, false);
CollectionUtils.checkImmutable(jars);
this.textOutput = textOutput;
this.sdk = sdk;
this.jars = jars;
this.resourceApk = resourceApk;
this.nativeLibs = nativeLibs;
+ this.debugKeystore = debugKeystore;
}
@Override
@@ -191,6 +197,7 @@
}
manifestBuilder.setAndroidSdk(createAndroidSdk(sdk));
+ manifestBuilder.setDebugKeystore(makeArtifactProto(debugKeystore));
return manifestBuilder.build();
}
diff --git a/src/main/protobuf/apk_manifest.proto b/src/main/protobuf/apk_manifest.proto
index 3c47516..4b67a8c 100644
--- a/src/main/protobuf/apk_manifest.proto
+++ b/src/main/protobuf/apk_manifest.proto
@@ -92,4 +92,7 @@
// Information about resources referenced from AndroidManifest.xml.
repeated AndroidManifestResource android_manifest_resources = 6;
+
+ // Location of the debug keystore file.
+ Artifact debug_keystore = 7;
}