From 101baee1010eaad47cd7afd1e041a7f422aefa78 Mon Sep 17 00:00:00 2001 From: Chris Sienkiewicz Date: Fri, 3 Aug 2018 10:11:32 -0700 Subject: [PATCH] Build managed tests with dotnet (#19254) * Change managed projects to build with dotnet msbuild, rather than desktop msbuild * Build sdk tests as AnyCPU * Correct args passed through to dotnet for tests * Remove extra backslash from baseIntermediateOutputPath that was causing individual test exe builds to fail * Fix double import warning for sdk projects * Add default params from config.json to build-test dotnet invocations * Fix priority argument passing from the command line for tests --- build-test.cmd | 9 ++++++--- tests/build.proj | 4 ++-- tests/dir.sdkbuild.props | 1 + tests/src/dir.props | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/build-test.cmd b/build-test.cmd index 38c97b59d035..b278996676f6 100644 --- a/build-test.cmd +++ b/build-test.cmd @@ -104,7 +104,10 @@ if [!processedArgs!]==[] ( :ArgsDone @REM Special handling for -priority=N argument. -if %__Priority% GTR 0 (set "__PriorityArg=-priority=%__Priority%") +if %__Priority% GTR 0 ( + set "__PriorityArg=-priority=%__Priority%" + set "__PriorityMsbuildArg=/p:priority=%__Priority%" +) if defined __BuildAgainstPackagesArg ( if not defined __RuntimeID ( @@ -117,7 +120,7 @@ if defined __BuildAgainstPackagesArg ( set __RunArgs=-BuildOS=%__BuildOS% -BuildType=%__BuildType% -BuildArch=%__BuildArch% REM As we move from buildtools to arcade, __RunArgs should be replaced with __msbuildArgs -set __msbuildArgs=/p:__BuildOS=%__BuildOS% /p:__BuildType=%__BuildType% /p:__BuildArch=%__BuildArch% +set __msbuildArgs=/p:__BuildOS=%__BuildOS% /p:__BuildType=%__BuildType% /p:__BuildArch=%__BuildArch% /nologo /verbosity:minimal /clp:Summary echo %__MsgPrefix%Commencing CoreCLR repo test build @@ -299,7 +302,7 @@ for /l %%G in (1, 1, %__BuildLoopCount%) do ( set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%";Append=!__AppendToLog! set TestBuildSlice=%%G - call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs% + call %__DotnetHost% msbuild %__ProjectDir%\tests\build.proj !__msbuildLog! !__msbuildWrn! !__msbuildErr! %__msbuildArgs% %__BuildAgainstPackagesMsbuildArg% %__PriorityMsbuildArg% %__PassThroughArg% %__unprocessedBuildArgs% if errorlevel 1 ( echo %__MsgPrefix%Error: build failed. Refer to the build log files for details: diff --git a/tests/build.proj b/tests/build.proj index a421b130b605..6bdc8690bfa0 100644 --- a/tests/build.proj +++ b/tests/build.proj @@ -51,8 +51,8 @@ - - + + diff --git a/tests/dir.sdkbuild.props b/tests/dir.sdkbuild.props index c4cc31ec9f90..bc5bed9b3fbf 100644 --- a/tests/dir.sdkbuild.props +++ b/tests/dir.sdkbuild.props @@ -10,6 +10,7 @@ $(MicrosoftNETCoreAppPackageVersion) false false + AnyCPU 99.0 diff --git a/tests/src/dir.props b/tests/src/dir.props index 27300734357f..c5cc702882df 100644 --- a/tests/src/dir.props +++ b/tests/src/dir.props @@ -1,7 +1,7 @@ - + @@ -37,7 +37,7 @@ $(__TestRootDir) $(BaseOutputPath)\$(OSPlatformConfig)\ $(BaseOutputPathWithConfig) - $(ProjectDir)\..\bin\tests\obj\$(OSPlatformConfig)\Managed\ + $(ProjectDir)..\bin\tests\obj\$(OSPlatformConfig)\Managed\ $(__ManagedTestIntermediatesDir)\ <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == ''">$([System.IO.Path]::GetFullPath($(BaseOutputPathWithConfig)..\obj\$(BuildOS).$(Platform).$(Configuration)\Native\)) $(MSBuildProjectName)\