本文整理汇总了C#中Microsoft.Build.BackEnd.BuildRequestEntry类的典型用法代码示例。如果您正苦于以下问题:C# BuildRequestEntry类的具体用法?C# BuildRequestEntry怎么用?C# BuildRequestEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildRequestEntry类属于Microsoft.Build.BackEnd命名空间,在下文中一共展示了BuildRequestEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
LoggingServiceFactory loggingFactory = new LoggingServiceFactory(LoggerMode.Synchronous, 1);
_loggingService = loggingFactory.CreateInstance(BuildComponentType.LoggingService) as LoggingService;
_customLogger = new MyCustomLogger();
_mockHost = new MockHost();
_mockHost.LoggingService = _loggingService;
_loggingService.RegisterLogger(_customLogger);
_elementLocation = ElementLocation.Create("MockFile", 5, 5);
BuildRequest buildRequest = new BuildRequest(1 /* submissionId */, 1, 1, new List<string>(), null, BuildEventContext.Invalid, null);
BuildRequestConfiguration configuration = new BuildRequestConfiguration(1, new BuildRequestData("Nothing", new Dictionary<string, string>(), "4.0", new string[0], null), "2.0");
configuration.Project = new ProjectInstance(ProjectRootElement.Create());
BuildRequestEntry entry = new BuildRequestEntry(buildRequest, configuration);
BuildResult buildResult = new BuildResult(buildRequest, false);
buildResult.AddResultsForTarget("Build", new TargetResult(new TaskItem[] { new TaskItem("IamSuper", configuration.ProjectFullPath) }, TestUtilities.GetSkippedResult()));
_mockRequestCallback = new MockIRequestBuilderCallback(new BuildResult[] { buildResult });
entry.Builder = (IRequestBuilder)_mockRequestCallback;
_taskHost = new TaskHost(_mockHost, entry, _elementLocation, null /*Dont care about the callback either unless doing a build*/);
_taskHost.LoggingContext = new TaskLoggingContext(_loggingService, BuildEventContext.Invalid);
}
开发者ID:ChronosWS,项目名称:msbuild,代码行数:28,代码来源:TaskHost_Tests.cs
示例2: TestSimpleBuildRequest
public void TestSimpleBuildRequest()
{
BuildRequestConfiguration configuration = CreateTestProject(1);
try
{
TestTargetBuilder targetBuilder = (TestTargetBuilder)_host.GetComponent(BuildComponentType.TargetBuilder);
IConfigCache configCache = (IConfigCache)_host.GetComponent(BuildComponentType.ConfigCache);
configCache.AddConfiguration(configuration);
BuildRequest request = CreateNewBuildRequest(1, new string[1] { "target1" });
BuildRequestEntry entry = new BuildRequestEntry(request, configuration);
BuildResult result = new BuildResult(request);
result.AddResultsForTarget("target1", GetEmptySuccessfulTargetResult());
targetBuilder.SetResultsToReturn(result);
_requestBuilder.BuildRequest(GetNodeLoggingContext(), entry);
WaitForEvent(_buildRequestCompletedEvent, "Build Request Completed");
Assert.Equal(BuildRequestEntryState.Complete, entry.State);
Assert.Equal(entry, _buildRequestCompleted_Entry);
Assert.Equal(BuildResultCode.Success, _buildRequestCompleted_Entry.Result.OverallResult);
}
finally
{
DeleteTestProject(configuration);
}
}
开发者ID:cameron314,项目名称:msbuild,代码行数:27,代码来源:RequestBuilder_Tests.cs
示例3: TestConstructorNullTarget
public void TestConstructorNullTarget()
{
ProjectInstance project = CreateTestProject(true /* Returns enabled */);
BuildRequestConfiguration config = new BuildRequestConfiguration(1, new BuildRequestData("foo", new Dictionary<string, string>(), "foo", new string[0], null), "2.0");
BuildRequestEntry requestEntry = new BuildRequestEntry(CreateNewBuildRequest(1, new string[] { "foo" }), config);
Lookup lookup = new Lookup(new ItemDictionary<ProjectItemInstance>(project.Items), new PropertyDictionary<ProjectPropertyInstance>(project.Properties), null);
TargetEntry entry = new TargetEntry(requestEntry, this, null, lookup, null, _host, false);
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:8,代码来源:TargetEntry_Tests.cs
示例4: TestConstructorBad
public void TestConstructorBad()
{
Assert.Throws<ArgumentNullException>(() =>
{
BuildRequestEntry entry = new BuildRequestEntry(null, null);
}
);
}
开发者ID:cameron314,项目名称:msbuild,代码行数:8,代码来源:BuildRequestEntry_Tests.cs
示例5: TestConstructorGood
public void TestConstructorGood()
{
BuildRequest request = CreateNewBuildRequest(1, new string[0] { });
BuildRequestData data = new BuildRequestData("foo", new Dictionary<string, string>(), "foo", new string[0], null);
BuildRequestConfiguration config = new BuildRequestConfiguration(1, data, "2.0");
BuildRequestEntry entry = new BuildRequestEntry(request, config);
Assert.AreEqual(entry.State, BuildRequestEntryState.Ready);
Assert.AreEqual(entry.Request, request);
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:10,代码来源:BuildRequestEntry_Tests.cs
示例6: BuildTargets
/// <summary>
/// Builds the specified targets of an entry. The cancel event should only be set to true if we are planning
/// on simulating execution time when a target is built
/// </summary>
public Task<BuildResult> BuildTargets(ProjectLoggingContext loggingContext, BuildRequestEntry entry, IRequestBuilderCallback callback, string[] targetNames, Lookup baseLookup, CancellationToken cancellationToken)
{
_requestEntry = entry;
_projectLoggingContext = loggingContext;
_requestCallBack = callback;
_testDefinition = _testDataProvider[entry.Request.ConfigurationId];
_cancellationToken = cancellationToken;
BuildResult result = GenerateResults(targetNames);
return Task<BuildResult>.FromResult(result);
}
开发者ID:cameron314,项目名称:msbuild,代码行数:15,代码来源:MockTargetBuilder.cs
示例7: BuildRequest
public void BuildRequest(NodeLoggingContext context, BuildRequestEntry entry)
{
Assert.Null(_builderThread); // "Received BuildRequest while one was in progress"
_continueEvent = new AutoResetEvent(false);
_cancelEvent = new AutoResetEvent(false);
_entry = entry;
entry.Continue();
_builderThread = new Thread(BuilderThreadProc);
_builderThread.Start();
}
开发者ID:cameron314,项目名称:msbuild,代码行数:12,代码来源:BuildRequestEngine_Tests.cs
示例8: TestSimpleStateProgression
public void TestSimpleStateProgression()
{
// Start in Ready
BuildRequest request = CreateNewBuildRequest(1, new string[1] { "foo" });
BuildRequestConfiguration config = new BuildRequestConfiguration(1, new BuildRequestData("foo", new Dictionary<string, string>(), "foo", new string[0], null), "2.0");
BuildRequestEntry entry = new BuildRequestEntry(request, config);
Assert.AreEqual(entry.State, BuildRequestEntryState.Ready);
Assert.AreEqual(entry.Request, request);
Assert.IsNull(entry.Result);
// Move to active. Should not be any results yet.
IDictionary<int, BuildResult> results = entry.Continue();
Assert.AreEqual(entry.State, BuildRequestEntryState.Active);
Assert.IsNull(entry.Result);
Assert.IsNull(results);
// Wait for results, move to waiting.
BuildRequest waitingRequest = CreateNewBuildRequest(2, new string[1] { "bar" });
entry.WaitForResult(waitingRequest);
Assert.AreEqual(entry.State, BuildRequestEntryState.Waiting);
Assert.AreEqual(entry.Request, request);
Assert.IsNull(entry.Result);
// Provide the results, move to ready.
BuildResult requiredResult = new BuildResult(waitingRequest);
requiredResult.AddResultsForTarget("bar", TestUtilities.GetEmptySucceedingTargetResult());
entry.ReportResult(requiredResult);
Assert.AreEqual(entry.State, BuildRequestEntryState.Ready);
Assert.AreEqual(entry.Request, request);
Assert.IsNull(entry.Result);
// Continue the build, move to active.
results = entry.Continue();
Assert.AreEqual(entry.State, BuildRequestEntryState.Active);
Assert.IsNull(entry.Result);
Assert.AreEqual(results.Count, 1);
Assert.IsTrue(results.ContainsKey(requiredResult.NodeRequestId));
Assert.AreEqual(results[requiredResult.NodeRequestId], requiredResult);
// Complete the build, move to completed.
BuildResult result = new BuildResult(request);
result.AddResultsForTarget("foo", TestUtilities.GetEmptySucceedingTargetResult());
entry.Complete(result);
Assert.AreEqual(entry.State, BuildRequestEntryState.Complete);
Assert.IsNotNull(entry.Result);
Assert.AreEqual(entry.Result, result);
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:47,代码来源:BuildRequestEntry_Tests.cs
示例9: TestNoReadyToComplete
public void TestNoReadyToComplete()
{
BuildRequest request = CreateNewBuildRequest(1, new string[1] { "foo" });
BuildRequestData data1 = new BuildRequestData("foo", new Dictionary<string, string>(), "foo", new string[0], null);
BuildRequestConfiguration config = new BuildRequestConfiguration(1, data1, "2.0");
BuildRequestEntry entry = new BuildRequestEntry(request, config);
Assert.AreEqual(entry.State, BuildRequestEntryState.Ready);
BuildResult requiredResult = new BuildResult(request);
requiredResult.AddResultsForTarget("foo", TestUtilities.GetEmptySucceedingTargetResult());
entry.Complete(requiredResult);
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:12,代码来源:BuildRequestEntry_Tests.cs
示例10: TestMixedWaitingRequests
public void TestMixedWaitingRequests()
{
BuildRequest request = CreateNewBuildRequest(1, new string[1] { "foo" });
BuildRequestConfiguration config = new BuildRequestConfiguration(1, new BuildRequestData("foo", new Dictionary<string, string>(), "foo", new string[0], null), "2.0");
BuildRequestEntry entry = new BuildRequestEntry(request, config);
Assert.AreEqual(entry.State, BuildRequestEntryState.Ready);
entry.Continue();
Assert.AreEqual(entry.State, BuildRequestEntryState.Active);
BuildRequest waitingRequest1 = CreateNewBuildRequest(2, new string[1] { "bar" });
entry.WaitForResult(waitingRequest1);
Assert.AreEqual(entry.State, BuildRequestEntryState.Waiting);
BuildRequest waitingRequest2 = CreateNewBuildRequest(-1, new string[1] { "xor" });
entry.WaitForResult(waitingRequest2);
Assert.AreEqual(entry.State, BuildRequestEntryState.Waiting);
Assert.IsNull(entry.GetRequestsToIssueIfReady(), "Entry should not be ready to issue because there are unresolved configurations");
entry.ResolveConfigurationRequest(-1, 3);
Assert.AreEqual(entry.State, BuildRequestEntryState.Waiting);
BuildResult requiredResult1 = new BuildResult(waitingRequest1);
requiredResult1.AddResultsForTarget("bar", TestUtilities.GetEmptySucceedingTargetResult());
entry.ReportResult(requiredResult1);
Assert.AreEqual(entry.State, BuildRequestEntryState.Waiting);
BuildResult requiredResult2 = new BuildResult(waitingRequest2);
requiredResult2.AddResultsForTarget("xor", TestUtilities.GetEmptySucceedingTargetResult());
entry.ReportResult(requiredResult2);
Assert.AreEqual(entry.State, BuildRequestEntryState.Ready);
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:33,代码来源:BuildRequestEntry_Tests.cs
示例11: TestNoReadyToWaiting
public void TestNoReadyToWaiting()
{
BuildRequest request = CreateNewBuildRequest(1, new string[1] { "foo" });
BuildRequestData data1 = new BuildRequestData("foo", new Dictionary<string, string>(), "foo", new string[0], null);
BuildRequestConfiguration config = new BuildRequestConfiguration(1, data1, "2.0");
BuildRequestEntry entry = new BuildRequestEntry(request, config);
Assert.AreEqual(entry.State, BuildRequestEntryState.Ready);
BuildRequest waitingRequest1 = CreateNewBuildRequest(2, new string[1] { "bar" });
entry.WaitForResult(waitingRequest1);
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:11,代码来源:BuildRequestEntry_Tests.cs
示例12: TestSimpleBuild
public void TestSimpleBuild()
{
ProjectInstance project = CreateTestProject();
// The Empty target has no inputs or outputs.
TargetBuilder builder = (TargetBuilder)_host.GetComponent(BuildComponentType.TargetBuilder);
IConfigCache cache = (IConfigCache)_host.GetComponent(BuildComponentType.ConfigCache);
BuildRequestEntry entry = new BuildRequestEntry(CreateNewBuildRequest(1, new string[] { "Empty" }), cache[1]);
BuildResult result = builder.BuildTargets(GetProjectLoggingContext(entry), entry, this, entry.Request.Targets.ToArray(), CreateStandardLookup(project), CancellationToken.None).Result;
Assert.True(result.HasResultsForTarget("Empty"));
Assert.Equal(TargetResultCode.Success, result["Empty"].ResultCode);
Assert.Equal(0, result["Empty"].Items.Length);
}
开发者ID:cameron314,项目名称:msbuild,代码行数:14,代码来源:TargetBuilder_Tests.cs
示例13: TestComplexOrdering2
public void TestComplexOrdering2()
{
string projectBody = @"
<Target Name='BuildDep'>
<BuildDepTask/>
</Target>
<Target Name='BeforeDepDep'>
<BeforeDepDepTask/>
</Target>
<Target Name='BeforeBeforeDep' BeforeTargets='BeforeDep'>
<BeforeBeforeDepTask/>
</Target>
<Target Name='AfterBeforeBeforeDep' AfterTargets='BeforeBeforeDep'>
<AfterBeforeBeforeDepTask/>
</Target>
<Target Name='BeforeDep' DependsOnTargets='BeforeDepDep'>
<BeforeDepTask/>
</Target>
<Target Name='Before' DependsOnTargets='BeforeDep' BeforeTargets='Build'>
<BeforeTask/>
</Target>
<Target Name='AfterBeforeDepDep'>
<AfterBeforeDepDepTask/>
</Target>
<Target Name='AfterBeforeDep' DependsOnTargets='AfterBeforeDepDep'>
<AfterBeforeDepTask/>
</Target>
<Target Name='AfterBefore' DependsOnTargets='AfterBeforeDep' AfterTargets='Before'>
<AfterBeforeTask/>
</Target>
<Target Name='Build' DependsOnTargets='BuildDep'>
<BuildTask/>
</Target>
";
ProjectInstance project = CreateTestProject(projectBody);
TargetBuilder builder = (TargetBuilder)_host.GetComponent(BuildComponentType.TargetBuilder);
IConfigCache cache = (IConfigCache)_host.GetComponent(BuildComponentType.ConfigCache);
BuildRequestEntry entry = new BuildRequestEntry(CreateNewBuildRequest(1, new string[] { "Build" }), cache[1]);
BuildResult result = builder.BuildTargets(GetProjectLoggingContext(entry), entry, this, entry.Request.Targets.ToArray(), CreateStandardLookup(project), CancellationToken.None).Result;
AssertTaskExecutionOrder(new string[] { "BuildDepTask", "BeforeDepDepTask", "BeforeBeforeDepTask", "AfterBeforeBeforeDepTask", "BeforeDepTask", "BeforeTask", "AfterBeforeDepDepTask", "AfterBeforeDepTask", "AfterBeforeTask", "BuildTask" });
}
开发者ID:cameron314,项目名称:msbuild,代码行数:54,代码来源:TargetBuilder_Tests.cs
示例14: TestConstructorBad
public void TestConstructorBad()
{
BuildRequestEntry entry = new BuildRequestEntry(null, null);
}
开发者ID:JamesLinus,项目名称:msbuild,代码行数:4,代码来源:BuildRequestEntry_Tests.cs
示例15: MockIRequestBuilderCallback_OnBuildRequestCompleted
/// <summary>
/// Not Implemented
/// </summary>
private void MockIRequestBuilderCallback_OnBuildRequestCompleted(BuildRequestEntry completedEntry)
{
throw new NotImplementedException();
}
开发者ID:ChronosWS,项目名称:msbuild,代码行数:7,代码来源:TaskHost_Tests.cs
示例16: TestLegacyCallTarget
public void TestLegacyCallTarget()
{
string projectBody = @"
<Target Name='Build'>
<CallTarget Targets='Foo;Goo'/>
</Target>
<Target Name='Foo' DependsOnTargets='Foo2'>
<FooTarget/>
</Target>
<Target Name='Goo'>
<GooTarget/>
</Target>
<Target Name='Foo2'>
<Foo2Target/>
</Target>
";
ProjectInstance project = CreateTestProject(projectBody);
TargetBuilder builder = (TargetBuilder)_host.GetComponent(BuildComponentType.TargetBuilder);
IConfigCache cache = (IConfigCache)_host.GetComponent(BuildComponentType.ConfigCache);
BuildRequestEntry entry = new BuildRequestEntry(CreateNewBuildRequest(1, new string[] { "Build" }), cache[1]);
BuildResult result = builder.BuildTargets(GetProjectLoggingContext(entry), entry, this, entry.Request.Targets.ToArray(), CreateStandardLookup(project), CancellationToken.None).Result;
AssertTaskExecutionOrder(new string[] { "CallTarget", "Foo2Target", "FooTarget", "GooTarget" });
}
开发者ID:cameron314,项目名称:msbuild,代码行数:29,代码来源:TargetBuilder_Tests.cs
示例17: TestBeforeTargetsEscaped
public void TestBeforeTargetsEscaped()
{
string projectBody = @"
<Target Name='Build;Me' Outputs='$(Test)'>
<BuildTask/>
</Target>
<Target Name='Before' BeforeTargets='Build%3bMe'>
<BeforeTask/>
</Target>";
ProjectInstance project = CreateTestProject(projectBody);
TargetBuilder builder = (TargetBuilder)_host.GetComponent(BuildComponentType.TargetBuilder);
IConfigCache cache = (IConfigCache)_host.GetComponent(BuildComponentType.ConfigCache);
BuildRequestEntry entry = new BuildRequestEntry(CreateNewBuildRequest(1, new string[] { "Build;Me" }), cache[1]);
BuildResult result = builder.BuildTargets(GetProjectLoggingContext(entry), entry, this, entry.Request.Targets.ToArray(), CreateStandardLookup(project), CancellationToken.None).Result;
AssertTaskExecutionOrder(new string[] { "BeforeTask", "BuildTask" });
}
开发者ID:cameron314,项目名称:msbuild,代码行数:20,代码来源:TargetBuilder_Tests.cs
示例18: MockIRequestBuilderCallback_OnBuildRequestBlocked
/// <summary>
/// Not Implemented
/// </summary>
private void MockIRequestBuilderCallback_OnBuildRequestBlocked(BuildRequestEntry sourceEntry, int blockingGlobalRequestId, string blockingTarget)
{
throw new NotImplementedException();
}
开发者ID:ChronosWS,项目名称:msbuild,代码行数:7,代码来源:TaskHost_Tests.cs
示例19: TestDependencyBuildWithError
public void TestDependencyBuildWithError()
{
ProjectInstance project = CreateTestProject();
// The DepError target builds Foo (which succeeds), Skip (which skips) and Error (which fails), and Baz2
// Baz2 should not run since it came after Error.
// Error tries to build Foo again as an error (which is already built) and Bar, which produces outputs.
// DepError builds Baz as an error, which produces outputs
TargetBuilder builder = (TargetBuilder)_host.GetComponent(BuildComponentType.TargetBuilder);
MockTaskBuilder taskBuilder = (MockTaskBuilder)_host.GetComponent(BuildComponentType.TaskBuilder);
taskBuilder.FailTaskNumber = 3; // Succeed on Foo's one task, and Error's first task, and fail the second.
IConfigCache cache = (IConfigCache)_host.GetComponent(BuildComponentType.ConfigCache);
BuildRequestEntry entry = new BuildRequestEntry(CreateNewBuildRequest(1, new string[] { "DepError" }), cache[1]);
BuildResult result = builder.BuildTargets(GetProjectLoggingContext(entry), entry, this, entry.Request.Targets.ToArray(), CreateStandardLookup(project), CancellationToken.None).Result;
Assert.True(result.HasResultsForTarget("DepError"));
Assert.False(result.HasResultsForTarget("Foo"));
Assert.False(result.HasResultsForTarget("Skip"));
Assert.False(result.HasResultsForTarget("Error"));
Assert.False(result.HasResultsForTarget("Baz2"));
Assert.False(result.HasResultsForTarget("Bar"));
Assert.False(result.HasResultsForTarget("Baz"));
IResultsCache resultsCache = (IResultsCache)_host.GetComponent(BuildComponentType.ResultsCache);
Assert.True(resultsCache.GetResultForRequest(entry.Request).HasResultsForTarget("Foo"));
Assert.True(resultsCache.GetResultForRequest(entry.Request).HasResultsForTarget("Skip"));
Assert.True(resultsCache.GetResultForRequest(entry.Request).HasResultsForTarget("Error"));
Assert.False(resultsCache.GetResultForRequest(entry.Request).HasResultsForTarget("Baz2"));
Assert.True(resultsCache.GetResultForRequest(entry.Request).HasResultsForTarget("Bar"));
Assert.True(resultsCache.GetResultForRequest(entry.Request).HasResultsForTarget("Baz"));
Assert.Equal(TargetResultCode.Failure, resultsCache.GetResultForRequest(entry.Request)["DepError"].ResultCode);
Assert.Equal(TargetResultCode.Success, resultsCache.GetResultForRequest(entry.Request)["Foo"].ResultCode);
Assert.Equal(TargetResultCode.Success, resultsCache.GetResultForRequest(entry.Request)["Skip"].ResultCode);
Assert.Equal(TargetResultCode.Failure, resultsCache.GetResultForRequest(entry.Request)["Error"].ResultCode);
Assert.Equal(TargetResultCode.Success, resultsCache.GetResultForRequest(entry.Request)["Bar"].ResultCode);
Assert.Equal(TargetResultCode.Success, resultsCache.GetResultForRequest(entry.Request)["Baz"].ResultCode);
}
开发者ID:cameron314,项目名称:msbuild,代码行数:38,代码来源:TargetBuilder_Tests.cs
示例20: TestDependencyBuildWithSkip
public void TestDependencyBuildWithSkip()
{
ProjectInstance project = CreateTestProject();
// DepSkip depends on Skip (which skips) but should succeed itself.
TargetBuilder builder = (TargetBuilder)_host.GetComponent(BuildComponentType.TargetBuilder);
IConfigCache cache = (IConfigCache)_host.GetComponent(BuildComponentType.ConfigCache);
BuildRequestEntry entry = new BuildRequestEntry(CreateNewBuildRequest(1, new string[] { "DepSkip" }), cache[1]);
BuildResult result = builder.BuildTargets(GetProjectLoggingContext(entry), entry, this, entry.Request.Targets.ToArray(), CreateStandardLookup(project), CancellationToken.None).Result;
Assert.True(result.HasResultsForTarget("DepSkip"));
Assert.False(result.HasResultsForTarget("Skip"));
Assert.Equal(TargetResultCode.Success, result["DepSkip"].ResultCode);
IResultsCache resultsCache = (IResultsCache)_host.GetComponent(BuildComponentType.ResultsCache);
Assert.True(resultsCache.GetResultForRequest(entry.Request).HasResultsForTarget("SkipCondition"));
Assert.Equal(TargetResultCode.Skipped, resultsCache.GetResultForRequest(entry.Request)["SkipCondition"].ResultCode);
}
开发者ID:cameron314,项目名称:msbuild,代码行数:17,代码来源:TargetBuilder_Tests.cs
注:本文中的Microsoft.Build.BackEnd.BuildRequestEntry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论