Skip to content

Commit

Permalink
CcProtoLibrary: Don't add dynamic librarys to filesToBuild on Windows
Browse files Browse the repository at this point in the history
bazelbuild#3985

Change-Id: Ib566103e147219122b3f745a98ad30db5f27553f
PiperOrigin-RevId: 176365079
  • Loading branch information
meteorcloudy authored and Copybara-Service committed Nov 20, 2017
1 parent 4117c86 commit 9738f35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,25 @@ public CppCompilationContext getCppCompilationContext() {
}

/**
* Adds the static, pic-static, and dynamic (both compile-time and execution-time) libraries to
* the given builder.
* Adds the static, pic-static libraries to the given builder.
* If addDynamicLibraries parameter is true, it also adds dynamic(both compile-time and
* execution-time) libraries.
*/
public void addLinkingOutputsTo(NestedSetBuilder<Artifact> filesBuilder) {
public void addLinkingOutputsTo(
NestedSetBuilder<Artifact> filesBuilder, boolean addDynamicLibraries) {
filesBuilder
.addAll(LinkerInputs.toLibraryArtifacts(linkingOutputs.getStaticLibraries()))
.addAll(LinkerInputs.toLibraryArtifacts(linkingOutputs.getPicStaticLibraries()))
.addAll(LinkerInputs.toNonSolibArtifacts(linkingOutputs.getDynamicLibraries()))
.addAll(LinkerInputs.toNonSolibArtifacts(linkingOutputs.getExecutionDynamicLibraries()));
.addAll(LinkerInputs.toLibraryArtifacts(linkingOutputs.getPicStaticLibraries()));
if (addDynamicLibraries) {
filesBuilder
.addAll(LinkerInputs.toNonSolibArtifacts(linkingOutputs.getDynamicLibraries()))
.addAll(
LinkerInputs.toNonSolibArtifacts(linkingOutputs.getExecutionDynamicLibraries()));
}
}

public void addLinkingOutputsTo(NestedSetBuilder<Artifact> filesBuilder) {
addLinkingOutputsTo(filesBuilder, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ private static class Impl {
CcLibraryHelper.Info info = helper.build();
ccLibraryProviders = info.getProviders();
outputGroups = info.getOutputGroups();
info.addLinkingOutputsTo(filesBuilder);
// On Windows, dynamic library is not built by default, so don't add them to filesToBuild.
info.addLinkingOutputsTo(
filesBuilder, !featureConfiguration.isEnabled(CppRuleClasses.TARGETS_WINDOWS));
}

private boolean areSrcsBlacklisted() {
Expand Down

0 comments on commit 9738f35

Please sign in to comment.