use of com.google.devtools.build.lib.rules.java.JavaPluginInfoProvider in project bazel by bazelbuild.
the class DataBinding method addAnnotationProcessor.
/**
* Adds data binding's annotation processor as a plugin to the given Java compilation context.
*
* <p>This, in conjunction with {@link #createAnnotationFile} extends the Java compilation to
* translate data binding .xml into corresponding classes.
*/
static void addAnnotationProcessor(RuleContext ruleContext, JavaTargetAttributes.Builder attributes) {
JavaPluginInfoProvider plugin = ruleContext.getPrerequisite(DATABINDING_ANNOTATION_PROCESSOR_ATTR, RuleConfiguredTarget.Mode.TARGET, JavaPluginInfoProvider.class);
for (String name : plugin.getProcessorClasses()) {
// For header compilation (see JavaHeaderCompileAction):
attributes.addApiGeneratingProcessorName(name);
// For full compilation:
attributes.addProcessorName(name);
}
// For header compilation (see JavaHeaderCompileAction):
attributes.addApiGeneratingProcessorPath(plugin.getProcessorClasspath());
// For full compilation:
attributes.addProcessorPath(plugin.getProcessorClasspath());
attributes.addAdditionalOutputs(getMetadataOutputs(ruleContext));
}
Aggregations