diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build')
6 files changed, 197 insertions, 91 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java index 8aea1525a2..28ab7dedc7 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java @@ -665,7 +665,10 @@ public class CcToolchain implements RuleConfiguredTargetFactory { return CppToolchainInfo.create( cppConfiguration.getCrosstoolTopPathFragment(), cppConfiguration.getCcToolchainRuleLabel(), - crosstoolInfo); + crosstoolInfo, + cppConfiguration.disableLegacyCrosstoolFields(), + cppConfiguration.disableCompilationModeFlags(), + cppConfiguration.disableLinkingModeFlags()); } catch (InvalidConfigurationException e) { throw ruleContext.throwWithRuleError(e.getMessage()); } 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); } 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 375f735c72..4bbfeafc16 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 @@ -92,6 +92,18 @@ public final class CppConfiguration extends BuildConfiguration.Fragment /** String constant for CC_FLAGS make variable name */ public static final String CC_FLAGS_MAKE_VARIABLE_NAME = "CC_FLAGS"; + public boolean disableLegacyCrosstoolFields() { + return cppOptions.disableLegacyCrosstoolFields; + } + + public boolean disableCompilationModeFlags() { + return cppOptions.disableCompilationModeFlags; + } + + public boolean disableLinkingModeFlags() { + return cppOptions.disableLinkingModeFlags; + } + /** * An enumeration of all the tools that comprise a toolchain. */ @@ -223,7 +235,12 @@ public final class CppConfiguration extends BuildConfiguration.Fragment params.crosstoolTop.getPackageIdentifier().getPathUnderExecRoot(); CppToolchainInfo cppToolchainInfo = CppToolchainInfo.create( - crosstoolTopPathFragment, params.ccToolchainLabel, params.crosstoolInfo); + crosstoolTopPathFragment, + params.ccToolchainLabel, + params.crosstoolInfo, + cppOptions.disableLegacyCrosstoolFields, + cppOptions.disableCompilationModeFlags, + cppOptions.disableLinkingModeFlags); CompilationMode compilationMode = params.commonOptions.compilationMode; @@ -555,6 +572,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment public ImmutableList<String> getCompilerOptions(Iterable<String> featuresNotUsedAnymore) throws EvalException { checkForToolchainSkylarkApiAvailability(); + checkForLegacyCompilationApiAvailability(); return compilerFlags; } @@ -567,6 +585,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment @Deprecated public ImmutableList<String> getCOptionsForSkylark() throws EvalException { checkForToolchainSkylarkApiAvailability(); + checkForLegacyCompilationApiAvailability(); return getCOptions(); } @@ -586,6 +605,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment public ImmutableList<String> getCxxOptions(Iterable<String> featuresNotUsedAnymore) throws EvalException { checkForToolchainSkylarkApiAvailability(); + checkForLegacyCompilationApiAvailability(); return cxxFlags; } @@ -603,6 +623,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment public ImmutableList<String> getUnfilteredCompilerOptionsWithLegacySysroot( Iterable<String> featuresNotUsedAnymore) throws EvalException { checkForToolchainSkylarkApiAvailability(); + checkForLegacyCompilationApiAvailability(); return getUnfilteredCompilerOptionsDoNotUse(nonConfiguredSysroot); } @@ -637,6 +658,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment @Override public ImmutableList<String> getLinkOptionsWithLegacySysroot() throws EvalException { checkForToolchainSkylarkApiAvailability(); + checkForLegacyLinkingApiAvailability(); return getLinkOptionsDoNotUse(nonConfiguredSysroot); } @@ -694,6 +716,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment public ImmutableList<String> getFullyStaticLinkOptions( Iterable<String> featuresNotUsedAnymore, Boolean sharedLib) throws EvalException { checkForToolchainSkylarkApiAvailability(); + checkForLegacyLinkingApiAvailability(); if (!sharedLib) { throw new EvalException( Location.BUILTIN, "fully_static_link_options is deprecated, new uses are not allowed."); @@ -716,6 +739,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment public ImmutableList<String> getMostlyStaticLinkOptions( Iterable<String> featuresNotUsedAnymore, Boolean sharedLib) throws EvalException { checkForToolchainSkylarkApiAvailability(); + checkForLegacyLinkingApiAvailability(); if (sharedLib) { return getSharedLibraryLinkOptions( cppToolchainInfo.supportsEmbeddedRuntimes() @@ -741,6 +765,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment public ImmutableList<String> getDynamicLinkOptions( Iterable<String> featuresNotUsedAnymore, Boolean sharedLib) throws EvalException { checkForToolchainSkylarkApiAvailability(); + checkForLegacyLinkingApiAvailability(); if (sharedLib) { return getSharedLibraryLinkOptions(dynamicLinkFlags); } else { @@ -1173,6 +1198,23 @@ public final class CppConfiguration extends BuildConfiguration.Fragment } } + public void checkForLegacyCompilationApiAvailability() throws EvalException { + if (cppOptions.disableLegacyCompilationApi) { + throw new EvalException( + null, + "Skylark APIs accessing compilation flags has been removed. " + + "Use the new API on cc_common."); + } + } + + public void checkForLegacyLinkingApiAvailability() throws EvalException { + if (cppOptions.disableLegacyLinkingApi) { + throw new EvalException( + null, + "Skylark APIs accessing linking flags has been removed. Use the new API on cc_common."); + } + } + public static PathFragment computeDefaultSysroot(String builtInSysroot) { if (builtInSysroot.isEmpty()) { return null; 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 2ecb33e6d6..bcb5a7d81f 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 @@ -804,6 +804,52 @@ public class CppOptions extends FragmentOptions { public boolean enableCcSkylarkApi; @Option( + name = "experimental_disable_legacy_cc_linking_api", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.TOOLCHAIN, + effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, + metadataTags = {OptionMetadataTag.EXPERIMENTAL}, + help = "If true, C++ Skylark API exposing linking flags will be disabled.") + public boolean disableLegacyLinkingApi; + + @Option( + name = "experimental_disable_legacy_cc_compilation_api", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.TOOLCHAIN, + effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, + metadataTags = {OptionMetadataTag.EXPERIMENTAL}, + help = "If true, C++ Skylark API exposing compilation flags will be disabled.") + public boolean disableLegacyCompilationApi; + + @Option( + name = "experimental_disable_linking_mode_flags", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.TOOLCHAIN, + effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, + metadataTags = {OptionMetadataTag.EXPERIMENTAL}, + help = "If true, Bazel will not read crosstool flags from linking_mode_flags field.") + public boolean disableLinkingModeFlags; + + @Option( + name = "experimental_disable_compilation_mode_flags", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.TOOLCHAIN, + effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, + metadataTags = {OptionMetadataTag.EXPERIMENTAL}, + help = "If true, Bazel will not read crosstool flags from compilation_mode_flags field.") + public boolean disableCompilationModeFlags; + + @Option( + name = "experimental_disable_legacy_crosstool_fields", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.TOOLCHAIN, + effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, + metadataTags = {OptionMetadataTag.EXPERIMENTAL}, + help = + "If true, Bazel will not read crosstool flags from legacy crosstool fields (see #5187.") + public boolean disableLegacyCrosstoolFields; + + @Option( name = "experimental_enable_cc_dynlibs_for_runtime", defaultValue = "true", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java index 1396779f83..de7514e72b 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java @@ -111,7 +111,12 @@ public final class CppToolchainInfo { /** Creates a CppToolchainInfo from CROSSTOOL info encapsulated in {@link CrosstoolInfo}. */ public static CppToolchainInfo create( - PathFragment crosstoolTopPathFragment, Label toolchainLabel, CrosstoolInfo crosstoolInfo) + PathFragment crosstoolTopPathFragment, + Label toolchainLabel, + CrosstoolInfo crosstoolInfo, + boolean disableLegacyCrosstoolFields, + boolean disableCompilationModeFlags, + boolean disableLinkingModeFlags) throws InvalidConfigurationException { ImmutableMap<String, PathFragment> toolPaths = computeToolPaths(crosstoolInfo, crosstoolTopPathFragment); @@ -121,21 +126,24 @@ public final class CppToolchainInfo { ImmutableListMultimap.Builder<LinkingMode, String> linkOptionsFromLinkingModeBuilder = ImmutableListMultimap.builder(); - // If a toolchain supports dynamic libraries at all, there must be at least one - // of the following: - // - a "DYNAMIC" section in linking_mode_flags (even if no flags are needed) - // - a non-empty list in one of the dynamicLibraryLinkerFlag fields - // If none of the above contain data, then the toolchain can't do dynamic linking. - boolean haveDynamicMode = crosstoolInfo.hasDynamicLinkingModeFlags(); - linkOptionsFromLinkingModeBuilder.putAll( - LinkingMode.DYNAMIC, crosstoolInfo.getDynamicLinkingModeFlags()); - linkOptionsFromLinkingModeBuilder.putAll( - LinkingMode.LEGACY_FULLY_STATIC, crosstoolInfo.getFullyStaticLinkingModeFlags()); - linkOptionsFromLinkingModeBuilder.putAll( - LinkingMode.STATIC, crosstoolInfo.getMostlyStaticLinkingModeFlags()); - linkOptionsFromLinkingModeBuilder.putAll( - LinkingMode.LEGACY_MOSTLY_STATIC_LIBRARIES, - crosstoolInfo.getMostlyStaticLibrariesLinkingModeFlags()); + boolean haveDynamicMode = false; + if (!disableLinkingModeFlags) { + // If a toolchain supports dynamic libraries at all, there must be at least one + // of the following: + // - a "DYNAMIC" section in linking_mode_flags (even if no flags are needed) + // - a non-empty list in one of the dynamicLibraryLinkerFlag fields + // If none of the above contain data, then the toolchain can't do dynamic linking. + haveDynamicMode = crosstoolInfo.hasDynamicLinkingModeFlags(); + linkOptionsFromLinkingModeBuilder.putAll( + LinkingMode.DYNAMIC, crosstoolInfo.getDynamicLinkingModeFlags()); + linkOptionsFromLinkingModeBuilder.putAll( + LinkingMode.LEGACY_FULLY_STATIC, crosstoolInfo.getFullyStaticLinkingModeFlags()); + linkOptionsFromLinkingModeBuilder.putAll( + LinkingMode.STATIC, crosstoolInfo.getMostlyStaticLinkingModeFlags()); + linkOptionsFromLinkingModeBuilder.putAll( + LinkingMode.LEGACY_MOSTLY_STATIC_LIBRARIES, + crosstoolInfo.getMostlyStaticLibrariesLinkingModeFlags()); + } ImmutableListMultimap.Builder<CompilationMode, String> cFlagsBuilder = ImmutableListMultimap.builder(); @@ -144,33 +152,35 @@ public final class CppToolchainInfo { ImmutableListMultimap.Builder<CompilationMode, String> linkOptionsFromCompilationModeBuilder = ImmutableListMultimap.builder(); - cFlagsBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.OPT), - crosstoolInfo.getOptCompilationModeCompilerFlags()); - cxxFlagsBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.OPT), - crosstoolInfo.getOptCompilationModeCxxFlags()); - linkOptionsFromCompilationModeBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.OPT), - crosstoolInfo.getOptCompilationModeLinkerFlags()); - cFlagsBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.DBG), - crosstoolInfo.getDbgCompilationModeCompilerFlags()); - cxxFlagsBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.DBG), - crosstoolInfo.getDbgCompilationModeCxxFlags()); - linkOptionsFromCompilationModeBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.DBG), - crosstoolInfo.getDbgCompilationModeLinkerFlags()); - cFlagsBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD), - crosstoolInfo.getFastbuildCompilationModeCompilerFlags()); - cxxFlagsBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD), - crosstoolInfo.getFastbuildCompilationModeCxxFlags()); - linkOptionsFromCompilationModeBuilder.putAll( - importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD), - crosstoolInfo.getFastbuildCompilationModeLinkerFlags()); + if (!disableCompilationModeFlags) { + cFlagsBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.OPT), + crosstoolInfo.getOptCompilationModeCompilerFlags()); + cxxFlagsBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.OPT), + crosstoolInfo.getOptCompilationModeCxxFlags()); + linkOptionsFromCompilationModeBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.OPT), + crosstoolInfo.getOptCompilationModeLinkerFlags()); + cFlagsBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.DBG), + crosstoolInfo.getDbgCompilationModeCompilerFlags()); + cxxFlagsBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.DBG), + crosstoolInfo.getDbgCompilationModeCxxFlags()); + linkOptionsFromCompilationModeBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.DBG), + crosstoolInfo.getDbgCompilationModeLinkerFlags()); + cFlagsBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD), + crosstoolInfo.getFastbuildCompilationModeCompilerFlags()); + cxxFlagsBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD), + crosstoolInfo.getFastbuildCompilationModeCxxFlags()); + linkOptionsFromCompilationModeBuilder.putAll( + importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD), + crosstoolInfo.getFastbuildCompilationModeLinkerFlags()); + } try { return new CppToolchainInfo( @@ -191,11 +201,15 @@ public final class CppToolchainInfo { defaultSysroot, crosstoolInfo.getTargetLibc(), crosstoolInfo.getHostSystemName(), - crosstoolInfo.getDynamicLibraryLinkerFlags(), - crosstoolInfo.getLinkerFlags(), + disableLegacyCrosstoolFields + ? ImmutableList.of() + : crosstoolInfo.getDynamicLibraryLinkerFlags(), + disableLegacyCrosstoolFields ? ImmutableList.of() : crosstoolInfo.getLinkerFlags(), linkOptionsFromLinkingModeBuilder.build(), linkOptionsFromCompilationModeBuilder.build(), - crosstoolInfo.getTestOnlyLinkerFlags(), + disableLegacyCrosstoolFields + ? ImmutableList.of() + : crosstoolInfo.getTestOnlyLinkerFlags(), crosstoolInfo.getLdEmbedFlags(), crosstoolInfo.getObjcopyEmbedFlags(), toolchainLabel, @@ -213,11 +227,11 @@ public final class CppToolchainInfo { crosstoolInfo.getAbiVersion(), crosstoolInfo.getTargetSystemName(), computeAdditionalMakeVariables(crosstoolInfo), - crosstoolInfo.getCompilerFlags(), - crosstoolInfo.getCxxFlags(), + disableLegacyCrosstoolFields ? ImmutableList.of() : crosstoolInfo.getCompilerFlags(), + disableLegacyCrosstoolFields ? ImmutableList.of() : crosstoolInfo.getCxxFlags(), cFlagsBuilder.build(), cxxFlagsBuilder.build(), - crosstoolInfo.getUnfilteredCxxFlags(), + disableLegacyCrosstoolFields ? ImmutableList.of() : crosstoolInfo.getUnfilteredCxxFlags(), crosstoolInfo.supportsFission(), crosstoolInfo.supportsStartEndLib(), crosstoolInfo.supportsEmbeddedRuntimes(), diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java index 078f5b6e3d..6d2e01494a 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/cpp/CcToolchainProviderApi.java @@ -57,29 +57,26 @@ public interface CcToolchainProviderApi extends ToolchainInfoApi { name = "unfiltered_compiler_options", doc = "<b>Deprecated</b>. Returns the default list of options which cannot be filtered by " - + "BUILD rules. These should be appended to the command line after filtering.", + + "BUILD rules. These should be appended to the command line after filtering.", parameters = { @Param( name = "features", doc = "Unused.", positional = true, named = false, - type = SkylarkList.class - ) - } - ) + type = SkylarkList.class) + }) // 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; @SkylarkCallable( - name = "link_options_do_not_use", - structField = true, - doc = - "Returns the set of command-line linker options, including any flags " - + "inferred from the command-line options." - ) - public ImmutableList<String> getLinkOptionsWithSysroot(); + name = "link_options_do_not_use", + structField = true, + doc = + "Returns the set of command-line linker options, including any flags " + + "inferred from the command-line options.") + public ImmutableList<String> getLinkOptionsWithSysroot() throws EvalException; @SkylarkCallable( name = "target_gnu_system_name", @@ -95,9 +92,8 @@ public interface CcToolchainProviderApi extends ToolchainInfoApi { "Returns the default options to use for compiling C, C++, and assembler. " + "This is just the options that should be used for all three languages. " + "There may be additional C-specific or C++-specific options that should be used, " - + "in addition to the ones returned by this method" - ) - public ImmutableList<String> getCompilerOptions(); + + "in addition to the ones returned by this method") + public ImmutableList<String> getCompilerOptions() throws EvalException; @SkylarkCallable( name = "c_options", @@ -105,7 +101,7 @@ public interface CcToolchainProviderApi extends ToolchainInfoApi { "Returns the list of additional C-specific options to use for compiling C. " + "These should be go on the command line after the common options returned by " + "<code>compiler_options</code>") - public ImmutableList<String> getCOptions(); + public ImmutableList<String> getCOptions() throws EvalException; @SkylarkCallable( name = "cxx_options", @@ -114,7 +110,7 @@ public interface CcToolchainProviderApi extends ToolchainInfoApi { + "These should be go on the command line after the common options returned by " + "<code>compiler_options</code>") @Deprecated - public ImmutableList<String> getCxxOptionsWithCopts(); + public ImmutableList<String> getCxxOptionsWithCopts() throws EvalException; @SkylarkCallable( name = "fully_static_link_options", @@ -147,12 +143,10 @@ public interface CcToolchainProviderApi extends ToolchainInfoApi { doc = "If true, returns the link options for a shared library.", positional = true, named = false, - type = Boolean.class - ) - } - ) + type = Boolean.class) + }) @Deprecated - public ImmutableList<String> getMostlyStaticLinkOptions(Boolean sharedLib); + public ImmutableList<String> getMostlyStaticLinkOptions(Boolean sharedLib) throws EvalException; @SkylarkCallable( name = "dynamic_link_options", @@ -166,12 +160,10 @@ public interface CcToolchainProviderApi extends ToolchainInfoApi { doc = "If true, returns the link options for a shared library.", positional = true, named = false, - type = Boolean.class - ) - } - ) + type = Boolean.class) + }) @Deprecated - public ImmutableList<String> getDynamicLinkOptions(Boolean sharedLib); + public ImmutableList<String> getDynamicLinkOptions(Boolean sharedLib) throws EvalException; @SkylarkCallable( name = "ld_executable", |