diff options
author | 2018-05-03 11:45:22 -0700 | |
---|---|---|
committer | 2018-05-03 11:46:58 -0700 | |
commit | f3a01a5871b1df6edcf5d257b97f6b2d72297aba (patch) | |
tree | 84ee9d9ef62619476d870a1c60ff71b205b543cb /src/main/java/com/google/devtools/build/lib | |
parent | 45b595360df3ac9b6c6bf079314919c8ff6edda4 (diff) |
PiperOrigin-RevId: 195286334
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java | 29 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationArgsProvider.java | 5 |
2 files changed, 33 insertions, 1 deletions
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 f1adf02199..678a5f67cd 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 @@ -818,6 +818,21 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { ) public boolean checkForMigrationTag; + // TODO(eaftan): enable this by default and delete it + @Option( + name = "experimental_one_version_enforcement_use_transitive_jars_for_binary_under_test", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, + effectTags = { + OptionEffectTag.BAZEL_INTERNAL_CONFIGURATION, + OptionEffectTag.ACTION_COMMAND_LINES + }, + help = + "If enabled, one version enforcement for android_test uses the binary_under_test's " + + "transitive classpath, otherwise it uses the deploy jar" + ) + public boolean oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest; + @Override public FragmentOptions getHost() { Options host = (Options) super.getHost(); @@ -841,6 +856,8 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { host.androidAaptVersion = androidAaptVersion; host.allowAndroidLibraryDepsWithoutSrcs = allowAndroidLibraryDepsWithoutSrcs; host.enforceStrictDepsForBinariesUnderTest = enforceStrictDepsForBinariesUnderTest; + host.oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest = + oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest; return host; } } @@ -899,6 +916,7 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { private final boolean decoupleDataProcessing; private final boolean enforceStrictDepsForBinariesUnderTest; private final boolean checkForMigrationTag; + private final boolean oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest; AndroidConfiguration(Options options) throws InvalidConfigurationException { this.sdk = options.sdk; @@ -939,6 +957,8 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { this.decoupleDataProcessing = options.decoupleDataProcessing; this.enforceStrictDepsForBinariesUnderTest = options.enforceStrictDepsForBinariesUnderTest; this.checkForMigrationTag = options.checkForMigrationTag; + this.oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest = + options.oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest; if (incrementalDexingShardsAfterProguard < 0) { throw new InvalidConfigurationException( @@ -991,7 +1011,8 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { AndroidRobolectricTestDeprecationLevel robolectricTestDeprecationLevel, boolean decoupleDataProcessing, boolean enforceStrictDepsForBinariesUnderTest, - boolean checkForMigrationTag) { + boolean checkForMigrationTag, + boolean oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest) { this.sdk = sdk; this.cpu = cpu; this.useIncrementalNativeLibs = useIncrementalNativeLibs; @@ -1027,6 +1048,8 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { this.decoupleDataProcessing = decoupleDataProcessing; this.enforceStrictDepsForBinariesUnderTest = enforceStrictDepsForBinariesUnderTest; this.checkForMigrationTag = checkForMigrationTag; + this.oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest = + oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest; } public String getCpu() { @@ -1186,6 +1209,10 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment { return checkForMigrationTag; } + public boolean getOneVersionEnforcementUseTransitiveJarsForBinaryUnderTest() { + return oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest; + } + @Override public void addGlobalMakeVariables(ImmutableMap.Builder<String, String> globalMakeEnvBuilder) { globalMakeEnvBuilder.put("ANDROID_CPU", cpu); diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationArgsProvider.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationArgsProvider.java index 390bf340c7..45943e5707 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationArgsProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationArgsProvider.java @@ -96,6 +96,11 @@ public abstract class JavaCompilationArgsProvider implements TransitiveInfoProvi return getRecursiveJavaCompilationArgs().getCompileTimeJars(); } + /** Returns recursively collected, non-interface compile-time jars. */ + public NestedSet<Artifact> getFullTransitiveCompileTimeJars() { + return getRecursiveJavaCompilationArgs().getFullCompileTimeJars(); + } + /** Returns recursively collected runtime jars. */ public NestedSet<Artifact> getRuntimeJars() { return getRecursiveJavaCompilationArgs().getRuntimeJars(); |