Search in sources :

Example 1 with ProtoSourceFileBlacklist

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

the class J2ObjcAspect method proto.

private ConfiguredAspect proto(ConfiguredTarget base, RuleContext ruleContext, AspectParameters parameters) throws InterruptedException {
    ProtoSourcesProvider protoSourcesProvider = base.getProvider(ProtoSourcesProvider.class);
    ImmutableList<Artifact> protoSources = protoSourcesProvider.getDirectProtoSources();
    // Avoid pulling in any generated files from blacklisted protos.
    ProtoSourceFileBlacklist protoBlacklist = new ProtoSourceFileBlacklist(ruleContext, ruleContext.getPrerequisiteArtifacts(PROTO_SOURCE_FILE_BLACKLIST_ATTR, Mode.HOST).list());
    ImmutableList<Artifact> filteredProtoSources = ImmutableList.copyOf(protoBlacklist.filter(protoSources));
    J2ObjcSource j2ObjcSource = protoJ2ObjcSource(ruleContext, filteredProtoSources);
    J2ObjcMappingFileProvider directJ2ObjcMappingFileProvider;
    if (Iterables.isEmpty(j2ObjcSource.getObjcSrcs())) {
        directJ2ObjcMappingFileProvider = new J2ObjcMappingFileProvider.Builder().build();
    } else {
        directJ2ObjcMappingFileProvider = createJ2ObjcProtoCompileActions(base, ruleContext, filteredProtoSources, j2ObjcSource);
    }
    return buildAspect(base, ruleContext, parameters, j2ObjcSource, directJ2ObjcMappingFileProvider, PROTO_DEPENDENT_ATTRIBUTES);
}
Also used : NestedSetBuilder(com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder) ProtoCompileActionBuilder(com.google.devtools.build.lib.rules.proto.ProtoCompileActionBuilder) ProtoSourceFileBlacklist(com.google.devtools.build.lib.rules.proto.ProtoSourceFileBlacklist) ProtoSourcesProvider(com.google.devtools.build.lib.rules.proto.ProtoSourcesProvider) Artifact(com.google.devtools.build.lib.actions.Artifact)

Aggregations

Artifact (com.google.devtools.build.lib.actions.Artifact)1 NestedSetBuilder (com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder)1 ProtoCompileActionBuilder (com.google.devtools.build.lib.rules.proto.ProtoCompileActionBuilder)1 ProtoSourceFileBlacklist (com.google.devtools.build.lib.rules.proto.ProtoSourceFileBlacklist)1 ProtoSourcesProvider (com.google.devtools.build.lib.rules.proto.ProtoSourcesProvider)1