diff options
author | 2017-06-20 08:38:50 -0400 | |
---|---|---|
committer | 2017-06-20 14:36:50 -0400 | |
commit | c4a48db62bc26ffb261f684876c8e9dc65df28fa (patch) | |
tree | c36096e2dbc655146e7623c49cf7872e1bc881d4 /src/main/java/com | |
parent | 2d008e824e4c5c39f00f21cfa879eed61d5b500a (diff) |
Introduce is_cc_test build variable so we can migrate away from is_not_cc_test_link_action
If only hlopko@ used brain when he introduced is_not_cc_test_link_action he
would realize that the current values make it impossible to migrate away from
them. This cl introduces new build variable with boolean value. Then I can
update internal crosstools to use expand_if_true/false, and then I can remove
is_not_cc_test_link_action.
RELNOTES: None.
PiperOrigin-RevId: 159549814
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java | 8 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java | 12 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java index 4cbc6cf8ce..67226586a6 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainFeatures.java @@ -1435,7 +1435,13 @@ public class CcToolchainFeatures implements Serializable { stringVariablesMap.putAll(variables.stringVariablesMap); } - /** Add a variable that expands {@code name} to {@code value}. */ + /** Add an integer variable that expands {@code name} to {@code value}. */ + public Builder addIntegerVariable(String name, int value) { + variablesMap.put(name, new IntegerValue(value)); + return this; + } + + /** Add a string variable that expands {@code name} to {@code value}. */ public Builder addStringVariable(String name, String value) { Preconditions.checkArgument( !variablesMap.containsKey(name), "Cannot overwrite variable '%s'", name); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java index 0b34fb40b4..4e1d5f47ce 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java @@ -134,9 +134,12 @@ public class CppLinkActionBuilder { /** A build variable whose presence indicates that the debug symbols should be stripped. */ public static final String STRIP_DEBUG_SYMBOLS_VARIABLE = "strip_debug_symbols"; - /** A build variable whose presence indicates that this action is a cc_test linking action. */ + @Deprecated public static final String IS_CC_TEST_LINK_ACTION_VARIABLE = "is_cc_test_link_action"; + /** A build variable whose presence indicates that this action is a cc_test linking action. */ + public static final String IS_CC_TEST_VARIABLE = "is_cc_test"; + /** * Temporary build variable for migrating osx crosstool. * TODO(b/37271982): Remove after blaze with ar action_config release @@ -150,10 +153,7 @@ public class CppLinkActionBuilder { */ public static final String IS_USING_FISSION_VARIABLE = "is_using_fission"; - /** - * A (temporary) build variable whose presence indicates that this action is not a cc_test linking - * action. - */ + @Deprecated public static final String IS_NOT_CC_TEST_LINK_ACTION_VARIABLE = "is_not_cc_test_link_action"; // Builder-only @@ -1437,8 +1437,10 @@ public class CppLinkActionBuilder { } if (useTestOnlyFlags()) { + buildVariables.addIntegerVariable(IS_CC_TEST_VARIABLE, 1); buildVariables.addStringVariable(IS_CC_TEST_LINK_ACTION_VARIABLE, ""); } else { + buildVariables.addIntegerVariable(IS_CC_TEST_VARIABLE, 0); buildVariables.addStringVariable(IS_NOT_CC_TEST_LINK_ACTION_VARIABLE, ""); } |