From eb4c54015ccdd4acb323e3ff722b01f20a5336c6 Mon Sep 17 00:00:00 2001 From: hlopko Date: Tue, 17 Jul 2018 09:37:23 -0700 Subject: 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 --- .../build/lib/rules/cpp/CcToolchainProvider.java | 33 ++++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java') 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 getUnfilteredCompilerOptionsWithSysroot( - Iterable featuresNotUsedAnymore) { + Iterable featuresNotUsedAnymore) throws EvalException { + cppConfiguration.checkForLegacyCompilationApiAvailability(); return toolchainInfo.getUnfilteredCompilerOptions(sysroot); } @@ -723,10 +724,12 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch } @Override - public ImmutableList getLinkOptionsWithSysroot() { - return cppConfiguration == null - ? ImmutableList.of() - : cppConfiguration.getLinkOptionsDoNotUse(sysroot); + public ImmutableList getLinkOptionsWithSysroot() throws EvalException { + if (cppConfiguration == null) { + return ImmutableList.of(); + } + cppConfiguration.checkForLegacyLinkingApiAvailability(); + return cppConfiguration.getLinkOptionsDoNotUse(sysroot); } public ImmutableList 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 getCompilerOptions() { + public ImmutableList getCompilerOptions() throws EvalException { + cppConfiguration.checkForLegacyCompilationApiAvailability(); return getLegacyCompileOptionsWithCopts(); } @@ -896,7 +900,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch * CcToolchainProvider#getLegacyCompileOptionsWithCopts()}. */ @Override - public ImmutableList getCOptions() { + public ImmutableList getCOptions() throws EvalException { + cppConfiguration.checkForLegacyCompilationApiAvailability(); return cppConfiguration.getCOptions(); } @@ -909,7 +914,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch */ @Override @Deprecated - public ImmutableList getCxxOptionsWithCopts() { + public ImmutableList getCxxOptionsWithCopts() throws EvalException { + cppConfiguration.checkForLegacyCompilationApiAvailability(); return ImmutableList.builder() .addAll(getLegacyCxxOptions()) .addAll(cppConfiguration.getCxxopts()) @@ -935,6 +941,7 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch @Override @Deprecated public ImmutableList 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 + *

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 getMostlyStaticLinkOptions(Boolean sharedLib) { + public ImmutableList 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 + *

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 getDynamicLinkOptions(Boolean sharedLib) { + public ImmutableList getDynamicLinkOptions(Boolean sharedLib) throws EvalException { + cppConfiguration.checkForLegacyLinkingApiAvailability(); return CppHelper.getDynamicLinkOptions(cppConfiguration, this, sharedLib); } -- cgit v1.2.3