-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2da32a0
commit 14c3714
Showing
20 changed files
with
771 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
namespace Microsoft.Build.UnitTests | ||
{ | ||
public class CustomLogAndReturnTask : Task | ||
{ | ||
public string WarningCode { get; set; } | ||
|
||
public string ErrorCode { get; set; } | ||
|
||
public bool ReturnHasLoggedErrors { get; set; } | ||
|
||
[Required] | ||
public bool Return { get; set; } | ||
|
||
// Unused for now, created for task batching. | ||
public ITaskItem[] Sources { get; set; } | ||
|
||
/// <summary> | ||
/// This task returns and logs what you want based on the running test. | ||
/// </summary> | ||
public override bool Execute() | ||
{ | ||
if(!string.IsNullOrEmpty(WarningCode)) | ||
{ | ||
Log.LogWarning(null, WarningCode, null, null, 0, 0, 0, 0, "Warning Logged!", null); | ||
} | ||
|
||
if(!string.IsNullOrEmpty(ErrorCode)) | ||
{ | ||
Log.LogError(null, ErrorCode, null, null, 0, 0, 0, 0, "Error Logged!", null); | ||
} | ||
return ReturnHasLoggedErrors ? !Log.HasLoggedErrors : Return; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.