From bb60ca44caff02f8c21678b860a4526a3b5beac5 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 21 Nov 2017 05:57:15 -0800 Subject: Update AndroidConfiguration to reflect changes RELNOTES: none PiperOrigin-RevId: 176496770 --- .../build/lib/rules/android/AndroidBinary.java | 17 ++++++++--------- .../lib/rules/android/AndroidConfiguration.java | 21 +-------------------- 2 files changed, 9 insertions(+), 29 deletions(-) (limited to 'src/main/java/com/google/devtools/build') diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java index de767540c7..1bfcac40af 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java @@ -296,15 +296,14 @@ public abstract class AndroidBinary implements RuleConfiguredTargetFactory { boolean shrinkResources = shouldShrinkResources(ruleContext); - NestedSet excludedRuntimeArtifacts = null; - if (!androidConfig.includeLibraryResourceJars()) { - // Remove the library resource JARs from the binary's runtime classpath. - // Resource classes from android_library dependencies are replaced by the binary's resource - // class. We remove them only at the top level so that resources included by a library that is - // a dependency of a java_library are still included, since these resources are propagated via - // android-specific providers and won't show up when we collect the library resource JARs. - excludedRuntimeArtifacts = getLibraryResourceJars(ruleContext); - } + // Remove the library resource JARs from the binary's runtime classpath. + // Resource classes from android_library dependencies are replaced by the binary's resource + // class. We remove them only at the top level so that resources included by a library that is + // a dependency of a java_library are still included, since these resources are propagated via + // android-specific providers and won't show up when we collect the library resource JARs. + // TODO(b/69552500): Instead, handle this properly so R JARs aren't put on the classpath for + // both binaries and libraries. + NestedSet excludedRuntimeArtifacts = getLibraryResourceJars(ruleContext); JavaTargetAttributes resourceClasses = androidCommon.init( javaSemantics, diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java index df9ceccbb0..41d9f50e02 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java @@ -599,19 +599,6 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { ) public boolean compressJavaResources; - @Option( - name = "experimental_android_include_library_resource_jars", - defaultValue = "false", - documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = - "Specifies whether resource JAR files for android_library targets should be included" - + " as runtime dependencies. Defaults to the old behavior, including them. These JARs" - + " are not nessecary for normal use as all required resources are included in the" - + " top-level android_binary resource JAR." - ) - public boolean includeLibraryResourceJars; - @Option( name = "experimental_android_library_exports_manifest_default", defaultValue = "false", @@ -662,7 +649,7 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { @Option( name = "experimental_android_inherit_resources_in_tests", - defaultValue = "false", + defaultValue = "true", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, help = "If true, local_resource_files indicates that resource files should be inherited" @@ -745,7 +732,6 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { private final boolean useSingleJarApkBuilder; private final ResourceFilterFactory resourceFilterFactory; private final boolean compressJavaResources; - private final boolean includeLibraryResourceJars; private final boolean exportsManifestDefault; private final AndroidAaptVersion androidAaptVersion; private final boolean throwOnResourceConflict; @@ -783,7 +769,6 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { this.useRexToCompressDexFiles = options.useRexToCompressDexFiles; this.resourceFilterFactory = options.resourceFilterFactory; this.compressJavaResources = options.compressJavaResources; - this.includeLibraryResourceJars = options.includeLibraryResourceJars; this.exportsManifestDefault = options.exportsManifestDefault; this.androidAaptVersion = options.androidAaptVersion; this.throwOnResourceConflict = options.throwOnResourceConflict; @@ -927,10 +912,6 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { return compressJavaResources; } - public boolean includeLibraryResourceJars() { - return includeLibraryResourceJars; - } - boolean getExportsManifestDefault() { return exportsManifestDefault; } -- cgit v1.2.3