aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java
diff options
context:
space:
mode:
authorGravatar asteinb <asteinb@google.com>2018-04-18 07:46:20 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-18 07:47:34 -0700
commit9e76d242beb562e8337caf5529f0e6a151399b28 (patch)
tree05e47c8e94e4749a69c21596af41cb76e8e79243 /src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java
parent83da8ccd5716f5be19f9be8e36949c58a3f741eb (diff)
Ability to stop using ResourceContainer in various actions
Now that we support decoupled asset and resource processing in the basic pipeline, we can also support it in these actions. ResourceShrinker actions, by design, does not use assets, so the change is trivial. For the AarGenerator, things get a bit more complex: - Simplify needlessly complex code around AAR generation - Move around special resource processing to generate AAR inputs in the case where there are no local resources to go next to normal resource processing - Also, clean up that code - ResourceApk wrapper class has some fields which are non-null even in the case where resources are inherited - Always pass assets and resources seperately to the AarGenerator action RELNOTES: none PiperOrigin-RevId: 193355790
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java b/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java
index 3bf61dbbec..a6e8b5883b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java
@@ -135,13 +135,22 @@ public final class ApplicationManifest {
*/
public static ApplicationManifest generatedManifest(RuleContext ruleContext)
throws RuleErrorException {
+ return fromExplicitManifest(
+ ruleContext, generateManifest(ruleContext, AndroidCommon.getJavaPackage(ruleContext)));
+ }
+
+ /**
+ * Creates an action to generate an empty manifest file with a specific package name.
+ *
+ * @return an artifact for the generated manifest
+ */
+ static Artifact generateManifest(RuleContext ruleContext, String manifestPackage) {
Artifact generatedManifest =
ruleContext.getUniqueDirectoryArtifact(
ruleContext.getRule().getName() + "_generated",
PathFragment.create("AndroidManifest.xml"),
ruleContext.getBinOrGenfilesDirectory());
- String manifestPackage = AndroidCommon.getJavaPackage(ruleContext);
String contents =
Joiner.on("\n")
.join(
@@ -156,7 +165,7 @@ public final class ApplicationManifest {
.registerAction(
FileWriteAction.create(
ruleContext, generatedManifest, contents, /*makeExecutable=*/ false));
- return fromExplicitManifest(ruleContext, generatedManifest);
+ return generatedManifest;
}
private static ImmutableMap<String, String> getManifestValues(RuleContext context) {