-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enable Nullable Reference Types in Test Projects #44862
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1a475e9
Enable Nullable Reference Types in Test Projects
v-wuzhai 5e233e4
Refactor Current, TestExecutionDirectory, and TestAssetsDirectory for…
v-wuzhai 596d00c
Refactor code to remove '!' operators
v-wuzhai 12ee199
Remove '!' operators
v-wuzhai 8b0dee8
Merge branch 'main' of https://github.com/dotnet/sdk into dev/v-wuzha…
v-wuzhai 2709f62
Fix build failed due to enabling nullable
v-wuzhai 73049a7
Update the code based on the feedback
v-wuzhai c982008
Merge branch 'main' of https://github.com/dotnet/sdk into dev/v-wuzha…
v-wuzhai 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 |
---|---|---|
|
@@ -12,13 +12,13 @@ public sealed class TarGzFileCreateFromDirectory : ToolTask | |
/// The path to the directory to be archived. | ||
/// </summary> | ||
[Required] | ||
public string SourceDirectory { get; set; } | ||
public string? SourceDirectory { get; set; } | ||
|
||
/// <summary> | ||
/// The path of the archive to be created. | ||
/// </summary> | ||
[Required] | ||
public string DestinationArchive { get; set; } | ||
public string? DestinationArchive { get; set; } | ||
|
||
/// <summary> | ||
/// Indicates if the destination archive should be overwritten if it already exists. | ||
|
@@ -33,7 +33,7 @@ public sealed class TarGzFileCreateFromDirectory : ToolTask | |
/// <summary> | ||
/// An item group of regular expressions for content to exclude from the archive. | ||
/// </summary> | ||
public ITaskItem[] ExcludePatterns { get; set; } | ||
public ITaskItem[]? ExcludePatterns { get; set; } | ||
|
||
public bool IgnoreExitCode { get; set; } | ||
|
||
|
@@ -69,16 +69,18 @@ protected override bool ValidateParameters() | |
retVal = false; | ||
} | ||
} | ||
if (SourceDirectory is not null) | ||
{ | ||
SourceDirectory = Path.GetFullPath(SourceDirectory); | ||
|
||
SourceDirectory = Path.GetFullPath(SourceDirectory); | ||
|
||
SourceDirectory = SourceDirectory.EndsWith(Path.DirectorySeparatorChar.ToString()) | ||
? SourceDirectory | ||
: SourceDirectory + Path.DirectorySeparatorChar; | ||
SourceDirectory = SourceDirectory.EndsWith(Path.DirectorySeparatorChar.ToString()) | ||
? SourceDirectory | ||
: SourceDirectory + Path.DirectorySeparatorChar; | ||
} | ||
|
||
if (!Directory.Exists(SourceDirectory)) | ||
{ | ||
Log.LogError($"SourceDirectory '{SourceDirectory} does not exist."); | ||
Log.LogError($"SourceDirectory '{SourceDirectory}' does not exist."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good find. |
||
|
||
retVal = false; | ||
} | ||
|
@@ -113,9 +115,9 @@ protected override string GenerateCommandLineCommands() | |
|
||
private string GetSourceSpecification() | ||
{ | ||
if (IncludeBaseDirectory) | ||
if (SourceDirectory is not null && IncludeBaseDirectory) | ||
{ | ||
var parentDirectory = Directory.GetParent(SourceDirectory).Parent.FullName; | ||
var parentDirectory = Directory.GetParent(SourceDirectory)?.Parent?.FullName; | ||
|
||
var sourceDirectoryName = Path.GetFileName(Path.GetDirectoryName(SourceDirectory)); | ||
|
||
|
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
Oops, something went wrong.
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.
@rainersigwald Have ya'll enabled nullable for any msbuild tasks? Is it possible for these to be null or does MSBuild force them to have a value always? Do they have to be marked Required to not be null?