aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar plf <plf@google.com>2018-07-18 04:34:57 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-18 04:36:44 -0700
commitce9305e5bb903f8a200970aa020d3b10fa60ee13 (patch)
tree01b8e19293c9c8415402520f999c260a1336d636 /src/main
parentf6ea8e456fa549b69686cefa4b44d6ada1474410 (diff)
C++: Removes check for host configuration
The C++ Skylark API is protected by a flag and whitelist. The flag's value should be true by default for non-Bazel. This is set with an invocation policy. In Bazel the default value is false. When this was checked in I couldn't find a way to use the default value in the host configuration, so when checking the flag we ignored the value for these cases. In this CL we copy the target config value to the host config. RELNOTES:none PiperOrigin-RevId: 205059612
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
index fb84a0cce2..f09645c006 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
@@ -209,8 +209,7 @@ public final class CcCommon {
throws EvalException {
RuleContext context = skylarkRuleContext.getRuleContext();
Rule rule = context.getRule();
- if (!context.getConfiguration().isHostConfiguration()
- && !context.getFragment(CppConfiguration.class).getEnableCcSkylarkApi()) {
+ if (!context.getFragment(CppConfiguration.class).getEnableCcSkylarkApi()) {
throw new EvalException(
rule.getLocation(),
"Pass --experimental_enable_cc_skylark_api in "
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
index bcb5a7d81f..5992b22f5c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
@@ -864,6 +864,8 @@ public class CppOptions extends FragmentOptions {
public FragmentOptions getHost() {
CppOptions host = (CppOptions) getDefault();
+ host.enableCcSkylarkApi = enableCcSkylarkApi;
+
// The crosstool options are partially copied from the target configuration.
if (hostCrosstoolTop == null) {
host.cppCompiler = cppCompiler;