diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java index 8a14507c95..920f4cd68f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceApk.java @@ -14,7 +14,7 @@ package com.google.devtools.build.lib.rules.android; import com.google.devtools.build.lib.actions.Artifact; -import com.google.devtools.build.lib.cmdline.Label; +import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.rules.android.AndroidResourcesProvider.ResourceContainer; @@ -31,7 +31,7 @@ public class ResourceApk { // to do this. @Nullable private final Artifact resourceApk; // The .ap_ file @Nullable private final Artifact resourceJavaSrcJar; // Source jar containing R.java and friends - private final ResourceDependencies resourceDeps; + private final NestedSet<ResourceContainer> transitiveResources; @Nullable private final ResourceContainer primaryResource; @Nullable private final Artifact manifest; // The non-binary XML version of AndroidManifest.xml @Nullable private final Artifact resourceProguardConfig; @@ -40,14 +40,14 @@ public class ResourceApk { public ResourceApk( @Nullable Artifact resourceApk, @Nullable Artifact resourceJavaSrcJar, - ResourceDependencies resourceDeps, + NestedSet<ResourceContainer> transitiveResources, @Nullable ResourceContainer primaryResource, @Nullable Artifact manifest, @Nullable Artifact resourceProguardConfig, boolean legacy) { this.resourceApk = resourceApk; this.resourceJavaSrcJar = resourceJavaSrcJar; - this.resourceDeps = resourceDeps; + this.transitiveResources = transitiveResources; this.primaryResource = primaryResource; this.manifest = manifest; this.resourceProguardConfig = resourceProguardConfig; @@ -74,36 +74,16 @@ public class ResourceApk { return legacy; } + public NestedSet<ResourceContainer> getTransitiveResources() { + return transitiveResources; + } + public static ResourceApk fromTransitiveResources( - ResourceDependencies resourceDeps) { - return new ResourceApk(null, null, resourceDeps, null, null, null, false); + NestedSet<ResourceContainer> transitiveResources) { + return new ResourceApk(null, null, transitiveResources, null, null, null, false); } public Artifact getResourceProguardConfig() { return resourceProguardConfig; } - - public ResourceDependencies getResourceDependencies() { - return resourceDeps; - } - - /** - * Creates an provider from the resources in the ResourceApk. - * - * <p>If the ResourceApk was created from transitive resources, the provider will effectively - * contain the "forwarded" resources: The merged transitive and merged direct dependencies of this - * library. - * - * <p>If the ResourceApk was generated from a "resources" attribute, it will contain the - * "resources" container in the direct dependencies and the rest as transitive. - * - * <p>If the ResourceApk was generated from local resources, that will be the direct dependencies and - * the rest will be transitive. - */ - public AndroidResourcesProvider toResourceProvider(Label label) { - if (primaryResource == null) { - return resourceDeps.toProvider(label); - } - return resourceDeps.toProvider(label, primaryResource); - } } |