aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
index a34cb55824..e5bc26c15f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidCommon.java
@@ -300,12 +300,9 @@ public class AndroidCommon {
// Since the Java sources are generated by combining all resources with the
// ones included in the binary, the path of the artifact has to be unique
// per binary and per library (not only per library).
- PathFragment resourceJarsPathFragment = ruleContext.getUniqueDirectory("resource_jars");
- PathFragment artifactPathFragment = resourceJarsPathFragment.getRelative(
- container.getLabel().getPackageFragment().getRelative(artifactName));
-
- Artifact artifact = ruleContext.getAnalysisEnvironment()
- .getDerivedArtifact(artifactPathFragment, ruleContext.getBinOrGenfilesDirectory());
+ Artifact artifact = ruleContext.getUniqueDirectoryArtifact("resource_jars",
+ container.getLabel().getPackageIdentifier().getPathFragment().getRelative(artifactName),
+ ruleContext.getBinOrGenfilesDirectory());
return artifact;
}
@@ -647,16 +644,15 @@ public class AndroidCommon {
private ImmutableMap<Artifact, Artifact> generateTranslatedIdlArtifacts(
RuleContext ruleContext, Collection<Artifact> idls) {
ImmutableMap.Builder<Artifact, Artifact> outputJavaSources = ImmutableMap.builder();
- PathFragment rulePackage = ruleContext.getRule().getLabel().getPackageFragment();
String ruleName = ruleContext.getRule().getName();
// for each aidl file use aggregated preprocessed files to generate Java code
for (Artifact idl : idls) {
// Reconstruct the package tree under <rule>_aidl to avoid a name conflict
// if the same AIDL files are used in multiple targets.
PathFragment javaOutputPath = FileSystemUtils.replaceExtension(
- rulePackage.getRelative(ruleName + "_aidl").getRelative(idl.getRootRelativePath()),
+ new PathFragment(ruleName + "_aidl").getRelative(idl.getRootRelativePath()),
".java");
- Artifact output = ruleContext.getAnalysisEnvironment().getDerivedArtifact(
+ Artifact output = ruleContext.getPackageRelativeArtifact(
javaOutputPath, ruleContext.getConfiguration().getGenfilesDirectory());
outputJavaSources.put(idl, output);
}
@@ -688,14 +684,13 @@ public class AndroidCommon {
// preprocess each aidl file
preprocessedArgs.add("-p" + sdk.getFrameworkAidl().getExecPathString());
- PathFragment rulePackage = ruleContext.getRule().getLabel().getPackageFragment();
String ruleName = ruleContext.getRule().getName();
for (Artifact idl : idls) {
// Reconstruct the package tree under <rule>_aidl to avoid a name conflict
// if the source AIDL files are also generated.
- PathFragment preprocessedPath = rulePackage.getRelative(ruleName + "_aidl")
+ PathFragment preprocessedPath = new PathFragment(ruleName + "_aidl")
.getRelative(idl.getRootRelativePath());
- Artifact preprocessed = ruleContext.getAnalysisEnvironment().getDerivedArtifact(
+ Artifact preprocessed = ruleContext.getPackageRelativeArtifact(
preprocessedPath, ruleContext.getConfiguration().getGenfilesDirectory());
preprocessedIdls.add(preprocessed);
preprocessedArgs.add("-p" + preprocessed.getExecPathString());