From 4cb1ebc2ddaa57b5da1e01cf31b395f71afb1dd4 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Mon, 7 Nov 2016 11:00:29 -0800 Subject: [PATCH] Fix some portable test issues --- build/Targets/Imports.targets | 2 +- .../CSharpTest/CSharpScriptingTest.csproj | 2 +- .../VisualBasicTest/BasicScriptingTest.vbproj | 2 +- .../DeployDesktopTestRuntime.csproj | 10 ++++++- src/Tools/BuildBoss/ProjectCheckerUtil.cs | 26 +++++++++++++++++-- src/Tools/BuildBoss/RoslynProjectData.cs | 5 +++- 6 files changed, 40 insertions(+), 7 deletions(-) diff --git a/build/Targets/Imports.targets b/build/Targets/Imports.targets index 37f546c24c6..1e0e7ce8fbe 100644 --- a/build/Targets/Imports.targets +++ b/build/Targets/Imports.targets @@ -13,7 +13,7 @@ $(OutDir)UnitTests\$(MSBuildProjectName)\ - + <_CopyReferences>false <_CopyProjectReferences>false diff --git a/src/Scripting/CSharpTest/CSharpScriptingTest.csproj b/src/Scripting/CSharpTest/CSharpScriptingTest.csproj index b55c50abb45..e6a158a0974 100644 --- a/src/Scripting/CSharpTest/CSharpScriptingTest.csproj +++ b/src/Scripting/CSharpTest/CSharpScriptingTest.csproj @@ -14,7 +14,7 @@ .NETPortable {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - UnitTest + UnitTestDesktop diff --git a/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj b/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj index d49ea598972..665e2bee461 100644 --- a/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj +++ b/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj @@ -11,7 +11,7 @@ v5.0 .NETPortable {14182A97-F7F0-4C62-8B27-98AA8AE2109A};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} - UnitTest + UnitTestDesktop diff --git a/src/Test/DeployDesktopTestRuntime/DeployDesktopTestRuntime.csproj b/src/Test/DeployDesktopTestRuntime/DeployDesktopTestRuntime.csproj index 9b8d9dfbaf4..514a65f0f5b 100644 --- a/src/Test/DeployDesktopTestRuntime/DeployDesktopTestRuntime.csproj +++ b/src/Test/DeployDesktopTestRuntime/DeployDesktopTestRuntime.csproj @@ -58,10 +58,18 @@ {12a68549-4e8c-42d6-8703-a09335f97997} Scripting + + {2dae4406-7a89-4b5f-95c3-bc5422ce47ce} + CSharpScriptingTest + {066f0dbd-c46c-4c20-afec-99829a172625} CSharpScripting + + {abc7262e-1053-49f3-b846-e3091bb92e8c} + BasicScriptingTest + {3e7dea65-317b-4f43-a25d-62f18d96cfd7} BasicScripting @@ -76,4 +84,4 @@ - + \ No newline at end of file diff --git a/src/Tools/BuildBoss/ProjectCheckerUtil.cs b/src/Tools/BuildBoss/ProjectCheckerUtil.cs index 89e68a62447..a2a486f9bc0 100644 --- a/src/Tools/BuildBoss/ProjectCheckerUtil.cs +++ b/src/Tools/BuildBoss/ProjectCheckerUtil.cs @@ -304,7 +304,9 @@ private bool IsUnitTestCorrectlySpecified(TextWriter textWriter, RoslynProjectDa private bool CheckTestDeploymentProjects(TextWriter textWriter) { var fileName = Path.GetFileNameWithoutExtension(_data.FileName); - if (fileName != "DeployCoreClrTestRuntime" && fileName != "DeployDesktopTestRuntime") + var isDesktop = fileName == "DeployDesktopTestRuntime"; + var isCoreClr = fileName == "DeployCoreClrTestRuntime"; + if (!isDesktop && !isCoreClr) { return true; } @@ -321,7 +323,27 @@ private bool CheckTestDeploymentProjects(TextWriter textWriter) foreach (var projectData in _solutionMap.Values) { var rosData = projectData.ProjectUtil.TryGetRoslynProjectData(); - if (rosData?.DeclaredKind == RoslynProjectKind.UnitTestPortable && !set.Contains(projectData.Key)) + if (rosData == null) + { + continue; + } + + var kind = rosData.Value.DeclaredKind; + bool include; + switch (kind) + { + case RoslynProjectKind.UnitTestPortable: + include = true; + break; + case RoslynProjectKind.UnitTestDesktop: + include = isDesktop; + break; + default: + include = false; + break; + } + + if (include && !set.Contains(projectData.Key)) { textWriter.WriteLine($"Portable unit test {projectData.FileName} must be referenced"); allGood = false; diff --git a/src/Tools/BuildBoss/RoslynProjectData.cs b/src/Tools/BuildBoss/RoslynProjectData.cs index 045a5535865..a9022d246aa 100644 --- a/src/Tools/BuildBoss/RoslynProjectData.cs +++ b/src/Tools/BuildBoss/RoslynProjectData.cs @@ -13,7 +13,7 @@ internal enum RoslynProjectKind Exe, ExeCoreClr, UnitTest, - UnitTestNext, + UnitTestDesktop, UnitTestPortable, CompilerGeneratorTool, DeploymentCompilerGeneratorTools, @@ -38,6 +38,8 @@ internal static class RoslynProjectKindUtil return RoslynProjectKind.Exe; case "UnitTestPortable": return RoslynProjectKind.UnitTestPortable; + case "UnitTestDesktop": + return RoslynProjectKind.UnitTestDesktop; case "UnitTest": return RoslynProjectKind.UnitTest; case "CompilerGeneratorTool": @@ -63,6 +65,7 @@ internal static bool IsAnyUnitTest(RoslynProjectKind kind) { return kind == RoslynProjectKind.UnitTest || + kind == RoslynProjectKind.UnitTestDesktop || kind == RoslynProjectKind.UnitTestPortable; } -- GitLab