Search in sources :

Example 1 with ProtoCompileActionBuilder

use of com.google.devtools.build.lib.rules.proto.ProtoCompileActionBuilder in project bazel by bazelbuild.

the class J2ObjcAspect method createJ2ObjcProtoCompileActions.

private J2ObjcMappingFileProvider createJ2ObjcProtoCompileActions(ConfiguredTarget base, RuleContext ruleContext, Iterable<Artifact> filteredProtoSources, J2ObjcSource j2ObjcSource) {
    Iterable<Artifact> outputHeaderMappingFiles = ProtoCommon.getGeneratedOutputs(ruleContext, ImmutableList.copyOf(filteredProtoSources), ".j2objc.mapping");
    Iterable<Artifact> outputClassMappingFiles = ProtoCommon.getGeneratedOutputs(ruleContext, ImmutableList.copyOf(filteredProtoSources), ".clsmap.properties");
    ImmutableList<Artifact> outputs = ImmutableList.<Artifact>builder().addAll(j2ObjcSource.getObjcSrcs()).addAll(j2ObjcSource.getObjcHdrs()).addAll(outputHeaderMappingFiles).addAll(outputClassMappingFiles).build();
    String langPluginParameter = String.format("%s:%s", Joiner.on(',').join(J2OBJC_PLUGIN_PARAMS), ruleContext.getConfiguration().getGenfilesFragment().getPathString());
    SupportData supportData = base.getProvider(ProtoSupportDataProvider.class).getSupportData();
    ProtoCompileActionBuilder actionBuilder = new ProtoCompileActionBuilder(ruleContext, supportData, "J2ObjC", "j2objc", outputs).setLangPluginName("$j2objc_plugin").setLangPluginParameter(langPluginParameter).allowServices(shouldAllowProtoServices(ruleContext));
    ruleContext.registerAction(actionBuilder.build());
    return new J2ObjcMappingFileProvider(NestedSetBuilder.<Artifact>stableOrder().addAll(outputHeaderMappingFiles).build(), NestedSetBuilder.<Artifact>stableOrder().addAll(outputClassMappingFiles).build(), NestedSetBuilder.<Artifact>stableOrder().build(), NestedSetBuilder.<Artifact>stableOrder().build());
}
Also used : SupportData(com.google.devtools.build.lib.rules.proto.SupportData) ProtoSupportDataProvider(com.google.devtools.build.lib.rules.proto.ProtoSupportDataProvider) ProtoCompileActionBuilder(com.google.devtools.build.lib.rules.proto.ProtoCompileActionBuilder) Artifact(com.google.devtools.build.lib.actions.Artifact)

Aggregations

Artifact (com.google.devtools.build.lib.actions.Artifact)1 ProtoCompileActionBuilder (com.google.devtools.build.lib.rules.proto.ProtoCompileActionBuilder)1 ProtoSupportDataProvider (com.google.devtools.build.lib.rules.proto.ProtoSupportDataProvider)1 SupportData (com.google.devtools.build.lib.rules.proto.SupportData)1