Skip to content

Commit

Permalink
Use dotnet MSBuild for tests (dotnet#19324)
Browse files Browse the repository at this point in the history
* Revert "Revert "Build managed tests with dotnet (dotnet#19254)""
* Reenable MSBuild support through dotnet instead of global MSBuild
  • Loading branch information
AaronRobinsonMSFT authored Aug 8, 2018
1 parent c488296 commit b4131b9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions build-test.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,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:CLRTestPriorityToBuild=%__Priority%"
)

if defined __BuildAgainstPackagesArg (
if not defined __RuntimeID (
Expand All @@ -120,7 +123,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 test build

Expand Down Expand Up @@ -317,10 +320,9 @@ for /l %%G in (1, 1, %__BuildLoopCount%) do (
set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%";Append=!__AppendToLog!
set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%";Append=!__AppendToLog!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%";Append=!__AppendToLog!
set __Logging=-MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr!

set TestBuildSlice=%%G
call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj !__Logging! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__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:
Expand Down
4 changes: 2 additions & 2 deletions tests/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
</Target>

<Target Name="RestorePackage">
<Exec Condition="'$(RunningOnCore)' == 'false'" Command="$(DotnetRestoreCommand) $(RestoreProj) $(PackageVersionArg)" StandardOutputImportance="Low" />
<Exec Condition="'$(RunningOnCore)' == 'true'" Command="$(DotnetRestoreCommand) -r $(__DistroRid) $(RestoreProj) $(PackageVersionArg)" StandardOutputImportance="Low" />
<Exec Condition="'$(__DistroRid)' == ''" Command="$(DotnetRestoreCommand) $(RestoreProj) $(PackageVersionArg)" StandardOutputImportance="Low" />
<Exec Condition="'$(__DistroRid)' != ''" Command="$(DotnetRestoreCommand) -r $(__DistroRid) $(RestoreProj) $(PackageVersionArg)" StandardOutputImportance="Low" />
</Target>

<!-- Override RestorePackages from dir.traversal.targets and do a batch restore -->
Expand Down
1 change: 1 addition & 0 deletions tests/dir.sdkbuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<RuntimeFrameworkVersion>$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Platform>AnyCPU</Platform>

<!-- Force the CLI to allow us to target higher netcoreapp than it may know about -->
<NETCoreAppMaximumVersion>99.0</NETCoreAppMaximumVersion>
Expand Down
4 changes: 2 additions & 2 deletions tests/src/dir.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />

<Import Project="..\dir.common.props" />
<Import Project="..\dir.common.props" Condition="'$(UsingMicrosoftNETSdk)' != 'true'" />

<!-- Setup Default symbol and optimization for Configuration -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
Expand Down Expand Up @@ -37,7 +37,7 @@
<BaseOutputPath Condition="'$(__TestRootDir)' != ''">$(__TestRootDir)</BaseOutputPath>
<BaseOutputPathWithConfig>$(BaseOutputPath)\$(OSPlatformConfig)\</BaseOutputPathWithConfig>
<BinDir>$(BaseOutputPathWithConfig)</BinDir>
<BaseIntermediateOutputPath>$(ProjectDir)\..\bin\tests\obj\$(OSPlatformConfig)\Managed\</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath>$(ProjectDir)..\bin\tests\obj\$(OSPlatformConfig)\Managed\</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath Condition="'$(__ManagedTestIntermediatesDir)' != ''">$(__ManagedTestIntermediatesDir)\</BaseIntermediateOutputPath>
<__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == ''">$([System.IO.Path]::GetFullPath($(BaseOutputPathWithConfig)..\obj\$(BuildOS).$(Platform).$(Configuration)\Native\))</__NativeTestIntermediatesDir>
<BuildProjectRelativeDir>$(MSBuildProjectName)\</BuildProjectRelativeDir>
Expand Down

0 comments on commit b4131b9

Please sign in to comment.