diff options
author | 2018-07-17 09:37:23 -0700 | |
---|---|---|
committer | 2018-07-17 09:39:02 -0700 | |
commit | eb4c54015ccdd4acb323e3ff722b01f20a5336c6 (patch) | |
tree | 5f03db22fb5f7bb2fc70da9cdf2ae273f9864f2c /src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java | |
parent | 7c8607eb87a85700016e4ba0f1c2fb6070b83e4d (diff) |
Add flags for disabling legacy crosstool fields
This cl adds following flags:
* --experimental_disable_legacy_cc_compilation_api
* --experimental_disable_legacy_cc_linking_api
* --experimental_disable_linking_mode_flags
* --experimental_disable_compilation_mode_flags
* --experimental_disable_legacy_crosstool_fields
RELNOTES: None
PiperOrigin-RevId: 204924599
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java index b20c61a632..c702eae16b 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java @@ -704,7 +704,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch @Override // TODO(b/24373706): Remove this method once new C++ toolchain API is available public ImmutableList<String> getUnfilteredCompilerOptionsWithSysroot( - Iterable<String> featuresNotUsedAnymore) { + Iterable<String> featuresNotUsedAnymore) throws EvalException { + cppConfiguration.checkForLegacyCompilationApiAvailability(); return toolchainInfo.getUnfilteredCompilerOptions(sysroot); } @@ -723,10 +724,12 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch } @Override - public ImmutableList<String> getLinkOptionsWithSysroot() { - return cppConfiguration == null - ? ImmutableList.of() - : cppConfiguration.getLinkOptionsDoNotUse(sysroot); + public ImmutableList<String> getLinkOptionsWithSysroot() throws EvalException { + if (cppConfiguration == null) { + return ImmutableList.of(); + } + cppConfiguration.checkForLegacyLinkingApiAvailability(); + return cppConfiguration.getLinkOptionsDoNotUse(sysroot); } public ImmutableList<String> getLinkOptions() { @@ -883,7 +886,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch * not use in new code. Will be removed soon as part of the new Skylark API to the C++ toolchain. */ @Override - public ImmutableList<String> getCompilerOptions() { + public ImmutableList<String> getCompilerOptions() throws EvalException { + cppConfiguration.checkForLegacyCompilationApiAvailability(); return getLegacyCompileOptionsWithCopts(); } @@ -896,7 +900,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch * CcToolchainProvider#getLegacyCompileOptionsWithCopts()}. */ @Override - public ImmutableList<String> getCOptions() { + public ImmutableList<String> getCOptions() throws EvalException { + cppConfiguration.checkForLegacyCompilationApiAvailability(); return cppConfiguration.getCOptions(); } @@ -909,7 +914,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch */ @Override @Deprecated - public ImmutableList<String> getCxxOptionsWithCopts() { + public ImmutableList<String> getCxxOptionsWithCopts() throws EvalException { + cppConfiguration.checkForLegacyCompilationApiAvailability(); return ImmutableList.<String>builder() .addAll(getLegacyCxxOptions()) .addAll(cppConfiguration.getCxxopts()) @@ -935,6 +941,7 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch @Override @Deprecated public ImmutableList<String> getFullyStaticLinkOptions(Boolean sharedLib) throws EvalException { + cppConfiguration.checkForLegacyLinkingApiAvailability(); if (!sharedLib) { throw new EvalException( Location.BUILTIN, "fully_static_link_options is deprecated, new uses are not allowed."); @@ -946,14 +953,15 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch * WARNING: This method is only added to allow incremental migration of existing users. Please do * not use in new code. Will be removed soon as part of the new Skylark API to the C++ toolchain. * - * Returns the immutable list of linker options for mostly statically linked outputs. Does not + * <p>Returns the immutable list of linker options for mostly statically linked outputs. Does not * include command-line options passed via --linkopt or --linkopts. * * @param sharedLib true if the output is a shared lib, false if it's an executable */ @Override @Deprecated - public ImmutableList<String> getMostlyStaticLinkOptions(Boolean sharedLib) { + public ImmutableList<String> getMostlyStaticLinkOptions(Boolean sharedLib) throws EvalException { + cppConfiguration.checkForLegacyLinkingApiAvailability(); return CppHelper.getMostlyStaticLinkOptions( cppConfiguration, this, sharedLib, /* shouldStaticallyLinkCppRuntimes= */ true); } @@ -962,14 +970,15 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch * WARNING: This method is only added to allow incremental migration of existing users. Please do * not use in new code. Will be removed soon as part of the new Skylark API to the C++ toolchain. * - * Returns the immutable list of linker options for artifacts that are not fully or mostly + * <p>Returns the immutable list of linker options for artifacts that are not fully or mostly * statically linked. Does not include command-line options passed via --linkopt or --linkopts. * * @param sharedLib true if the output is a shared lib, false if it's an executable */ @Override @Deprecated - public ImmutableList<String> getDynamicLinkOptions(Boolean sharedLib) { + public ImmutableList<String> getDynamicLinkOptions(Boolean sharedLib) throws EvalException { + cppConfiguration.checkForLegacyLinkingApiAvailability(); return CppHelper.getDynamicLinkOptions(cppConfiguration, this, sharedLib); } |