-
Notifications
You must be signed in to change notification settings - Fork 1k
/
MockBuildEngine.cs
77 lines (61 loc) · 3.17 KB
/
MockBuildEngine.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.Build.Framework;
namespace Microsoft.NET.Build.Tasks.UnitTests
{
public class MockBuildEngine : IBuildEngine4
{
public int ColumnNumberOfTaskNode { get; set; }
public bool ContinueOnError { get; set; }
public int LineNumberOfTaskNode { get; set; }
public string ProjectFileOfTaskNode { get; set; }
public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs)
{
throw new NotImplementedException();
}
public void LogCustomEvent(CustomBuildEventArgs e)
{
CustomEvents.Add(e);
}
public void LogErrorEvent(BuildErrorEventArgs e)
{
Errors.Add(e);
}
public void LogMessageEvent(BuildMessageEventArgs e)
{
Messages.Add(e);
}
public void LogWarningEvent(BuildWarningEventArgs e)
{
Warnings.Add(e);
}
public virtual object GetRegisteredTaskObject(object key, RegisteredTaskObjectLifetime lifetime)
{
RegisteredTaskObjectsQueries++;
RegisteredTaskObjects.TryGetValue(key, out object ret);
return ret;
}
public void RegisterTaskObject(object key, object obj, RegisteredTaskObjectLifetime lifetime, bool allowEarlyCollection)
{
RegisteredTaskObjects.Add(key, obj);
}
public object UnregisterTaskObject(object key, RegisteredTaskObjectLifetime lifetime) => null;
public BuildEngineResult BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames, IDictionary[] globalProperties, IList<string>[] removeGlobalProperties, string[] toolsVersion, bool returnTargetOutputs) => new BuildEngineResult();
public void Yield() {
}
public void Reacquire() {
}
public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs, string toolsVersion) => false;
public bool BuildProjectFilesInParallel(string[] projectFileNames, string[] targetNames, IDictionary[] globalProperties, IDictionary[] targetOutputsPerProject, string[] toolsVersion, bool useResultsCache, bool unloadProjectsOnCompletion) => false;
public IList<CustomBuildEventArgs> CustomEvents { get; } = new List<CustomBuildEventArgs>();
public IList<BuildErrorEventArgs> Errors { get; } = new List<BuildErrorEventArgs>();
public IList<BuildMessageEventArgs> Messages { get; } = new List<BuildMessageEventArgs>();
public IList<BuildWarningEventArgs> Warnings { get; } = new List<BuildWarningEventArgs>();
public Dictionary<object, object> RegisteredTaskObjects { get; } = new Dictionary<object, object>();
public int RegisteredTaskObjectsQueries = 0;
public bool IsRunningMultipleNodes => throw new NotImplementedException();
}
}