diff options
author | 2018-05-03 10:43:47 -0700 | |
---|---|---|
committer | 2018-05-03 10:45:39 -0700 | |
commit | 4a2845c3051915ed5aa1cb3a977f987a1a3b95ed (patch) | |
tree | b9b40627e581db8c61edf08dbc397172f9a233c5 /src/main/java/com/google/devtools/build/lib/rules/android/ResourceDependencies.java | |
parent | 3851667a8454d891eb031c00fe6d07244b6e606d (diff) |
Expose intial parts of resource merging to Skylark
RELNOTES: none
PiperOrigin-RevId: 195274968
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/ResourceDependencies.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/ResourceDependencies.java | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceDependencies.java b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceDependencies.java index 43b8ba0345..45f559eb85 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ResourceDependencies.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ResourceDependencies.java @@ -90,10 +90,17 @@ public final class ResourceDependencies { private final boolean neverlink; public static ResourceDependencies fromRuleDeps(RuleContext ruleContext, boolean neverlink) { + return fromProviders( + AndroidCommon.getTransitivePrerequisites( + ruleContext, Mode.TARGET, AndroidResourcesInfo.PROVIDER), + neverlink); + } + + public static ResourceDependencies fromProviders( + Iterable<AndroidResourcesInfo> providers, boolean neverlink) { NestedSetBuilder<ValidatedAndroidData> transitiveDependencies = NestedSetBuilder.naiveLinkOrder(); - NestedSetBuilder<ValidatedAndroidData> directDependencies = - NestedSetBuilder.naiveLinkOrder(); + NestedSetBuilder<ValidatedAndroidData> directDependencies = NestedSetBuilder.naiveLinkOrder(); NestedSetBuilder<Artifact> transitiveResources = NestedSetBuilder.naiveLinkOrder(); NestedSetBuilder<Artifact> transitiveAssets = NestedSetBuilder.naiveLinkOrder(); NestedSetBuilder<Artifact> transitiveManifests = NestedSetBuilder.naiveLinkOrder(); @@ -103,19 +110,17 @@ public final class ResourceDependencies { NestedSetBuilder<Artifact> transitiveStaticLib = NestedSetBuilder.naiveLinkOrder(); NestedSetBuilder<Artifact> transitiveRTxt = NestedSetBuilder.naiveLinkOrder(); - for (AndroidResourcesInfo resources : - AndroidCommon.getTransitivePrerequisites( - ruleContext, Mode.TARGET, AndroidResourcesInfo.PROVIDER)) { - transitiveDependencies.addTransitive(resources.getTransitiveAndroidResources()); - directDependencies.addTransitive(resources.getDirectAndroidResources()); - transitiveResources.addTransitive(resources.getTransitiveResources()); - transitiveAssets.addTransitive(resources.getTransitiveAssets()); - transitiveManifests.addTransitive(resources.getTransitiveManifests()); - transitiveAapt2RTxt.addTransitive(resources.getTransitiveAapt2RTxt()); - transitiveSymbolsBin.addTransitive(resources.getTransitiveSymbolsBin()); - transitiveCompiledSymbols.addTransitive(resources.getTransitiveCompiledSymbols()); - transitiveStaticLib.addTransitive(resources.getTransitiveStaticLib()); - transitiveRTxt.addTransitive(resources.getTransitiveRTxt()); + for (AndroidResourcesInfo resources : providers) { + transitiveDependencies.addTransitive(resources.getTransitiveAndroidResources()); + directDependencies.addTransitive(resources.getDirectAndroidResources()); + transitiveResources.addTransitive(resources.getTransitiveResources()); + transitiveAssets.addTransitive(resources.getTransitiveAssets()); + transitiveManifests.addTransitive(resources.getTransitiveManifests()); + transitiveAapt2RTxt.addTransitive(resources.getTransitiveAapt2RTxt()); + transitiveSymbolsBin.addTransitive(resources.getTransitiveSymbolsBin()); + transitiveCompiledSymbols.addTransitive(resources.getTransitiveCompiledSymbols()); + transitiveStaticLib.addTransitive(resources.getTransitiveStaticLib()); + transitiveRTxt.addTransitive(resources.getTransitiveRTxt()); } return new ResourceDependencies( |