-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tasks Log.HasLoggedError
now respects MSBuildWarningsAsErrors
#6174
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
8ca466d
Add IBuildEngine8 with a hashset of all warnings to be logged as errors
benvillalobos ff95db2
Add GetWarningsAsErrors method to ILoggingService. TaskLoggingHelper …
benvillalobos 16cd7f0
Try adding warningsaserrors into taskhostconfiguration so OOP taskhos…
benvillalobos 2b61f12
TaskHostConfiguration now translates warningsaserrors
benvillalobos 07fbbb7
Update src/Utilities/Task.cs
benvillalobos 8da9849
run build.cmd and update ref files
benvillalobos 8f58790
WarningsAsErrors can be null if not specified
benvillalobos cf90ca0
Null check on warningsaserrors instead of buildengine
benvillalobos fda18f5
Unit Test: Add check for tasks logging warnings that are turned into …
benvillalobos 4a93c5a
Ensure build stops when task logs a warning->error
benvillalobos cdb831e
Add test for translation of taskhostconfiguration and warningsaserrors
benvillalobos 6cd3074
Add test that shows even if a task logs an error but returns true the…
benvillalobos 53c5b0e
BuildEngine may not be an IBE8
benvillalobos 4af8ce6
Exclude warnings->messages from warnings->errors because the former t…
benvillalobos b396ed5
Consider when WarningsAsErrors is an empty set that means we treat AL…
benvillalobos 764df59
Properly remove all warningsasmessages from warningsaserrors. handle …
benvillalobos fdd2419
Add customization to what CustomLogAndReturn task returns
benvillalobos 5d7b16a
Finalize tests. Remove test that _should not work but does_.
benvillalobos 83f1b66
Code review suggestion
benvillalobos 63be126
Minor code cleanup
benvillalobos 28f55cb
Explicitly call last overload of LogError
benvillalobos 787982a
Add null check for taskloggingcontext for test compatibility
benvillalobos d2c230c
Add tests for task-batches
benvillalobos 7aa9763
Minor PR feedback
benvillalobos febb509
Add arg names to taskhostconfig tests
benvillalobos 0ccb51c
Reword 'thrown' to 'logged' to avoid confusion
benvillalobos 7670dea
IBE8 now has ShouldTreatWarningAsError method
benvillalobos 9a485da
WarningsAsErrors set turned into ICollection (taskhost side)
benvillalobos 924423b
Binary translator converts an ICollection of strings. OOPTHN now tran…
benvillalobos a969d83
Rename arg to collection
benvillalobos b65e272
Make ICollection translate method more generic
benvillalobos 9856364
PR changes. Adding comments.
benvillalobos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like these are always true?