<DotNetExec Condition="'$(DotNetExec)' == ''">dotnet</DotNetExec>
<LocalDotnetDir>..\..\.dotnet</LocalDotnetDir>
<LocalDotnet>$(LocalDotnetDir)\$(DotNetExec)</LocalDotnet>
+ <LocalMonoDotnetDir>..\..\.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="msvc\run-msbuild.bat build $(_MonoBuildPlatform) $(Configuration) sgen "$(_MonoBuildParams)" msvc\mono-netcore.sln" IgnoreStandardErrorWarningFormat="true" />
</Target>
+ <Target Name="BuildCoreLib">
+ <MSBuild Projects="$(MonoProjectRoot)netcore\System.Private.CoreLib\System.Private.CoreLib.csproj"
+ Properties="Configuration=$(Configuration)"
+ Targets="Build" />
+ </Target>
+
<!-- General targets -->
<Target Name="Build" DependsOnTargets="BuildMonoRuntimeUnix;BuildMonoRuntimeWindows">
<PropertyGroup>
<Target Name="Test" />
- <!-- Copy Mono runtime bits to the local .dotnet dir for local experiments (temp solution) -->
- <Target Name="PatchLocalDotnet" DependsOnTargets="ValidateLocalDotnet">
- <PropertyGroup>
- <LocalDotnetRuntimeDir>$([System.IO.Directory]::GetDirectories("$(LocalDotnetDir)\shared\Microsoft.NETCore.App")[0])</LocalDotnetRuntimeDir>
- </PropertyGroup>
+ <!-- Copy Mono runtime bits to the local .dotnet-mono (clone of .dotnet) dir for local experiments (temp solution) -->
+ <Target Name="PatchLocalMonoDotnet" DependsOnTargets="ValidateLocalDotnet">
<ItemGroup>
+ <_LocalDotnetFiles Include="$(LocalDotnetDir)\**\*.*" />
<_MonoRuntimeArtifacts Include="$(BinDir)\*.*" />
</ItemGroup>
- <Copy SourceFiles="$(_MonoRuntimeArtifacts)"
- DestinationFolder="$(LocalDotnetRuntimeDir)"
+ <Error Condition="@(_MonoRuntimeArtifacts->Count()) < 2" Text="Mono artifacts were not found at $(BinDir)" />
+ <!-- copy .dotnet to .dotnet-mono if it doesn't exist -->
+ <Copy SourceFiles="@(_LocalDotnetFiles)"
+ DestinationFolder="$(LocalMonoDotnetDir)\%(RecursiveDir)"
SkipUnchangedFiles="true" />
- </Target>
-
- <!-- Copy Coreclr runtime bits to the local .dotnet dir -->
- <Target Name="RestoreLocalDotnet" DependsOnTargets="ValidateLocalDotnet">
- <Copy SourceFiles="$(CoreCLRArtifactsPath)\System.Private.CoreLib.dll"
- DestinationFiles="$(LocalDotnetRuntimeDir)\System.Private.CoreLib.dll" />
- <Copy SourceFiles="$(CoreCLRArtifactsPath)\$(_CoreClrFileName)"
- DestinationFiles="$(LocalDotnetRuntimeDir)\$(_CoreClrFileName)" />
+ <Copy SourceFiles="@(_MonoRuntimeArtifacts)"
+ DestinationFolder="$([System.IO.Directory]::GetDirectories('$(LocalMonoDotnetDir)\shared\Microsoft.NETCore.App')[0])" />
</Target>
<!-- Copy Mono runtime bits to the coreclr's Core_Root in order to run runtime tests -->
<ItemGroup>
<_MonoRuntimeArtifacts Include="$(BinDir)\*.*" />
</ItemGroup>
+ <Error Condition="@(_MonoRuntimeArtifacts->Count()) < 2" Text="Mono artifacts were not found at $(BinDir)" />
<Copy SourceFiles="@(_MonoRuntimeArtifacts)"
- DestinationFolder="$(CoreClrTestCoreRoot)"
- SkipUnchangedFiles="true"/>
+ DestinationFolder="$(CoreClrTestCoreRoot)" />
</Target>
<!-- Copy Coreclr runtime bits back to Core_Root -->
</Target>
<!-- Run netcore\sample\HelloWorld sample using Mono Runtime -->
- <Target Name="RunSample" DependsOnTargets="PatchLocalDotnet">
- <Exec Command="$(LocalDotnet) run -c Release -f $(NetCoreAppCurrent) -p $(MonoProjectRoot)netcore\sample\HelloWorld" />
+ <Target Name="RunSample" DependsOnTargets="PatchLocalMonoDotnet">
+ <PropertyGroup>
+ <EnvVars Condition="'$(OS)' != 'Windows_NT'"><![CDATA[
+ COMPlus_DebugWriteToStdErr=1 \
+ MONO_ENV_OPTIONS="" \
+ ]]>
+ </EnvVars>
+ </PropertyGroup>
+ <Exec Condition="'$(OS)' == 'Windows_NT'" Command="$(EnvVars) $(LocalMonoDotnet) run -c $(Configuration) -p $(MonoProjectRoot)netcore/sample/HelloWorld" />
+ <Exec Condition="'$(OS)' != 'Windows_NT'" Command="$(EnvVars) $(LocalMonoDotnet) run -c $(Configuration) -p $(MonoProjectRoot)netcore\sample\HelloWorld" />
</Target>
<!-- Run CoreCLR runtime test using testhost -->
<Exec Command="$(CoreClrTest) -coreroot="$(CoreClrTestCoreRoot)""/>
</Target>
- <!-- Make sure coreclr tests are built (in $(CoreClrTestConfig) configuration), e.g.
- *nix: `cd ../coreclr && ./build.sh -release && ./build-testh.sh -release`
- Windows: `cd ../coreclr && build.cmd -release` -->
+ <!-- Run coreclr tests using runtest.py -->
<Target Name="RunCoreClrTests" DependsOnTargets="ValidateLocalDotnet;PatchCoreClrCoreRoot">
- <ItemGroup>
- <CoreClrTests Include="$(ArtifactsDir)tests\coreclr\$(OSGroup).$(Platform).$(CoreClrTestConfig)\**\*$(ScriptExt)" />
- </ItemGroup>
- <Exec Condition="'$(OS)' == 'Windows_NT'" Command=""%(CoreClrTests.Identity)" -coreroot "$(CoreClrTestCoreRoot)"" ContinueOnError="WarnAndContinue" />
- <Exec Condition="'$(OS)' != 'Windows_NT'" Command="bash "%(CoreClrTests.Identity)" -coreroot="$(CoreClrTestCoreRoot)"" ContinueOnError="WarnAndContinue" />
- </Target>
-
- <!-- Show summary for coreclr tests -->
- <Target Name="CoreClrTestsSummary">
- <Exec Command="python $(MonoProjectRoot)..\coreclr\tests\runtest.py --analyze_results_only -test_location $(ArtifactsDir)tests\coreclr\$(OSGroup).$(Platform).$(CoreClrTestConfig) -build_type $(CoreClrTestConfig)" />
+ <Exec Condition="'$(OS)' == 'Windows_NT'" Command="$(MonoProjectRoot)..\coreclr\tests\runtest.cmd $(CoreClrTestConfig)" ContinueOnError="ErrorAndContinue" />
+ <Exec Condition="'$(OS)' != 'Windows_NT'" Command="$(MonoProjectRoot)../coreclr/tests/./runtest.sh $(CoreClrTestConfig)" ContinueOnError="ErrorAndContinue" />
</Target>
- <Target Name="RunBenchmarks">
+ <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 $(LocalDotnet)" />
+ <Exec WorkingDirectory="$(BenchmarksRepo)\src\benchmarks\micro" Command="$(LocalDotnet) run -c Release -f $(NetCoreAppCurrent) --cli $(LocalMonoDotnet)" />
</Target>
<Target Name="ValidateLocalDotnet">
-DOTNET=../../../.dotnet/dotnet
+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
-# run sample using local .dotnet (will be patched with Mono Runtime)
-run-sample:
- $(DOTNET) msbuild /t:RunSample ../mono.proj
+CORECLR_TESTS_CONFIG=Release
+MONO_RUNTIME_CONFIG=Release
+
+# auto detect configurations for mono runtime and coreclr tests
+ifeq ($(words $(wildcard ../../../artifacts/bin/mono/*.*.*)), 1)
+ MONO_RUNTIME_CONFIG := $(word 3,$(subst ., ,$(notdir $(wildcard ../../../artifacts/bin/mono/*.*.*))))
+endif
+
+ifeq ($(words $(wildcard ../../../artifacts/tests/coreclr/*.*.*)), 1)
+ CORECLR_TESTS_CONFIG := $(word 3,$(subst ., ,$(notdir $(wildcard ../../../artifacts/tests/coreclr/*.*.*))))
+endif
+
+MONO_PROJ=/p:CoreClrTestConfig=$(CORECLR_TESTS_CONFIG) /p:Configuration=$(MONO_RUNTIME_CONFIG) ../mono.proj
+
+# run sample using local .dotnet-mono
+run-sample: patch-mono-dotnet
+ COMPlus_DebugWriteToStdErr=1 $(DOTNET_MONO) run -c Debug -p sample/HelloWorld
-# run sample using dotnet from PATH
run-sample-coreclr:
- dotnet run -c Release -p sample/HelloWorld -f netcoreapp3.1
+ $(DOTNET) run -c Debug -p sample/HelloWorld
-runtime:
- $(DOTNET) msbuild /t:Build ../mono.proj
+bcl corelib:
+ $(DOTNET) msbuild /t:BuildCoreLib $(MONO_PROJ)
-# temp: makes $(DOTNET) to use mono runtime (to run real-world apps using '$(DOTNET) run')
-patch-local-dotnet:
- $(DOTNET) msbuild /t:PatchLocalDotnet ../mono.proj
+runtime:
+ $(DOTNET) msbuild /t:Build $(MONO_PROJ)
-restore-local-dotnet:
- $(DOTNET) msbuild /t:RestoreLocalDotnet ../mono.proj
+# call it if you want to use $(DOTNET_MONO) in this Makefile
+patch-mono-dotnet:
+ $(DOTNET) msbuild /t:PatchLocalMonoDotnet $(MONO_PROJ)
# run specific coreclr test, e.g.:
-# make run-tests-coreclr CoreClrTest="bash ../../artifacts/tests/coreclr/OSX.x64.Checked/JIT/opt/InstructionCombining/DivToMul/DivToMul.sh"
+# make run-tests-coreclr CoreClrTest="bash ../../artifacts/tests/coreclr/OSX.x64.Release/JIT/opt/InstructionCombining/DivToMul/DivToMul.sh"
run-tests-coreclr:
- $(DOTNET) msbuild /t:RunCoreClrTest /p:CoreClrTest="$(CoreClrTest)" ../mono.proj
+ $(DOTNET) msbuild /t:RunCoreClrTest /p:CoreClrTest="$(CoreClrTest)" $(MONO_PROJ)
# run all coreclr tests
run-tests-coreclr-all:
- $(DOTNET) msbuild /t:RunCoreClrTests ../mono.proj
-
-# show summary for coreclr tests
-tests-coreclr-summary:
- $(DOTNET) msbuild /t:CoreClrTestsSummary ../mono.proj
+ $(DOTNET) msbuild /t:RunCoreClrTests $(MONO_PROJ)
# 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)
\ No newline at end of file
+ $(DOTNET) msbuild /t:RunBenchmarks /p:BenchmarksRepo=$(BenchmarksRepo)