diff options
author | Irina Iancu <elenairina@google.com> | 2016-11-16 11:15:53 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2016-11-16 16:01:34 +0000 |
commit | 112e5fa22d1941e6931fb0f8028b91241fc081bf (patch) | |
tree | 9982cd0b7159585c3a356a3949e22835e45f392a /src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java | |
parent | 251bf035962bb84745436326982250678d25a7d1 (diff) |
Changing constructor of JavaCompilationHelper and removing
BaseJavaCompilationHelper.
Changed JavaCompilationHelper constructor to take in the object it used to construct itself: java toolchain, a host javabase and a jacoco instrumental. Because the objects are now directly passed to the constructor there is no more need anymore for the implicit attribute suffix, that was used to construct these objects.
I also removed BaseJavaCompilationHelper as it was only used to create an ijar action and only had one class extend it (JavaCompilationHelper). All methods that construct objects (java toolchain, host javabase, jacoco instrumental) were moved to JavaCompilationHelper as static methods and the rest of its method were moved as they were also to JavaCompilationHelper.
This is needed in order to pass the right toolchain/host javabase/jacoco instrumental from a Skylark module. The problem arises when a Skylark aspect/rule is created and its attributes will have different labels then a Java native rule/aspect because they must be prefixed with "_" instead of ":", so their value cannot be retrieved in the same default way.
--
MOS_MIGRATED_REVID=139310690
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java index 4e0c5c853c..536a555697 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaLiteProtoAspect.java @@ -48,6 +48,7 @@ import com.google.devtools.build.lib.packages.NativeAspectClass; import com.google.devtools.build.lib.packages.Rule; import com.google.devtools.build.lib.rules.java.JavaCompilationArgs; import com.google.devtools.build.lib.rules.java.JavaCompilationArgsProvider; +import com.google.devtools.build.lib.rules.java.JavaCompilationHelper; import com.google.devtools.build.lib.rules.java.JavaConfiguration; import com.google.devtools.build.lib.rules.java.JavaLibraryHelper; import com.google.devtools.build.lib.rules.java.JavaSemantics; @@ -220,7 +221,11 @@ public class JavaLiteProtoAspect extends NativeAspectClass implements Configured helper.addDep(runtime.getProvider(JavaCompilationArgsProvider.class)); } helper.setCompilationStrictDepsMode(StrictDepsMode.OFF); - JavaCompilationArgs artifacts = helper.build(javaSemantics); + JavaCompilationArgs artifacts = helper.build( + javaSemantics, + JavaCompilationHelper.getJavaToolchainProvider(ruleContext), + JavaCompilationHelper.getHostJavabaseInputsNonStatic(ruleContext), + JavaCompilationHelper.getInstrumentationJars(ruleContext)); return helper.buildCompilationArgsProvider(artifacts, true /* isReportedAsStrict */); } |