Skip to content

Commit 1865d50

Browse files
Only warn when there is no ordering between duplicate binplace (#14)
* Only warn (instead of error) when there is no ordering between duplicate outputs * remove spaces
1 parent f732ef3 commit 1865d50

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/Common/MSBuildCachePluginBase.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -917,13 +917,6 @@ private void CheckForDuplicateOutputs(PluginLoggerBase logger, IReadOnlyDictiona
917917
return;
918918
}
919919

920-
// Duplicate-identical outputs are only allowed if there is a strict ordering between the multiple writers.
921-
if (!nodeContext.Node.IsDependentOn(previousNode.Node))
922-
{
923-
logger.LogError($"Node {nodeContext.Id} produced output {normalizedFilePath} which was already produced by another node {previousNode.Id}, but there is no ordering between the two nodes.");
924-
return;
925-
}
926-
927920
// This should never happen as the previous node is a dependent of this node...
928921
if (previousNode.BuildResult == null)
929922
{
@@ -933,14 +926,20 @@ private void CheckForDuplicateOutputs(PluginLoggerBase logger, IReadOnlyDictiona
933926

934927
// compare the hash of the original output to this output and log/error accordingly.
935928
ContentHash previousHash = previousNode.BuildResult!.Outputs[normalizedFilePath];
936-
if (previousHash == newHash)
929+
if (previousHash != newHash)
937930
{
938-
logger.LogMessage($"Node {nodeContext.Id} produced duplicate-identical output {normalizedFilePath} which was already produced by another node {previousNode.Id}. Allowing as content is the same.");
931+
logger.LogError($"Node {nodeContext.Id} produced output {normalizedFilePath} with hash {newHash} which was already produced by another node {previousNode.Id} with a different hash {previousHash}.");
932+
return;
939933
}
940-
else
934+
935+
// Duplicate-identical outputs are only allowed if there is a strict ordering between the multiple writers.
936+
if (!nodeContext.Node.IsDependentOn(previousNode.Node))
941937
{
942-
logger.LogError($"Node {nodeContext.Id} produced output {normalizedFilePath} with hash {newHash} which was already produced by another node {previousNode.Id} with a different hash {previousHash}.");
938+
logger.LogWarning($"Node {nodeContext.Id} produced output {normalizedFilePath} which was already produced by another node {previousNode.Id}, but there is no ordering between the two nodes.");
939+
return;
943940
}
941+
942+
logger.LogMessage($"Node {nodeContext.Id} produced duplicate-identical output {normalizedFilePath} which was already produced by another node {previousNode.Id}. Allowing as content is the same.");
944943
}
945944
}
946945
}

0 commit comments

Comments
 (0)