File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
src/main/java/com/google/devtools/build/lib/rules/cpp Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -245,15 +245,25 @@ public CppCompilationContext getCppCompilationContext() {
245245 }
246246
247247 /**
248- * Adds the static, pic-static, and dynamic (both compile-time and execution-time) libraries to
249- * the given builder.
248+ * Adds the static, pic-static libraries to the given builder.
249+ * If addDynamicLibraries parameter is true, it also adds dynamic(both compile-time and
250+ * execution-time) libraries.
250251 */
251- public void addLinkingOutputsTo (NestedSetBuilder <Artifact > filesBuilder ) {
252+ public void addLinkingOutputsTo (
253+ NestedSetBuilder <Artifact > filesBuilder , boolean addDynamicLibraries ) {
252254 filesBuilder
253255 .addAll (LinkerInputs .toLibraryArtifacts (linkingOutputs .getStaticLibraries ()))
254- .addAll (LinkerInputs .toLibraryArtifacts (linkingOutputs .getPicStaticLibraries ()))
255- .addAll (LinkerInputs .toNonSolibArtifacts (linkingOutputs .getDynamicLibraries ()))
256- .addAll (LinkerInputs .toNonSolibArtifacts (linkingOutputs .getExecutionDynamicLibraries ()));
256+ .addAll (LinkerInputs .toLibraryArtifacts (linkingOutputs .getPicStaticLibraries ()));
257+ if (addDynamicLibraries ) {
258+ filesBuilder
259+ .addAll (LinkerInputs .toNonSolibArtifacts (linkingOutputs .getDynamicLibraries ()))
260+ .addAll (
261+ LinkerInputs .toNonSolibArtifacts (linkingOutputs .getExecutionDynamicLibraries ()));
262+ }
263+ }
264+
265+ public void addLinkingOutputsTo (NestedSetBuilder <Artifact > filesBuilder ) {
266+ addLinkingOutputsTo (filesBuilder , true );
257267 }
258268 }
259269
Original file line number Diff line number Diff line change @@ -190,7 +190,9 @@ private static class Impl {
190190 CcLibraryHelper .Info info = helper .build ();
191191 ccLibraryProviders = info .getProviders ();
192192 outputGroups = info .getOutputGroups ();
193- info .addLinkingOutputsTo (filesBuilder );
193+ // On Windows, dynamic library is not built by default, so don't add them to filesToBuild.
194+ info .addLinkingOutputsTo (
195+ filesBuilder , !featureConfiguration .isEnabled (CppRuleClasses .TARGETS_WINDOWS ));
194196 }
195197
196198 private boolean areSrcsBlacklisted () {
You can’t perform that action at this time.
0 commit comments