diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java index 6e652378ae..2b9447a755 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java @@ -1191,19 +1191,25 @@ public class CppLinkActionBuilder { if (!isLtoIndexing) { for (Entry<Linkstamp, Artifact> linkstampEntry : linkstampMap.entrySet()) { + Iterable<Artifact> inputs; + if (cppConfiguration.shouldFixLinkstampInputsBug()) { + inputs = IterablesChain.<Artifact>builder() + .add(ImmutableSet.copyOf(nonCodeInputs)) + // We don't want to add outputs of this linkstamp compilation action to + // inputsBuilder before this line, since that would introduce a cycle in the + // graph. + .add(inputsBuilder.deduplicate().build()) + .build(); + } else { + inputs = ImmutableSet.copyOf(nonCodeInputs); + } analysisEnvironment.registerAction( CppLinkstampCompileHelper.createLinkstampCompileAction( ruleContext, linkstampEntry.getKey().getArtifact(), linkstampEntry.getValue(), linkstampEntry.getKey().getDeclaredIncludeSrcs(), - NestedSetBuilder.<Artifact>stableOrder() - .addAll(nonCodeInputs) - // We don't want to add outputs of this linkstamp compilation action to - // inputsBuilder before this line, since that would introduce a cycle in the - // graph. - .addAll(inputsBuilder.deduplicate().build()) - .build(), + inputs, buildInfoHeaderArtifacts, additionalLinkstampDefines, toolchain, |