Skip to content

Commit

Permalink
Enable nullables on TP Build project (#3719)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink authored Jun 8, 2022
1 parent c1fd766 commit 95e3afd
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 242 deletions.
1 change: 1 addition & 0 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@ Global
src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{61f7f446-9ef3-4768-b33a-4d75f60e1059}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{65a25d6e-c9cc-4f45-8925-04087ac82634}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{68adc720-316e-4895-9f8e-c3ccadd262be}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{6f5ec38c-4a11-40d3-827c-f607b90beff0}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{71cb42ff-e750-4a3b-9c3a-ac938853cc89}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems*{76d4bb7e-d981-42d5-be96-6fad8def9a4a}*SharedItemsImports = 5
src\Microsoft.TestPlatform.Execution.Shared\Microsoft.TestPlatform.Execution.Shared.projitems*{7f26eda3-c8c4-4b7f-a9b6-d278c2f40a13}*SharedItemsImports = 13
Expand Down
2 changes: 0 additions & 2 deletions src/Microsoft.TestPlatform.Build/ArgumentEscaper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System;
using System.Text;

#nullable disable

namespace Microsoft.TestPlatform.Build.Utils;

public static class ArgumentEscaper
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.TestPlatform.Build/BannedSymbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
M:System.Diagnostics.Debug.Assert(System.Boolean); Use 'TPDebug.Assert' instead
M:System.Diagnostics.Debug.Assert(System.Boolean,System.String); Use 'TPDebug.Assert' instead
M:System.String.IsNullOrEmpty(System.String); Use 'StringUtils.IsNullOrEmpty' instead
M:System.String.IsNullOrWhiteSpace(System.String); Use 'StringUtils.IsNullOrWhiteSpace' instead
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
<PropertyGroup>
<TestPlatformRoot Condition="$(TestPlatformRoot) == ''">..\..\</TestPlatformRoot>
</PropertyGroup>
<Import Project="..\Microsoft.TestPlatform.Nullability\Microsoft.TestPlatform.Nullability.projitems" Label="Shared" />
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />
<PropertyGroup>
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
<AssemblyName>Microsoft.TestPlatform.Build</AssemblyName>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(DotNetBuildFromSource)' == 'true' ">net6.0</TargetFrameworks>
<IsTestProject>false</IsTestProject>
<UseBannedApiAnalyzers>true</UseBannedApiAnalyzers>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Resources.resx" />
Expand Down Expand Up @@ -37,6 +39,7 @@
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCorePackageVersion)" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="BannedSymbols.txt" />
<!-- API that is common to all frameworks that we build for. -->
<AdditionalFiles Include="PublicAPI/PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI/PublicAPI.Unshipped.txt" />
Expand Down
71 changes: 1 addition & 70 deletions src/Microsoft.TestPlatform.Build/PublicAPI/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -1,70 +1 @@
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp.Cancel() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp.Execute() -> int
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp.VSTestForwardingApp(string vsTestExePath, System.Collections.Generic.IEnumerable<string> argsToForward) -> void
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.LogType.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.LogType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.ProjectFilePath.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.ProjectFilePath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.VSTestLogsTask() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask
Microsoft.TestPlatform.Build.Tasks.VSTestTask.Cancel() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.TestFileFullPath.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.TestFileFullPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlame.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlame.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrash.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrash.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashCollectAlways.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashCollectAlways.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashDumpType.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashDumpType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHang.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHang.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangDumpType.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangDumpType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangTimeout.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangTimeout.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCLIRunSettings.get -> string[]
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCLIRunSettings.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCollect.get -> string[]
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCollect.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestConsolePath.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestConsolePath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestDiag.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestDiag.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestFramework.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestFramework.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestListTests.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestListTests.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestLogger.get -> string[]
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestLogger.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestNoLogo.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestNoLogo.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestArtifactsProcessingMode.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestArtifactsProcessingMode.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSessionCorrelationId.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSessionCorrelationId.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestPlatform.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestPlatform.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestResultsDirectory.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestResultsDirectory.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSetting.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSetting.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTask() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestAdapterPath.get -> string[]
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestAdapterPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestCaseFilter.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestCaseFilter.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTraceDataCollectorDirectoryPath.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTraceDataCollectorDirectoryPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestVerbosity.get -> string
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestVerbosity.set -> void
Microsoft.TestPlatform.Build.Trace.Tracing
Microsoft.TestPlatform.Build.Utils.ArgumentEscaper
override Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.Execute() -> bool
override Microsoft.TestPlatform.Build.Tasks.VSTestTask.Execute() -> bool
static Microsoft.TestPlatform.Build.Trace.Tracing.Trace(string message) -> void
static Microsoft.TestPlatform.Build.Trace.Tracing.traceEnabled -> bool
static Microsoft.TestPlatform.Build.Utils.ArgumentEscaper.HandleEscapeSequenceInArgForProcessStart(string arg) -> string
#nullable enable
70 changes: 70 additions & 0 deletions src/Microsoft.TestPlatform.Build/PublicAPI/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp.Cancel() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp.Execute() -> int
Microsoft.TestPlatform.Build.Tasks.VSTestForwardingApp.VSTestForwardingApp(string! vsTestExePath, System.Collections.Generic.IEnumerable<string!>! argsToForward) -> void
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.LogType.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.LogType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.ProjectFilePath.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.ProjectFilePath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.VSTestLogsTask() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask
Microsoft.TestPlatform.Build.Tasks.VSTestTask.Cancel() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.TestFileFullPath.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.TestFileFullPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestArtifactsProcessingMode.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestArtifactsProcessingMode.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlame.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlame.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrash.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrash.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashCollectAlways.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashCollectAlways.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashDumpType.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameCrashDumpType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHang.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHang.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangDumpType.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangDumpType.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangTimeout.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestBlameHangTimeout.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCLIRunSettings.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCLIRunSettings.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCollect.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestCollect.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestConsolePath.get -> string!
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestConsolePath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestDiag.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestDiag.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestFramework.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestFramework.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestListTests.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestListTests.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestLogger.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestLogger.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestNoLogo.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestNoLogo.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestPlatform.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestPlatform.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestResultsDirectory.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestResultsDirectory.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSessionCorrelationId.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSessionCorrelationId.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSetting.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestSetting.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTask() -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestAdapterPath.get -> string![]?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestAdapterPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestCaseFilter.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTestCaseFilter.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTraceDataCollectorDirectoryPath.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestTraceDataCollectorDirectoryPath.set -> void
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestVerbosity.get -> string?
Microsoft.TestPlatform.Build.Tasks.VSTestTask.VSTestVerbosity.set -> void
Microsoft.TestPlatform.Build.Trace.Tracing
Microsoft.TestPlatform.Build.Utils.ArgumentEscaper
override Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask.Execute() -> bool
override Microsoft.TestPlatform.Build.Tasks.VSTestTask.Execute() -> bool
static Microsoft.TestPlatform.Build.Trace.Tracing.Trace(string! message) -> void
static Microsoft.TestPlatform.Build.Trace.Tracing.traceEnabled -> bool
static Microsoft.TestPlatform.Build.Utils.ArgumentEscaper.HandleEscapeSequenceInArgForProcessStart(string! arg) -> string!
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using Microsoft.TestPlatform.Build.Trace;
using Microsoft.TestPlatform.Build.Utils;

#nullable disable

namespace Microsoft.TestPlatform.Build.Tasks;

public class VSTestForwardingApp
Expand Down Expand Up @@ -58,7 +56,7 @@ public void Cancel()
}
catch (ArgumentException ex)
{
Tracing.Trace(string.Format("VSTest: Killing process throws ArgumentException with the following message {0}. It may be that process is not running", ex));
Tracing.Trace($"VSTest: Killing process throws ArgumentException with the following message {ex}. It may be that process is not running");
}
}
}
15 changes: 2 additions & 13 deletions src/Microsoft.TestPlatform.Build/Tasks/VSTestLogsTask.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.


using System;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

#nullable disable

namespace Microsoft.TestPlatform.Build.Tasks;
public class VSTestLogsTask : Task
{
public string LogType
{
get;
set;
}
public string? LogType { get; set; }

public string ProjectFilePath
{
get;
set;
}
public string? ProjectFilePath { get; set; }

public override bool Execute()
{
Expand Down
Loading

0 comments on commit 95e3afd

Please sign in to comment.