<PropertyGroup>
<MonoCrossDir Condition="'$(MonoCrossDir)' == '' and '$(ROOTFS_DIR)' != ''">$(ROOTFS_DIR)</MonoCrossDir>
<MonoEnableInterpreter Condition="'$(MonoEnableInterpreter)' == ''">false</MonoEnableInterpreter>
- <DotNetExec Condition="'$(OS)' == 'Windows_NT'">dotnet.exe</DotNetExec>
- <DotNetExec Condition="'$(DotNetExec)' == ''">dotnet</DotNetExec>
- <LocalDotnetDir>$(RepoRoot).dotnet</LocalDotnetDir>
- <LocalDotnet>$(LocalDotnetDir)\$(DotNetExec)</LocalDotnet>
- <LocalMonoDotnetDir>$(RepoRoot).dotnet-mono</LocalMonoDotnetDir>
- <LocalMonoDotnet>$(LocalMonoDotnetDir)\$(DotNetExec)</LocalMonoDotnet>
<ScriptExt Condition="'$(OS)' == 'Windows_NT'">.cmd</ScriptExt>
<ScriptExt Condition="'$(OS)' != 'Windows_NT'">.sh</ScriptExt>
<CoreClrFileName Condition="'$(TargetsWindows)' == 'true'">coreclr.dll</CoreClrFileName>
<Exec Command="$(_MonoBuildCommand)" IgnoreStandardErrorWarningFormat="true" />
</Target>
- <!-- Precompile (AssembliesToPrecompile) using (MonoExec) -->
- <Target Name="PrecompileAssembly">
- <PropertyGroup>
- <EnvVars Condition="'$(OS)' == 'Windows_NT'">set MONO_ENV_OPTIONS=--aot=mcpu=native & $(EnvVars)</EnvVars>
- <EnvVars Condition="'$(OS)' != 'Windows_NT'">export MONO_ENV_OPTIONS=--aot=mcpu=native && $(EnvVars)</EnvVars>
- </PropertyGroup>
- <Exec Command="$(EnvVars) $(MonoExec) %(AssembliesToPrecompile.Identity)" ContinueOnError="WarnAndContinue" />
- </Target>
-
- <!-- Precompile (AOT) managed libs in .dotnet-mono\shared\Microsoft.NETCore.App\**\*.dll -->
- <Target Name="PrecompileLocalMonoDotnetBcl" DependsOnTargets="PrepareLocalMonoDotnetBclForAot;PrecompileAssembly" />
- <Target Name="PrepareLocalMonoDotnetBclForAot" DependsOnTargets="PatchLocalMonoDotnet">
- <PropertyGroup>
- <MonoExec>$(LocalMonoDotnet)</MonoExec>
- </PropertyGroup>
- <ItemGroup>
- <AssembliesToPrecompile
- Include="$(LocalMonoDotnetDir)\shared\Microsoft.NETCore.App\**\*.dll"
- Exclude="$(LocalMonoDotnetDir)\shared\Microsoft.NETCore.App\**\System.Runtime.WindowsRuntime.dll" />
- </ItemGroup>
- </Target>
-
- <!-- Precompile (AOT) $(ArtifactsDir)bin\**\*Tests\**\System.*.dll -->
- <Target Name="PrecompileLibrariesTests" DependsOnTargets="PrepareLibrariesTestsForAot;PrecompileAssembly" />
- <Target Name="PrepareLibrariesTestsForAot" DependsOnTargets="PatchLibrariesTesthost">
- <PropertyGroup>
- <MonoExec>$(LibrariesTesthostRoot)$(DotNetExec)</MonoExec>
- </PropertyGroup>
- <ItemGroup>
- <AssembliesToPrecompile
- Include="$(ArtifactsDir)bin\**\*Tests\**\System.*.dll" />
- </ItemGroup>
- </Target>
-
- <!-- Precompile (AOT) $(ArtifactsDir)bin\**\*Tests\**\System.*.dll -->
- <Target Name="PrecompileTesthostLibraries" DependsOnTargets="PrepareTesthostLibrariesForAot;PrecompileAssembly" />
- <Target Name="PrepareTesthostLibrariesForAot" DependsOnTargets="PatchLibrariesTesthost">
- <PropertyGroup>
- <MonoExec>$(LibrariesTesthostRoot)$(DotNetExec)</MonoExec>
- </PropertyGroup>
- <ItemGroup>
- <AssembliesToPrecompile
- Include="$(LibrariesTesthostRuntimeDir)\System.*.dll" />
- </ItemGroup>
- </Target>
-
<!-- Copy Mono runtime bits to $(Destination) -->
<Target Name="CopyMonoRuntimeFilesFromArtifactsToDestination">
<ItemGroup>
<Message Text="Copying Mono Runtime artifacts from '$(BinDir)' to '$(Destination)'.'" Importance="High" />
<Copy SourceFiles="@(_MonoRuntimeArtifacts)"
DestinationFolder="$(Destination)"
- OverwriteReadOnlyFiles="true" />
- </Target>
-
- <Target Name="CloneLocalDotnet" DependsOnTargets="ValidateLocalDotnet">
- <ItemGroup>
- <_LocalDotnetFiles Include="$(LocalDotnetDir)\**\*.*" />
- </ItemGroup>
- <!-- copy .dotnet to .dotnet-mono if it doesn't exist -->
- <Copy SourceFiles="@(_LocalDotnetFiles)"
- DestinationFolder="$(LocalMonoDotnetDir)\%(RecursiveDir)"
+ OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="true" />
</Target>
- <!-- Copy Mono runtime bits to the local .dotnet-mono (clone of .dotnet) dir for local experiments (temp solution) -->
- <Target Name="PatchLocalMonoDotnet" DependsOnTargets="CloneLocalDotnet">
- <MSBuild Projects ="$(MSBuildProjectFullPath)"
- Properties="Destination=$([System.IO.Directory]::GetDirectories('$(LocalMonoDotnetDir)\shared\Microsoft.NETCore.App')[0])"
- Targets="CopyMonoRuntimeFilesFromArtifactsToDestination" />
- </Target>
-
<!-- Copy Mono runtime bits to the coreclr's Core_Root in order to run runtime tests -->
- <Target Name="PatchCoreClrCoreRoot" DependsOnTargets="ValidateLocalDotnet">
+ <Target Name="PatchCoreClrCoreRoot">
<MSBuild Projects="$(MSBuildProjectFullPath)"
Properties="Destination=$(CoreClrTestCoreRoot)"
Targets="CopyMonoRuntimeFilesFromArtifactsToDestination" />
</Target>
- <!-- Copy Mono runtime bits to the coreclr's Core_Root in order to run runtime tests -->
- <Target Name="PatchLibrariesTesthost" DependsOnTargets="ValidateLocalDotnet">
- <MSBuild Projects="$(MSBuildProjectFullPath)"
- Properties="Destination=$(LibrariesTesthostRuntimeDir)"
- Targets="CopyMonoRuntimeFilesFromArtifactsToDestination" />
- </Target>
-
<!-- Copy Coreclr runtime bits back to Core_Root -->
- <Target Name="RestoreCoreClrCoreRoot" DependsOnTargets="ValidateLocalDotnet">
+ <Target Name="RestoreCoreClrCoreRoot">
<Copy SourceFiles="$(CoreCLRArtifactsPath)\System.Private.CoreLib.dll"
DestinationFiles="$(CoreClrTestCoreRoot)\System.Private.CoreLib.dll" />
<Copy SourceFiles="$(CoreCLRArtifactsPath)\$(CoreClrFileName)"
DestinationFiles="$(CoreClrTestCoreRoot)\$(CoreClrFileName)" />
</Target>
- <!-- Run netcore\sample\HelloWorld sample using Mono Runtime -->
- <Target Name="RunSample" DependsOnTargets="PatchLocalMonoDotnet">
- <PropertyGroup>
- <SampleDir>$(MonoProjectRoot)netcore\sample\HelloWorld</SampleDir>
- <EnvVars Condition="'$(OS)' == 'Windows_NT'">set COMPlus_DebugWriteToStdErr=1 & $(EnvVars)</EnvVars>
- <EnvVars Condition="'$(OS)' != 'Windows_NT'">export COMPlus_DebugWriteToStdErr=1 && $(EnvVars)</EnvVars>
- </PropertyGroup>
- <Exec Command="$(EnvVars) $(LocalMonoDotnet) run -c $(Configuration) -p $(SampleDir)" />
- </Target>
-
<!-- Run CoreCLR runtime test using testhost -->
- <Target Name="RunCoreClrTest" DependsOnTargets="ValidateLocalDotnet;PatchCoreClrCoreRoot">
+ <Target Name="RunCoreClrTest" DependsOnTargets="PatchCoreClrCoreRoot">
<Error Condition="$(CoreClrTest) == ''" Text="'CoreClrTest' is not set. E.g. set it to `$(ArtifactsDir)tests/coreclr/$(TargetOS).$(Platform).$(CoreClrTestConfig)/JIT/opt/InstructionCombining/DivToMul/DivToMul$(ScriptExt)` in order to run DivToMul test." />
<Exec Command="$(CoreClrTest) -coreroot="$(CoreClrTestCoreRoot)""/>
</Target>
<!-- Run coreclr tests using runtest.py -->
- <Target Name="RunCoreClrTests" DependsOnTargets="ValidateLocalDotnet;PatchCoreClrCoreRoot">
+ <Target Name="RunCoreClrTests" DependsOnTargets="PatchCoreClrCoreRoot">
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="$(MonoProjectRoot)..\tests\run.cmd $(CoreClrTestConfig)" ContinueOnError="ErrorAndContinue" />
<Exec Condition="'$(OS)' != 'Windows_NT'" Command="$(MonoProjectRoot)../tests/run.sh $(CoreClrTestConfig)" ContinueOnError="ErrorAndContinue" />
</Target>
- <!-- Run Libraries tests using testhost -->
- <Target Name="RunLibrariesTest" DependsOnTargets="PatchLibrariesTesthost">
- <Error Condition="$(LibraryToTest) == ''" Text="LibraryToTest variable is not set" />
- <Error Condition="$(LibraryToTest.EndsWith('.Tests'))" Text="LibraryToTest should not end with .Tests, e.g. just 'System.Runtime'" />
- <MSBuild Projects="$(RepoRoot)src\libraries\$(LibraryToTest)\tests\$(LibraryToTest).Tests.csproj"
- Properties="Configuration=$(LibrariesTestConfig)" Targets="Test" />
- </Target>
-
- <Target Name="RunBenchmarks" DependsOnTargets="PatchLocalMonoDotnet">
- <Error Condition="$(BenchmarksRepo) == ''" Text="BenchmarksRepo variable is not set" />
- <Exec WorkingDirectory="$(BenchmarksRepo)\src\benchmarks\micro" Command="$(LocalDotnet) run -c Release -f $(NetCoreAppCurrent) --cli $(LocalMonoDotnet)" />
- </Target>
-
- <Target Name="ValidateLocalDotnet">
- <Error Condition="$([System.IO.Directory]::GetDirectories('$(LocalDotnetDir)\shared\Microsoft.NETCore.App').Length) > 1" Text="$(LocalDotnetDir) contains more than one SDK, please delete unused ones." />
- <Error Condition="Exists('$(LocalMonoDotnetDir)') AND $([System.IO.Directory]::GetDirectories('$(LocalMonoDotnetDir)\shared\Microsoft.NETCore.App').Length) > 1" Text="$(LocalMonoDotnetDir) contains more than one SDK, please delete unused ones." />
- <Error Condition="!Exists('$(LocalDotnet)')" Text="'$(LocalDotnet)' doesn't exist." />
- </Target>
-
<Target Name="BuildMonoRuntimeCMake" Condition="'$(MonoEnableCMake)' == 'true'">
<Exec Command="which ninja" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true">
<Output TaskParameter="ExitCode" PropertyName="MonoNinjaFound"/>
endif
DOTNET := $(shell bash init-tools.sh | tail -1)
-# DOTNET_MONO is a copy of DOTNET (local .dotnet) with Mono Runtime bits (see patch-mono-dotnet rule)
-DOTNET_MONO = ../../../.dotnet-mono/dotnet
LIBRARIES_TESTS_CONFIG=Release
CORECLR_TESTS_CONFIG=Release
# run sample using local .dotnet-mono
# build it with .dotnet first in order to be able to use LLVM only for the actual sample
-run-sample: patch-mono-dotnet
- $(DOTNET) build -c Release sample/HelloWorld
- MONO_ENV_OPTIONS="--llvm" COMPlus_DebugWriteToStdErr=1 \
- $(DOTNET_MONO) sample/HelloWorld/bin/HelloWorld.dll
+run-sample:
+ make run -C sample/HelloWorld
# run sample using local .dotnet (coreclr)
run-sample-coreclr:
- $(DOTNET) run -c Debug -p sample/HelloWorld
+ $(DOTNET) run -c Release -p sample/HelloWorld
# build System.Private.CoreLib.dll
bcl corelib:
runtime:
../../.././build.sh -c $(MONO_RUNTIME_CONFIG) -subset Mono.Runtime
-# call it if you want to use $(DOTNET_MONO) in this Makefile
-patch-mono-dotnet:
- $(DOTNET) msbuild /t:PatchLocalMonoDotnet $(MONO_PROJ)
-
-# precompile (AOT) managed libs in .dotnet-mono
-patch-mono-dotnet-aot:
- $(DOTNET) msbuild /t:PrecompileLocalMonoDotnetBcl $(MONO_PROJ)
-
# copy mono runtime bits from artifacts to $(DST)
copy-runtime-files-to:
$(DOTNET) msbuild /t:CopyMonoRuntimeFilesFromArtifactsToDestination /p:Destination=$(DST) $(MONO_PROJ)
# make run-tests-corefx-System.Runtime
# for `System.Runtime.Tests` (the rule builds both the lib and the test if needed)
run-tests-corefx-%:
- $(DOTNET) msbuild /t:RunLibrariesTest /p:LibraryToTest=$* $(MONO_PROJ)
-
-# precompile (AOT) all libraries' tests
-aot-tests-corefx:
- $(DOTNET) msbuild /t:PrecompileLibrariesTests $(MONO_PROJ)
-
-# precompile (AOT) all libraries inside testhost (it's used for libraries' tests)
-aot-testhost-corefx:
- $(DOTNET) msbuild /t:PrecompileTesthostLibraries $(MONO_PROJ)
+ $(DOTNET) build ../../../src/libraries/$*/tests -c $(LIBRARIES_TESTS_CONFIG) /p:RuntimeFlavor=mono /t:Test
-# run 'dotnet/performance' benchmarks
-# e.g. 'make run-benchmarks BenchmarksRepo=/prj/performance'
-# you can append BDN parameters at the end, e.g. ` -- --filter Burgers --keepFiles`
-run-benchmarks: patch-local-dotnet
- $(DOTNET) msbuild /t:RunBenchmarks /p:BenchmarksRepo=$(BenchmarksRepo)