Skip to content

Commit

Permalink
Make CompilationSupport use the specified CcToolchainProvider even if…
Browse files Browse the repository at this point in the history
… the :cc_toolchain implicit attributes are not available.

RELNOTES: Banana.
PiperOrigin-RevId: 221268738
  • Loading branch information
lberki authored and Copybara-Service committed Nov 13, 2018
1 parent 87d2d62 commit b934f53
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -725,19 +725,12 @@ private CompilationSupport(
this.outputGroupCollector = outputGroupCollector;
this.objectFilesCollector = objectFilesCollector;
this.usePch = usePch;
// TODO(b/62143697): Remove this check once all rules are using the crosstool support.
if (ruleContext
.attributes()
.has(CcToolchain.CC_TOOLCHAIN_DEFAULT_ATTRIBUTE_NAME, BuildType.LABEL)
|| ruleContext.attributes().has(":j2objc_cc_toolchain", BuildType.LABEL)) {
if (toolchain == null) {
toolchain = CppHelper.getToolchainUsingDefaultCcToolchainAttribute(ruleContext);
}
this.toolchain = toolchain;
} else {
// Since the rule context doesn't have a toolchain at all, ignore any provided override.
this.toolchain = null;
if (toolchain == null && ruleContext.attributes().has(
CcToolchain.CC_TOOLCHAIN_DEFAULT_ATTRIBUTE_NAME, BuildType.LABEL)) {
toolchain = CppHelper.getToolchainUsingDefaultCcToolchainAttribute(ruleContext);
}

this.toolchain = toolchain;
}

/** Builder for {@link CompilationSupport} */
Expand Down

0 comments on commit b934f53

Please sign in to comment.