diff options
author | 2017-03-27 21:19:26 +0000 | |
---|---|---|
committer | 2017-03-28 19:49:11 +0000 | |
commit | bf0b990f5c00b9fb3d60f1c54956f4a22cabc687 (patch) | |
tree | c3860429c451bcc4007827f6b3e842edda304797 /src/main/java/com/google/devtools/build/lib/rules/cpp | |
parent | e67b00767c9c578bf23fa77fda85a8beec0682c4 (diff) |
Genrules only depend on the C++ toolchain if they have C++ make variables.
e.g.: cmd = "$(CC) foo.cc > $@"
Fixes #2729
--
PiperOrigin-RevId: 151369889
MOS_MIGRATED_REVID=151369889
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java index 9ad6ba3fa1..698353a105 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java @@ -87,6 +87,28 @@ public class CppRuleClasses { } } + /** + * Label of a pseudo-filegroup that contains all crosstool and libcfiles for all configurations, + * as specified on the command-line. + */ + public static final String CROSSTOOL_LABEL = "//tools/defaults:crosstool"; + + public static final LateBoundLabel<BuildConfiguration> DEFAULT_MALLOC = + new LateBoundLabel<BuildConfiguration>() { + @Override + public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) { + return configuration.getFragment(CppConfiguration.class).customMalloc(); + } + }; + + public static final LateBoundLabel<BuildConfiguration> CC_TOOLCHAIN = + new LateBoundLabel<BuildConfiguration>(CROSSTOOL_LABEL, CppConfiguration.class) { + @Override + public Label resolve(Rule rule, AttributeMap attributes, BuildConfiguration configuration) { + return configuration.getFragment(CppConfiguration.class).getCcToolchainRuleLabel(); + } + }; + // Artifacts of these types are discarded from the 'hdrs' attribute in cc rules static final FileTypeSet DISALLOWED_HDRS_FILES = FileTypeSet.of( ARCHIVE, |