Add input caching for glob change detection
This commit is contained in:
parent
ef0ca39da1
commit
a3b7c85451
13 changed files with 541 additions and 167 deletions
|
@ -2,18 +2,43 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Build
|
||||
{
|
||||
internal struct CompilerIO
|
||||
internal class CompilerIO
|
||||
{
|
||||
public readonly List<string> Inputs;
|
||||
public readonly List<string> Outputs;
|
||||
public readonly IEnumerable<string> Inputs;
|
||||
public readonly IEnumerable<string> Outputs;
|
||||
|
||||
public CompilerIO(List<string> inputs, List<string> outputs)
|
||||
public CompilerIO(IEnumerable<string> inputs, IEnumerable<string> outputs)
|
||||
{
|
||||
Inputs = inputs;
|
||||
Outputs = outputs;
|
||||
}
|
||||
|
||||
public DiffResult DiffInputs(CompilerIO other)
|
||||
{
|
||||
var myInputSet = new HashSet<string>(Inputs);
|
||||
var otherInputSet = new HashSet<string>(other.Inputs);
|
||||
|
||||
var additions = myInputSet.Except(otherInputSet);
|
||||
var deletions = otherInputSet.Except(myInputSet);
|
||||
|
||||
return new DiffResult(additions, deletions);
|
||||
}
|
||||
|
||||
internal class DiffResult
|
||||
{
|
||||
public IEnumerable<string> Additions { get; private set; }
|
||||
public IEnumerable<string> Deletions { get; private set; }
|
||||
|
||||
public DiffResult(IEnumerable<string> additions, IEnumerable<string> deletions)
|
||||
{
|
||||
Additions = additions;
|
||||
Deletions = deletions;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue