From ce9305e5bb903f8a200970aa020d3b10fa60ee13 Mon Sep 17 00:00:00 2001 From: plf Date: Wed, 18 Jul 2018 04:34:57 -0700 Subject: 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 --- src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java | 3 +-- src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main') 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; -- cgit v1.2.3