aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-08-09 11:22:19 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-08-09 11:36:14 +0200
commitaff9fa60d1a244bbaf8b0cd2528421c472e8b9cf (patch)
treea054c41bff8c3b336aa6de8e97c0425d88c9cdce /src/main/java
parent0df3ddbdc289af97ffd2fb98197548f21b2c69a9 (diff)
Do not add copts feature to crosstools that already define it
RELNOTES: None. PiperOrigin-RevId: 164701570
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java41
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java2
2 files changed, 24 insertions, 19 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java
index 4e8171a5e7..a6ba263e24 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java
@@ -825,25 +825,28 @@ public class CppActionConfigs {
" feature: 'coverage'",
" }",
"}"),
- "feature {",
- " name: 'copts'",
- " flag_set {",
- " expand_if_all_available: 'copts'",
- " action: 'assemble'",
- " action: 'preprocess-assemble'",
- " action: 'c-compile'",
- " action: 'c++-compile'",
- " action: 'c++-header-parsing'",
- " action: 'c++-header-preprocessing'",
- " action: 'c++-module-compile'",
- " action: 'c++-module-codegen'",
- " action: 'lto-backend'",
- " flag_group {",
- " iterate_over: 'copts'",
- " flag: '%{copts}'",
- " }",
- " }",
- "}",
+ ifTrue(
+ !features.contains(CppRuleClasses.COPTS),
+ "feature {",
+ " name: 'copts'",
+ " flag_set {",
+ " expand_if_all_available: 'copts'",
+ " action: 'assemble'",
+ " action: 'preprocess-assemble'",
+ " action: 'c-compile'",
+ " action: 'c++-compile'",
+ " action: 'c++-header-parsing'",
+ " action: 'c++-header-preprocessing'",
+ " action: 'c++-module-compile'",
+ " action: 'c++-module-codegen'",
+ " action: 'lto-backend'",
+ " action: 'clif-match'",
+ " flag_group {",
+ " iterate_over: 'copts'",
+ " flag: '%{copts}'",
+ " }",
+ " }",
+ "}"),
"action_config {",
" config_name: 'strip'",
" action_name: 'strip'",
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
index 67c15a13cb..b4678a4603 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
@@ -177,6 +177,8 @@ public class CppRuleClasses {
public static final SafeImplicitOutputsFunction CC_BINARY_DEBUG_PACKAGE =
fromTemplates("%{name}.dwp");
+ /** A string constant for the copts feature. */
+ public static final String COPTS = "copts";
/**
* A string constant for the parse_headers feature.