aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2017-06-30 13:17:19 +0200
committerGravatar Marcel Hlopko <hlopko@google.com>2017-07-03 09:02:35 +0200
commite3312d97ab356d71cc5b6965de80b2189d547b80 (patch)
treefb4104516c5d9955537548577b5faa14b393eefd /src/main/java/com/google/devtools/build/lib/rules
parent90ccaa583828aa4e9bf8b7b0507ab518121ef90c (diff)
Make osx crosstool standalone (working without bazel patches)
This cl promotes //tools/osx/crosstool to be fully specified on its own, without any blaze patches needed. While at it, I (think I) unified objc and c++ coverage features. Other than coverage, this cl only adds features that bazel would add otherwise. Ping #2420 RELNOTES: ObjC and C++ coverage feature is unified under name 'coverage' PiperOrigin-RevId: 160633192
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.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java13
3 files changed, 11 insertions, 13 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 5468a1607e..a8e6233d02 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
@@ -2141,6 +2141,11 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
}
if (ruleContext.getConfiguration().isCodeCoverageEnabled()) {
requestedFeatures.add(CppRuleClasses.COVERAGE);
+ if (useLLVMCoverageMap) {
+ requestedFeatures.add(CppRuleClasses.LLVM_COVERAGE_MAP_FORMAT);
+ } else {
+ requestedFeatures.add(CppRuleClasses.GCC_COVERAGE_MAP_FORMAT);
+ }
}
return requestedFeatures.build();
}
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 1e6e1b7fb8..4ad604ed55 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
@@ -330,6 +330,12 @@ public class CppRuleClasses {
*/
public static final String COVERAGE = "coverage";
+ /** Produce artifacts for coverage in llvm coverage mapping format. */
+ public static final String LLVM_COVERAGE_MAP_FORMAT = "llvm_coverage_map_format";
+
+ /** Produce artifacts for coverage in gcc coverage mapping format. */
+ public static final String GCC_COVERAGE_MAP_FORMAT = "gcc_coverage_map_format";
+
/** A string constant for the match-clif feature. */
public static final String MATCH_CLIF = "match_clif";
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java
index aca7f7a4a1..d26eec9dbf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CrosstoolCompilationSupport.java
@@ -82,11 +82,6 @@ public class CrosstoolCompilationSupport extends CompilationSupport {
private static final String OBJC_MODULE_FEATURE_NAME = "use_objc_modules";
private static final String NO_ENABLE_MODULES_FEATURE_NAME = "no_enable_modules";
private static final String DEAD_STRIP_FEATURE_NAME = "dead_strip";
- private static final String RUN_COVERAGE_FEATURE_NAME = "run_coverage";
- /** Produce artifacts for coverage in llvm coverage mapping format. */
- private static final String LLVM_COVERAGE_MAP_FORMAT = "llvm_coverage_map_format";
- /** Produce artifacts for coverage in gcc coverage mapping format. */
- private static final String GCC_COVERAGE_MAP_FORMAT = "gcc_coverage_map_format";
/**
* Enabled if this target's rule is not a test rule. Binary stripping should not be applied in
* the link step. TODO(b/36562173): Replace this behavior with a condition on bundle creation.
@@ -483,14 +478,6 @@ public class CrosstoolCompilationSupport extends CompilationSupport {
&& ruleContext.getPrerequisiteArtifact("pch", Mode.TARGET) != null) {
activatedCrosstoolSelectables.add("pch");
}
- if (configuration.isCodeCoverageEnabled()) {
- activatedCrosstoolSelectables.add(RUN_COVERAGE_FEATURE_NAME);
- }
- if (configuration.isLLVMCoverageMapFormatEnabled()) {
- activatedCrosstoolSelectables.add(LLVM_COVERAGE_MAP_FORMAT);
- } else {
- activatedCrosstoolSelectables.add(GCC_COVERAGE_MAP_FORMAT);
- }
if (!isTestRule) {
activatedCrosstoolSelectables.add(IS_NOT_TEST_TARGET_FEATURE_NAME);
}