From 30788d2c31dcf400def00feba197564acf6044da Mon Sep 17 00:00:00 2001 From: Chris Sienkiewicz Date: Wed, 25 Jul 2018 11:13:27 -0700 Subject: [PATCH] Sdk test projects (dotnet/coreclr#19044) Change the associated targets and props files in the test directory to allow the test csproj's to be built as SDK style projects alongside traditional style projects. Remove CodeTaskFactory: - Allows the projects to be built using the core version of msbuild/dotnet build - Converted to using msbuild property expansion instead Add directory.build.{props,targets}: - Currently we just import the dirs.props and targets, but means SDK style projects don't need to explicitly include these files - We probably want to move all projects over to using these in the future, but this keeps the changes smaller for now Specific code for SDK projects: - There are a several changes required to build an SDK project. This change guards them behind conditionals so that only the new style projects see them. When we get to the point that there are only new projects, we can remove the guards (probably at the same time as ditching the dir.props) Reordered build targets: - Because SDK projects implicitly import the build targets, we can no longer re-define the build targets unconditionally knowing they will likely be overwritten. - Instead we move the overwritten targets to separate files, and include these conditionally based on properties. In this way there is always a build defined for SDK projects, which can then be overwritten to do nothing as needed. Commit migrated from https://github.com/dotnet/coreclr/commit/eddc1a621b66d63ac9feda289f08fc0e9f67f850 --- src/coreclr/build-test.cmd | 2 +- src/coreclr/tests/dir.props | 2 ++ src/coreclr/tests/dir.sdkbuild.props | 6 +++- src/coreclr/tests/override.targets | 7 ++++ src/coreclr/tests/runtest.proj | 3 +- .../tests/src/CLRTest.Execute.Batch.targets | 7 +--- src/coreclr/tests/src/CLRTest.Execute.targets | 38 ---------------------- .../Coreclr.TestWrapper/Coreclr.TestWrapper.csproj | 1 + src/coreclr/tests/src/Common/Directory.Build.props | 8 +++++ .../tests/src/Common/Directory.Build.targets | 8 +++++ src/coreclr/tests/src/Directory.Build.props | 6 ++++ src/coreclr/tests/src/Directory.Build.targets | 6 ++++ src/coreclr/tests/src/dir.targets | 31 +++++++++--------- src/coreclr/tests/src/nobuild.targets | 8 +++++ src/coreclr/tests/src/runonly.targets | 13 ++++++++ 15 files changed, 84 insertions(+), 62 deletions(-) create mode 100644 src/coreclr/tests/src/Common/Directory.Build.props create mode 100644 src/coreclr/tests/src/Common/Directory.Build.targets create mode 100644 src/coreclr/tests/src/Directory.Build.props create mode 100644 src/coreclr/tests/src/Directory.Build.targets create mode 100644 src/coreclr/tests/src/nobuild.targets create mode 100644 src/coreclr/tests/src/runonly.targets diff --git a/src/coreclr/build-test.cmd b/src/coreclr/build-test.cmd index 31c5ad3..a688e59 100644 --- a/src/coreclr/build-test.cmd +++ b/src/coreclr/build-test.cmd @@ -440,7 +440,7 @@ set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%" set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%" REM Build wrappers using the local SDK's msbuild. As we move to arcade, the other builds should be moved away from run.exe as well. -call %__DotnetHost% msbuild %__ProjectDir%\tests\runtest.proj /p:BuildWrappers=true !__msbuildLog! !__msbuildWrn! !__msbuildErr! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__BuildAgainstPackagesMsbuildArg% %__unprocessedBuildArgs% +call %__DotnetHost% msbuild %__ProjectDir%\tests\runtest.proj /p:RestoreAdditionalProjectSources=https://dotnet.myget.org/F/dotnet-core/ /p:BuildWrappers=true !__msbuildLog! !__msbuildWrn! !__msbuildErr! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__BuildAgainstPackagesMsbuildArg% %__unprocessedBuildArgs% if errorlevel 1 ( echo Xunit Wrapper build failed exit /b 1 diff --git a/src/coreclr/tests/dir.props b/src/coreclr/tests/dir.props index 5b07136..ffae126 100644 --- a/src/coreclr/tests/dir.props +++ b/src/coreclr/tests/dir.props @@ -8,6 +8,8 @@ $(OS) + + 1.0.0-rc3-20150510-01 diff --git a/src/coreclr/tests/dir.sdkbuild.props b/src/coreclr/tests/dir.sdkbuild.props index b5a0fdd..486e882 100644 --- a/src/coreclr/tests/dir.sdkbuild.props +++ b/src/coreclr/tests/dir.sdkbuild.props @@ -6,9 +6,13 @@ and buildtools projects should go in dir.common.props. --> - netcoreapp2.0 + netcoreapp3.0 + $(MicrosoftNETCoreRuntimeCoreCLRPackageVersion) false false + + + 99.0 diff --git a/src/coreclr/tests/override.targets b/src/coreclr/tests/override.targets index d4c07a0..a713489 100644 --- a/src/coreclr/tests/override.targets +++ b/src/coreclr/tests/override.targets @@ -18,6 +18,13 @@ + + + + + + + - - - - - - - - - - - - - - - parseBool = s => - { - bool value; - var success = bool.TryParse(s, out value); - if (success) - return value; - return false; - }; - var items = ArgumentItems.Select(i => new { Item=i, HasParam=parseBool(i.GetMetadata("HasParam"))}); - var noArg = items.Where(i => !i.HasParam).Select(i => new { Identity=i.Item.ItemSpec}); - var haveArg = items.Where(i => i.HasParam).Select(i => new { Identity=i.Item.ItemSpec, Name=i.Item.GetMetadata("ParamName")}); - ParamList = haveArg.Aggregate("", (s,i) => string.Format("{0} [-{1} {2}]", s, i.Identity, i.Name)) + - noArg.Aggregate("", (s,i) => string.Format("{0} [-{1}]", s, i.Identity)); - ]]> - - - + \ No newline at end of file diff --git a/src/coreclr/tests/src/Common/Directory.Build.targets b/src/coreclr/tests/src/Common/Directory.Build.targets new file mode 100644 index 0000000..09cfd7a --- /dev/null +++ b/src/coreclr/tests/src/Common/Directory.Build.targets @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/src/coreclr/tests/src/Directory.Build.props b/src/coreclr/tests/src/Directory.Build.props new file mode 100644 index 0000000..d462086 --- /dev/null +++ b/src/coreclr/tests/src/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/src/coreclr/tests/src/Directory.Build.targets b/src/coreclr/tests/src/Directory.Build.targets new file mode 100644 index 0000000..f3439a7 --- /dev/null +++ b/src/coreclr/tests/src/Directory.Build.targets @@ -0,0 +1,6 @@ + + + + diff --git a/src/coreclr/tests/src/dir.targets b/src/coreclr/tests/src/dir.targets index e6845e0..64f0d80 100644 --- a/src/coreclr/tests/src/dir.targets +++ b/src/coreclr/tests/src/dir.targets @@ -5,6 +5,11 @@ BuildAndRun 0 + + + + .exe + - + false <_WillCLRTestProjectBuild Condition="'$(_WillCLRTestProjectBuild)' == ''">false <_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != true">true <_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' != true And '$(BuildAllProjects)' == true And '$(CLRTestPriority)' <= '$(CLRTestPriorityToBuild)'">true - - - - - + + + + + + - - + @@ -193,8 +194,8 @@ $(SourceDir)Common\test_dependencies\obj\project.assets.json - - + + diff --git a/src/coreclr/tests/src/nobuild.targets b/src/coreclr/tests/src/nobuild.targets new file mode 100644 index 0000000..491865a --- /dev/null +++ b/src/coreclr/tests/src/nobuild.targets @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/coreclr/tests/src/runonly.targets b/src/coreclr/tests/src/runonly.targets new file mode 100644 index 0000000..2e01bc7 --- /dev/null +++ b/src/coreclr/tests/src/runonly.targets @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file -- 2.7.4