Skip to content

Commit 9738f35

Browse files
meteorcloudyCopybara-Service
authored andcommitted
CcProtoLibrary: Don't add dynamic librarys to filesToBuild on Windows
bazelbuild#3985 Change-Id: Ib566103e147219122b3f745a98ad30db5f27553f PiperOrigin-RevId: 176365079
1 parent 4117c86 commit 9738f35

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff 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

src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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() {

0 commit comments

Comments
 (0)