diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java index e9b666a526..a5ff7418b1 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ProtobufSupport.java @@ -34,13 +34,13 @@ import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException; +import com.google.devtools.build.lib.rules.cpp.CcToolchainProvider; import com.google.devtools.build.lib.rules.proto.ProtoSourcesProvider; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.PathFragment; import java.util.HashMap; import java.util.HashSet; import java.util.Set; -import java.util.TreeMap; /** * Support for generating Objective C proto static libraries that registers actions which generate @@ -73,6 +73,7 @@ final class ProtobufSupport { private final Set<PathFragment> dylibHandledProtoPaths; private final Iterable<ObjcProtoProvider> objcProtoProviders; private final NestedSet<Artifact> portableProtoFilters; + private final CcToolchainProvider toolchain; // Each entry of this map represents a generation action and a compilation action. The input set // are dependencies of the output set. The output set is always a subset of, or the same set as, @@ -114,7 +115,8 @@ final class ProtobufSupport { NestedSetBuilder.<Artifact>stableOrder().build(), protoProviders, objcProtoProviders, - portableProtoFilters); + portableProtoFilters, + null); } /** @@ -131,6 +133,8 @@ final class ProtobufSupport { * symbols * @param protoProviders the list of ProtoSourcesProviders that this proto support should process * @param objcProtoProviders the list of ObjcProtoProviders that this proto support should process + * @param toolchain if not null, the toolchain to override the default toolchain for the rule + * context. */ public ProtobufSupport( RuleContext ruleContext, @@ -138,7 +142,8 @@ final class ProtobufSupport { NestedSet<Artifact> dylibHandledProtos, Iterable<ProtoSourcesProvider> protoProviders, Iterable<ObjcProtoProvider> objcProtoProviders, - NestedSet<Artifact> portableProtoFilters) { + NestedSet<Artifact> portableProtoFilters, + CcToolchainProvider toolchain) { this.ruleContext = ruleContext; this.buildConfiguration = buildConfiguration; this.attributes = new ProtoAttributes(ruleContext); @@ -148,6 +153,7 @@ final class ProtobufSupport { this.intermediateArtifacts = ObjcRuleClasses.intermediateArtifacts(ruleContext, buildConfiguration); this.inputsToOutputsMap = getInputsToOutputsMap(attributes, protoProviders, objcProtoProviders); + this.toolchain = toolchain; } /** @@ -206,16 +212,18 @@ final class ProtobufSupport { ObjcCommon common = getCommon(intermediateArtifacts, compilationArtifacts); - new LegacyCompilationSupport( - ruleContext, - buildConfiguration, - intermediateArtifacts, - new CompilationAttributes.Builder().build(), - /*useDeps=*/ false, - new TreeMap<String, NestedSet<Artifact>>(), - /*isTestRule=*/ false, - /*usePch=*/ false) - .registerCompileAndArchiveActions(common, userHeaderSearchPaths); + CompilationSupport compilationSupport = + new CompilationSupport.Builder() + .setRuleContext(ruleContext) + .setConfig(buildConfiguration) + .setIntermediateArtifacts(intermediateArtifacts) + .setCompilationAttributes(new CompilationAttributes.Builder().build()) + .setToolchainProvider(toolchain) + .doNotUseDeps() + .doNotUsePch() + .build(); + + compilationSupport.registerCompileAndArchiveActions(common, userHeaderSearchPaths); actionId++; } |