Skip to content

Commit

Permalink
Remove code after --incompatible_provide_cc_toolchain_info_from_cc_to…
Browse files Browse the repository at this point in the history
…olchain_suite flip

#6537

RELNOTES: None.
PiperOrigin-RevId: 222433997
  • Loading branch information
hlopko authored and Copybara-Service committed Nov 21, 2018
1 parent 999cfc9 commit 123f3ab
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
public class BazelRulesModule extends BlazeModule {
/** This is where deprecated options go to die. */
public static class GraveyardOptions extends OptionsBase {
@Option(
name = "incompatible_provide_cc_toolchain_info_from_cc_toolchain_suite",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {
OptionMetadataTag.DEPRECATED,
OptionMetadataTag.INCOMPATIBLE_CHANGE,
OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
},
help = "Deprecated no-op.")
public boolean provideCcToolchainInfoFromCcToolchainSuite;

@Option(
name = "incompatible_disable_cc_toolchain_label_from_crosstool_proto",
defaultValue = "true",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ public ConfiguredTarget create(RuleContext ruleContext)
ruleConfiguredTargetBuilder.add(LicensesProvider.class, attributes.getLicensesProvider());
}

CppConfiguration cppConfiguration = ruleContext.getFragment(CppConfiguration.class);
PlatformConfiguration platformConfig =
Preconditions.checkNotNull(ruleContext.getFragment(PlatformConfiguration.class));
if (cppConfiguration.provideCcToolchainInfoFromCcToolchainSuite()
&& !platformConfig.isToolchainTypeEnabled(
CppHelper.getToolchainTypeFromRuleClass(ruleContext))) {
if (!platformConfig.isToolchainTypeEnabled(
CppHelper.getToolchainTypeFromRuleClass(ruleContext))) {
// This is not a platforms-backed build, let's provide CcToolchainAttributesProvider
// and have cc_toolchain_suite select one of its toolchains and create CcToolchainProvider
// from its attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.LicensesProvider;
Expand All @@ -30,7 +29,6 @@
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.platform.ToolchainInfo;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.packages.BuildType;
import java.util.Map;

Expand All @@ -47,20 +45,6 @@ public class CcToolchainSuite implements RuleConfiguredTargetFactory {
public ConfiguredTarget create(RuleContext ruleContext)
throws InterruptedException, RuleErrorException, ActionConflictException {
CppConfiguration cppConfiguration = ruleContext.getFragment(CppConfiguration.class);
if (!cppConfiguration.provideCcToolchainInfoFromCcToolchainSuite()) {
NestedSetBuilder<Artifact> filesToBuild = NestedSetBuilder.stableOrder();
for (TransitiveInfoCollection dep : ruleContext.getPrerequisiteMap("toolchains").values()) {
CcToolchainProvider provider = (CcToolchainProvider) dep.get(ToolchainInfo.PROVIDER);
if (provider != null) {
filesToBuild.addTransitive(provider.getCrosstool());
}
}

return new RuleConfiguredTargetBuilder(ruleContext)
.setFilesToBuild(filesToBuild.build())
.add(RunfilesProvider.class, RunfilesProvider.EMPTY)
.build();
}

String transformedCpu = cppConfiguration.getTransformedCpuFromOptions();
String compiler = cppConfiguration.getCompilerFromOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,8 @@ public String toString() {
private final PathFragment fdoPath;
private final Label fdoOptimizeLabel;

// TODO(b/113849758): Remove once it's not needed for toolchain selection in CppConfiguration.
private final Label ccToolchainLabel;
private final Label sysrootLabel;

private final ImmutableList<String> conlyopts;

private final ImmutableList<String> copts;
Expand Down Expand Up @@ -238,7 +237,6 @@ static CppConfiguration create(CppConfigurationParameters params)
Preconditions.checkNotNull(params.commonOptions.cpu),
params.fdoPath,
params.fdoOptimizeLabel,
params.ccToolchainLabel,
params.sysrootLabel,
ImmutableList.copyOf(cppOptions.conlyoptList),
ImmutableList.copyOf(cppOptions.coptList),
Expand All @@ -262,7 +260,6 @@ private CppConfiguration(
String desiredCpu,
PathFragment fdoPath,
Label fdoOptimizeLabel,
Label ccToolchainLabel,
Label sysrootLabel,
ImmutableList<String> conlyopts,
ImmutableList<String> copts,
Expand All @@ -281,7 +278,6 @@ private CppConfiguration(
this.desiredCpu = desiredCpu;
this.fdoPath = fdoPath;
this.fdoOptimizeLabel = fdoOptimizeLabel;
this.ccToolchainLabel = ccToolchainLabel;
this.sysrootLabel = sysrootLabel;
this.conlyopts = conlyopts;
this.copts = copts;
Expand Down Expand Up @@ -360,11 +356,7 @@ public PathFragment getToolPathFragment(CppConfiguration.Tool tool) {
defaultLabel = "//tools/cpp:crosstool",
defaultInToolRepository = true)
public Label getRuleProvidingCcToolchainProvider() {
if (provideCcToolchainInfoFromCcToolchainSuite()) {
return crosstoolTop;
} else {
return ccToolchainLabel;
}
}

/**
Expand Down Expand Up @@ -725,10 +717,6 @@ public Label getLibcTopLabel() {
return cppOptions.libcTopLabel;
}

public boolean provideCcToolchainInfoFromCcToolchainSuite() {
return cppOptions.provideCcToolchainInfoFromCcToolchainSuite;
}

public boolean disableSysrootFromConfiguration() {
return cppOptions.disableSysrootFromConfiguration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,21 +780,6 @@ public Label getFdoPrefetchHintsLabel() {
+ "`create_link_variables`. Use list instead.")
public boolean disableDepsetInUserFlags;

@Option(
name = "incompatible_provide_cc_toolchain_info_from_cc_toolchain_suite",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
metadataTags = {
OptionMetadataTag.INCOMPATIBLE_CHANGE,
OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
},
help =
"If true, cc_toolchain will no longer provide CcToolchainInfo when using legacy "
+ "toolchain selection. CcToolchainInfo will be provided by CcToolchainSuite "
+ "instead.")
public boolean provideCcToolchainInfoFromCcToolchainSuite;

// TODO(--incompatible_disable_systool_from_configration): Deprecate the feature and remove.
@Option(
name = "incompatible_disable_sysroot_from_configuration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ public void testOptionalGcovTool() throws Exception {
" target_cpu: \"banana\"",
" target_libc: \"banana\"",
" \"\"\")");

useConfiguration("--cpu=k8", "--host_cpu=k8");
CcToolchainProvider ccToolchainProvider =
(CcToolchainProvider) getConfiguredTarget("//a:a").get(ToolchainInfo.PROVIDER);
Expand Down Expand Up @@ -269,7 +268,7 @@ public void testOptionalGcovTool() throws Exception {
" target_cpu: \"banana\"",
" target_libc: \"banana\"",
" \"\"\")");

useConfiguration("--cpu=k8", "--host_cpu=k8");
ccToolchainProvider =
(CcToolchainProvider) getConfiguredTarget("//b:a").get(ToolchainInfo.PROVIDER);
builder = ImmutableMap.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ public void testCcToolchainLabelFromCpuCompilerAttributes() throws Exception {
ConfiguredTarget c = getConfiguredTarget("//a:b");
CppConfiguration config = getConfiguration(c).getFragment(CppConfiguration.class);
assertThat(config.getRuleProvidingCcToolchainProvider().toString()).isEqualTo("//cc:suite");

useConfiguration(
"--crosstool_top=//cc:suite",
"--cpu=k8",
"--host_cpu=k8",
"--incompatible_provide_cc_toolchain_info_from_cc_toolchain_suite");
c = getConfiguredTarget("//a:b");
config = getConfiguration(c).getFragment(CppConfiguration.class);
assertThat(config.getRuleProvidingCcToolchainProvider().toString()).isEqualTo("//cc:suite");
}

@Test
Expand Down Expand Up @@ -175,14 +166,5 @@ public void testCcToolchainFromToolchainIdentifierOverridesCpuCompiler() throws
ConfiguredTarget c = getConfiguredTarget("//a:b");
CppConfiguration config = getConfiguration(c).getFragment(CppConfiguration.class);
assertThat(config.getToolchainIdentifier()).isEqualTo("toolchain-identifier-fruitie");

useConfiguration(
"--crosstool_top=//cc:suite",
"--cpu=k8",
"--host_cpu=k8",
"--incompatible_provide_cc_toolchain_info_from_cc_toolchain_suite");
c = getConfiguredTarget("//a:b");
config = getConfiguration(c).getFragment(CppConfiguration.class);
assertThat(config.getToolchainIdentifier()).isEqualTo("toolchain-identifier-fruitie");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public void testModuleMapAttribute() throws Exception {
" dynamic_runtime_libs = ['dynamic-runtime-libs-cherry'],",
" static_runtime_libs = ['static-runtime-libs-cherry'])");
}

@Test
public void testModuleMapAttributeOptional() throws Exception {
scratchConfiguredTarget(
Expand Down

0 comments on commit 123f3ab

Please sign in to comment.