-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTargetGenerateSettings.cs
53 lines (43 loc) · 1.33 KB
/
TargetGenerateSettings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
namespace cake
{
public class TargetGenerateSettings
{
public ITargetGeneratingAction Action { get; private set; }
public string ActionHash { get; private set; }
public HashSet<string> InputFiles { get; private set; }
public HashSet<string> OutputFiles { get; private set; }
public TargetGenerateSettings(ITargetGeneratingAction action, IEnumerable<string> inputFiles, string outputFile)
: this(action,inputFiles, new[] {outputFile})
{
}
public TargetGenerateSettings(ITargetGeneratingAction action, IEnumerable<string> inputFiles, IEnumerable<string> outputFiles)
{
OutputFiles = new HashSet<string>(outputFiles);
Action = action;
ActionHash = Action.GetActionHash();
InputFiles = new HashSet<string>(inputFiles);
}
//todo: figure out how to write a sane Equals
public override bool Equals(object obj)
{
if (obj == null)
return false;
var other = obj as TargetGenerateSettings;
if (other == null)
return false;
if (ActionHash != other.ActionHash)
return false;
if (!other.InputFiles.SetEquals(InputFiles))
return false;
if (!other.OutputFiles.SetEquals(OutputFiles))
return false;
return true;
}
public override int GetHashCode()
{
return (InputFiles != null ? InputFiles.GetHashCode() : 0);
}
}
}