diff options
author | 2018-04-25 09:49:17 -0700 | |
---|---|---|
committer | 2018-04-25 09:50:56 -0700 | |
commit | 1d49184b071b281c83939416d7eead671729c8b5 (patch) | |
tree | 3cdc600d2b387b723b03b7323b50c5f64903d1f8 /src/main/java/com/google/devtools/build/lib/rules/android | |
parent | e6524b59650f033ef7652c7ff8aa68877f82208d (diff) |
Make java_common.compile's javacopt handling consistent with native Java rules
Compilations performed by java_common.compile now use the javacopts in the
java_toolchain by default, instead of requiring them to be explicitly retrived
using java_common.default_javac_opts, for consistency with the native rules.
java_common.compile(javac_opts=...) can still be used to pass additional javacopts.
RELNOTES: Make java_common.compile now uses java_toolchain javacopts by default; explicitly retrieving them using java_common.default_javac_opts is unnecessary.
PiperOrigin-RevId: 194254098
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android')
3 files changed, 8 insertions, 8 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 7240e132c3..a89910839d 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 @@ -16,7 +16,6 @@ package com.google.devtools.build.lib.rules.android; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ResourceSet; import com.google.devtools.build.lib.analysis.AnalysisUtils; @@ -466,13 +465,14 @@ public class AndroidCommon { bootclasspath = ImmutableList.of(AndroidSdkProvider.fromRuleContext(ruleContext).getAndroidJar()); } - Iterable<String> javacopts = androidSemantics.getJavacArguments(ruleContext); + ImmutableList.Builder<String> javacopts = ImmutableList.builder(); + javacopts.addAll(androidSemantics.getCompatibleJavacOptions(ruleContext)); if (DataBinding.isEnabled(ruleContext)) { - javacopts = Iterables.concat(javacopts, DataBinding.getJavacopts(ruleContext, isBinary)); + javacopts.addAll(DataBinding.getJavacOpts(ruleContext, isBinary)); } JavaTargetAttributes.Builder attributes = javaCommon - .initCommon(idlHelper.getIdlGeneratedJavaSources(), javacopts) + .initCommon(idlHelper.getIdlGeneratedJavaSources(), javacopts.build()) .setBootClassPath(bootclasspath); if (DataBinding.isEnabled(ruleContext)) { DataBinding.addAnnotationProcessor(ruleContext, attributes); diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java index 87130b7351..3726808cb5 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSemantics.java @@ -69,10 +69,10 @@ public interface AndroidSemantics { * Returns the command line options to be used when compiling Java code for {@code android_*} * rules. * - * <p>These will come after the default options specified by the toolchain and the ones in the - * {@code javacopts} attribute. + * <p>These will come after the default options specified by the toolchain, and before the ones in + * the {@code javacopts} attribute. */ - ImmutableList<String> getJavacArguments(RuleContext ruleContext); + ImmutableList<String> getCompatibleJavacOptions(RuleContext ruleContext); /** * Configures the builder for generating the output jar used to configure the main dex file. diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/DataBinding.java b/src/main/java/com/google/devtools/build/lib/rules/android/DataBinding.java index 338494eb4f..9f6ac28ea6 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/DataBinding.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/DataBinding.java @@ -169,7 +169,7 @@ public final class DataBinding { } /** The javac flags that are needed to configure data binding's annotation processor. */ - static ImmutableList<String> getJavacopts(RuleContext ruleContext, boolean isBinary) { + static ImmutableList<String> getJavacOpts(RuleContext ruleContext, boolean isBinary) { ImmutableList.Builder<String> flags = ImmutableList.builder(); String metadataOutputDir = getDataBindingExecPath(ruleContext).getPathString(); |