aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-07-05 14:06:39 -0400
committerGravatar John Cater <jcater@google.com>2017-07-06 07:13:14 -0400
commit26e5a47ef355fd7eb10d7dcb803e662784ea0e21 (patch)
tree7f0f10d96c686d3012518644e5c6474f17d79fa8 /src/main/java/com/google/devtools/build/lib/rules
parent5ba5144e58365e4ec4c316f1438047346d933df3 (diff)
Assume crosstools that don't have 'no_legacy_features' feature need patching
Right now there are 2 ways how to control crosstool patches. If there is 'no_legacy_features' feature defined, no patching will be performed. If there is not, then depending on whether any c++ action_config is defined one set of patches is applied, or other set of patches is applied. It's a mess, and in the most cases, crosstools that do not define 'no_legacy_features' need the full patching. This cl fixes the crosstools that need the partial patching. RELNOTES: Crosstool patches are only applied if the toolchain doesn't define 'no_legacy_features' feature. PiperOrigin-RevId: 160979463
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java55
1 files changed, 23 insertions, 32 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
index 3e0c7446c1..bc5d6ce171 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
@@ -594,13 +594,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
return result.build();
}
- private static boolean actionsAreConfigured(CToolchain toolchain) {
- return toolchain
- .getActionConfigList()
- .stream()
- .anyMatch(actionConfig -> actionConfig.getActionName().contains("c++"));
- }
-
// TODO(bazel-team): Remove this once bazel supports all crosstool flags through
// feature configuration, and all crosstools have been converted.
private CToolchain addLegacyFeatures(CToolchain toolchain) {
@@ -632,33 +625,31 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
Set<String> features = featuresBuilder.build();
if (!features.contains(CppRuleClasses.NO_LEGACY_FEATURES)) {
try {
- if (!actionsAreConfigured(toolchain)) {
- String gccToolPath = "DUMMY_GCC_TOOL";
- String linkerToolPath = "DUMMY_LINKER_TOOL";
- String arToolPath = "DUMMY_AR_TOOL";
- for (ToolPath tool : toolchain.getToolPathList()) {
- if (tool.getName().equals(Tool.GCC.getNamePart())) {
- gccToolPath = tool.getPath();
- linkerToolPath =
- crosstoolTopPathFragment
- .getRelative(PathFragment.create(tool.getPath()))
- .getPathString();
- }
- if (tool.getName().equals(Tool.AR.getNamePart())) {
- arToolPath = tool.getPath();
- }
+ String gccToolPath = "DUMMY_GCC_TOOL";
+ String linkerToolPath = "DUMMY_LINKER_TOOL";
+ String arToolPath = "DUMMY_AR_TOOL";
+ for (ToolPath tool : toolchain.getToolPathList()) {
+ if (tool.getName().equals(Tool.GCC.getNamePart())) {
+ gccToolPath = tool.getPath();
+ linkerToolPath =
+ crosstoolTopPathFragment
+ .getRelative(PathFragment.create(tool.getPath()))
+ .getPathString();
+ }
+ if (tool.getName().equals(Tool.AR.getNamePart())) {
+ arToolPath = tool.getPath();
}
- TextFormat.merge(
- CppActionConfigs.getCppActionConfigs(
- getTargetLibc().equals("macosx") ? CppPlatform.MAC : CppPlatform.LINUX,
- features,
- gccToolPath,
- linkerToolPath,
- arToolPath,
- supportsEmbeddedRuntimes,
- toolchain.getSupportsInterfaceSharedObjects()),
- toolchainBuilder);
}
+ TextFormat.merge(
+ CppActionConfigs.getCppActionConfigs(
+ getTargetLibc().equals("macosx") ? CppPlatform.MAC : CppPlatform.LINUX,
+ features,
+ gccToolPath,
+ linkerToolPath,
+ arToolPath,
+ supportsEmbeddedRuntimes,
+ toolchain.getSupportsInterfaceSharedObjects()),
+ toolchainBuilder);
if (!features.contains("dependency_file")) {
// Gcc options: