forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mono] Improve mono.proj, auto-detect build configurations (dotnet#31739
) * Auto-detect build configuration in Makefile * Improve RunCoreClrTests target * Clone .dotnet to .dotnet-mono * Implement Console
- Loading branch information
Showing
7 changed files
with
95 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ syntax: glob | |
|
||
# Tool Runtime Dir | ||
.dotnet/ | ||
.dotnet-mono/ | ||
.packages/ | ||
.tools/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,49 @@ | ||
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) | ||
$(DOTNET) msbuild /t:RunBenchmarks /p:BenchmarksRepo=$(BenchmarksRepo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/mono/netcore/System.Private.CoreLib/src/Mono/Console.Mono.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace Internal | ||
{ | ||
// Some CoreCLR tests use it for internal printf-style debugging in System.Private.CoreLib | ||
public static class Console | ||
{ | ||
public static void Write(string? s) => DebugProvider.WriteCore(s); | ||
|
||
public static void WriteLine(string? s) => Write(s + Environment.NewLineConst); | ||
|
||
public static void WriteLine() => Write(Environment.NewLineConst); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# always ignore system dotnet | ||
export use_installed_dotnet_cli=false | ||
. "../../../eng/common/tools.sh" | ||
InitializeDotNetCli true | ||
which dotnet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters