diff options
author | 2015-07-29 06:54:07 +0000 | |
---|---|---|
committer | 2015-07-29 16:01:59 +0000 | |
commit | 4a89a9b229b5eb80b86b90b61a268b4004c0bd70 (patch) | |
tree | 31986db7e31d28fd4abc1a54f91ed32a0a87dfd9 /src/main/java/com/google/devtools/build/lib/rules/android/ApplicationManifest.java | |
parent | ad81050b9419d1b298a3b4e444b7e4d539174bef (diff) |
Check that most output artifacts are under a directory determined by the repository and package of the rule being analyzed. Currently this directory is PACKAGE for rules in the main repository and external/REPOSITORY_NAME/PACKAGE for rules in other repositories.
This is a plan to fix #293. Ideally, we would simply make it impossible to create artifacts not under that location, but in practice, we cannot do that because some rules do want to do this, mostly those that are already problematic due to shared actions. So the battle plan is to eliminate as many calls to AnalysisEnvironment.getDerivedArtifact() as I possibly can and audit the rest.
--
MOS_MIGRATED_REVID=99351151
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.java | 11 |
1 files changed, 5 insertions, 6 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 a379cc0227..e1f84e7feb 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 @@ -35,6 +35,7 @@ import com.google.devtools.build.lib.rules.android.AndroidResourcesProvider.Reso import com.google.devtools.build.lib.rules.android.LocalResourceContainer.Builder.InvalidAssetPath; import com.google.devtools.build.lib.rules.android.LocalResourceContainer.Builder.InvalidResourcePath; import com.google.devtools.build.lib.rules.java.JavaUtil; +import com.google.devtools.build.lib.vfs.PathFragment; import java.util.List; @@ -145,9 +146,8 @@ public final class ApplicationManifest { * @return the generated ApplicationManifest */ public static ApplicationManifest generatedManifest(RuleContext ruleContext) { - Artifact generatedManifest = ruleContext.getAnalysisEnvironment().getDerivedArtifact( - ruleContext.getUniqueDirectory(ruleContext.getRule().getName() + "_generated") - .getChild("AndroidManifest.xml"), + Artifact generatedManifest = ruleContext.getUniqueDirectoryArtifact( + ruleContext.getRule().getName() + "_generated", new PathFragment("AndroidManifest.xml"), ruleContext.getBinOrGenfilesDirectory()); String manifestPackage; @@ -179,9 +179,8 @@ public final class ApplicationManifest { Iterable<ResourceContainer> resourceContainers) { if (!Iterables.isEmpty(getMergeeManifests(resourceContainers))) { Iterable<Artifact> exportedManifests = getMergeeManifests(resourceContainers); - Artifact outputManifest = ruleContext.getAnalysisEnvironment().getDerivedArtifact( - ruleContext.getUniqueDirectory( - ruleContext.getRule().getName() + "_merged").getChild("AndroidManifest.xml"), + Artifact outputManifest = ruleContext.getUniqueDirectoryArtifact( + ruleContext.getRule().getName() + "_merged", "AndroidManifest.xml", ruleContext.getBinOrGenfilesDirectory()); AndroidManifestMergeHelper.createMergeManifestAction(ruleContext, getManifest(), exportedManifests, ImmutableList.of("all"), outputManifest); |