diff options
author | Yun Peng <pcloudy@google.com> | 2017-11-14 01:45:02 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-11-14 01:47:03 -0800 |
commit | 9cc954a8c1e1f5134c4b6701588cd226e9e52707 (patch) | |
tree | f91f1c8dc695c6249d25a7e9b189f4c28ebef29e /src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java | |
parent | 4260c30a03a9b83d48a5e8690aca19cd80be4c38 (diff) |
Add win_def_file attribute to cc rules.
RELNOTES[NEW]: Users can use win_def_file attribute to specify a DEF file for
exporting symbols when build a shared library on Windows.
Change-Id: Ifa28d8b7b24eaefcefc9640d8dc56fd2931e9688
PiperOrigin-RevId: 175651203
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java index e43bf7fd27..2a65615450 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java @@ -802,11 +802,14 @@ public class CppHelper { /** * Returns true when {@link CppRuleClasses#WINDOWS_EXPORT_ALL_SYMBOLS} feature is enabled and - * {@link CppRuleClasses#NO_WINDOWS_EXPORT_ALL_SYMBOLS} feature is not enabled. + * {@link CppRuleClasses#NO_WINDOWS_EXPORT_ALL_SYMBOLS} feature is not enabled and no custom DEF + * file is specified in win_def_file attribute. */ - public static boolean shouldUseDefFile(FeatureConfiguration featureConfiguration) { + public static boolean shouldUseGeneratedDefFile( + RuleContext ruleContext, FeatureConfiguration featureConfiguration) { return featureConfiguration.isEnabled(CppRuleClasses.WINDOWS_EXPORT_ALL_SYMBOLS) - && !featureConfiguration.isEnabled(CppRuleClasses.NO_WINDOWS_EXPORT_ALL_SYMBOLS); + && !featureConfiguration.isEnabled(CppRuleClasses.NO_WINDOWS_EXPORT_ALL_SYMBOLS) + && ruleContext.getPrerequisiteArtifact("win_def_file", Mode.TARGET) == null; } /** |