From 3c5a1098af0c5ae80d4e3b1fc52dd1fef6027d43 Mon Sep 17 00:00:00 2001 From: hlopko Date: Wed, 21 Mar 2018 04:03:40 -0700 Subject: Add crosstool_lib.bzl and crosstool_utils.bzl These will be used to rewrite current crosstool autoconfiguration into action_configs and features. RELNOTES: None. PiperOrigin-RevId: 189888171 --- .../devtools/build/lib/rules/cpp/CcCommon.java | 36 ++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src/main/java/com') 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 b25dc7fc85..a2da30d674 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 @@ -50,6 +50,7 @@ import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables; import com.google.devtools.build.lib.rules.cpp.CppConfiguration.DynamicMode; import com.google.devtools.build.lib.rules.cpp.CppConfiguration.HeadersCheckingMode; import com.google.devtools.build.lib.rules.cpp.FdoSupport.FdoMode; +import com.google.devtools.build.lib.rules.cpp.Link.LinkTargetType; import com.google.devtools.build.lib.shell.ShellUtils; import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.VisibleForSerialization; @@ -105,11 +106,8 @@ public final class CcCommon { } }; - /** Action configs we request to enable. */ - private static final ImmutableSet DEFAULT_ACTION_CONFIGS = + public static final ImmutableSet ALL_COMPILE_ACTIONS = ImmutableSet.of( - CppCompileAction.CC_FLAGS_MAKE_VARIABLE_ACTION_NAME, - CppCompileAction.STRIP_ACTION_NAME, CppCompileAction.C_COMPILE, CppCompileAction.CPP_COMPILE, CppCompileAction.CPP_HEADER_PARSING, @@ -120,16 +118,29 @@ public final class CcCommon { CppCompileAction.PREPROCESS_ASSEMBLE, CppCompileAction.CLIF_MATCH, CppCompileAction.LINKSTAMP_COMPILE, - Link.LinkTargetType.STATIC_LIBRARY.getActionName(), - // We need to create pic-specific actions for link actions, as they will produce - // differently named outputs. - Link.LinkTargetType.PIC_STATIC_LIBRARY.getActionName(), + CppCompileAction.CC_FLAGS_MAKE_VARIABLE_ACTION_NAME); + + public static final ImmutableSet ALL_LINK_ACTIONS = + ImmutableSet.of( Link.LinkTargetType.INTERFACE_DYNAMIC_LIBRARY.getActionName(), - Link.LinkTargetType.NODEPS_DYNAMIC_LIBRARY.getActionName(), Link.LinkTargetType.DYNAMIC_LIBRARY.getActionName(), - Link.LinkTargetType.ALWAYS_LINK_STATIC_LIBRARY.getActionName(), - Link.LinkTargetType.ALWAYS_LINK_PIC_STATIC_LIBRARY.getActionName(), - Link.LinkTargetType.EXECUTABLE.getActionName()); + Link.LinkTargetType.NODEPS_DYNAMIC_LIBRARY.getActionName(), + LinkTargetType.EXECUTABLE.getActionName()); + + public static final ImmutableSet ALL_ARCHIVE_ACTIONS = + ImmutableSet.of(Link.LinkTargetType.STATIC_LIBRARY.getActionName()); + + public static final ImmutableSet ALL_OTHER_ACTIONS = + ImmutableSet.of(CppCompileAction.STRIP_ACTION_NAME); + + /** Action configs we request to enable. */ + public static final ImmutableSet DEFAULT_ACTION_CONFIGS = + ImmutableSet.builder() + .addAll(ALL_COMPILE_ACTIONS) + .addAll(ALL_LINK_ACTIONS) + .addAll(ALL_ARCHIVE_ACTIONS) + .addAll(ALL_OTHER_ACTIONS) + .build(); /** Features we request to enable unless a rule explicitly doesn't support them. */ private static final ImmutableSet DEFAULT_FEATURES = @@ -142,6 +153,7 @@ public final class CcCommon { CppRuleClasses.INCLUDE_PATHS, CppRuleClasses.PIC, CppRuleClasses.PREPROCESSOR_DEFINES); + public static final String CC_TOOLCHAIN_DEFAULT_ATTRIBUTE_NAME = ":cc_toolchain"; /** C++ configuration */ -- cgit v1.2.3