From 9cc954a8c1e1f5134c4b6701588cd226e9e52707 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Tue, 14 Nov 2017 01:45:02 -0800 Subject: 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 --- .../java/com/google/devtools/build/lib/rules/cpp/CppHelper.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java') 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; } /** -- cgit v1.2.3