[interp] Reduce computation under calc_section mutex
[mono-project.git] / netcore / Makefile
blob22d580a298eaced8a2aaeb873e393c3babe39d6a
1 ifneq ($(wildcard config.make),)
3 include config.make
6 # NETCORETESTS_VERSION and NETCOREAPP_VERSION must be updated in sync, we are using coreclr repo for that but that's fine for now
9 # Extracted MicrosoftPrivateCoreFxNETCoreAppVersion from https://github.com/dotnet/coreclr/blob/master/eng/Versions.props#L21
10 NETCORETESTS_VERSION := 4.6.0-preview7.19305.1
12 # Extracted MicrosoftNETCoreAppVersion from https://github.com/dotnet/coreclr/blob/master/eng/Versions.props#L25
13 NETCOREAPP_VERSION := 3.0.0-preview7-27804-03
15 # Extracted from https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/master/latest.version
16 ASPNETCOREAPP_VERSION := 3.0.0-preview-18614-0151
18 ROSLYN_VERSION := 3.2.0-beta3-19310-04
20 ifeq ($(HOST_PLATFORM),win32)
21 PLATFORM_AOT_SUFFIX := .dll
22 PLATFORM_AOT_PREFIX :=
23 NETCORESDK_EXT = zip
24 UNZIPCMD = python -c "import zipfile,sys; zipfile.ZipFile(sys.argv[1], 'r').extractall()"
25 XUNIT_FLAGS = -notrait category=nonwindowstests
26 TESTS_PLATFORM = Windows_NT.x64
27 ON_RUNTIME_EXTRACT = chmod -R 755 {host,shared,./dotnet}
28 DOTNET := $(shell powershell -ExecutionPolicy Bypass -Command "./init-tools.ps1")/dotnet.exe
29 DOTNET := "$(subst \,/,$(DOTNET))"
30 endif
32 ifeq ($(HOST_PLATFORM),macos)
33 PLATFORM_AOT_SUFFIX := .dylib
34 PLATFORM_AOT_PREFIX := lib
35 NETCORESDK_EXT = tar.gz
36 UNZIPCMD = tar -xvf
37 XUNIT_FLAGS = -notrait category=nonosxtests
38 TESTS_PLATFORM = OSX.x64
39 DOTNET := $(shell ./init-tools.sh | tail -1)
40 endif
42 ifeq ($(HOST_PLATFORM),linux)
43 PLATFORM_AOT_SUFFIX := .so
44 PLATFORM_AOT_PREFIX := lib
45 NETCORESDK_EXT = tar.gz
46 UNZIPCMD = tar -xvf
47 XUNIT_FLAGS = -notrait category=nonlinuxtests @../../../../CoreFX.issues_linux.rsp
48 TESTS_PLATFORM = Linux.x64
49 DOTNET := $(shell ./init-tools.sh | tail -1)
50 endif
52 NETCORESDK_FILE := dotnet-runtime-$(NETCOREAPP_VERSION)-$(RID).$(NETCORESDK_EXT)
53 ASPNETCORESDK_FILE := aspnetcore-runtime-$(ASPNETCOREAPP_VERSION)-$(RID).$(NETCORESDK_EXT)
54 NETCORE_URL := https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$(NETCOREAPP_VERSION)/$(NETCORESDK_FILE)
55 ASPNETCORE_URL := https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/$(ASPNETCOREAPP_VERSION)/$(ASPNETCORESDK_FILE)
56 FEED_BASE_URL := https://dotnetfeed.blob.core.windows.net/dotnet-core
57 TEST_ASSETS_URL = $(FEED_BASE_URL)/corefx-tests/$(NETCORETESTS_VERSION)/$(TESTS_PLATFORM)/netcoreapp/corefx-test-assets.xml
59 # used to calculate exact version number for generating nupkg
60 BLAME = $(shell git blame ../configure.ac | grep AC_INIT | cut -f1 -d' ')
61 VERSTUB = .$(shell git rev-list --count $(BLAME)..HEAD)
63 all: bcl
65 $(NETCORESDK_FILE):
66 curl $(NETCORE_URL) --output $(NETCORESDK_FILE)
67 rm -rf shared/Microsoft.NETCore.App
68 $(UNZIPCMD) $(NETCORESDK_FILE)
69 $(ON_RUNTIME_EXTRACT)
71 # AspNetCoreApp contains its own .NET Core Runtime but we don't need it so let's remove it
72 # and update version in Microsoft.AspNetCore.App.runtimeconfig.json to NETCOREAPP_VERSION
73 $(ASPNETCORESDK_FILE):
74 curl $(ASPNETCORE_URL) --output $(ASPNETCORESDK_FILE)
75 $(UNZIPCMD) $(ASPNETCORESDK_FILE)
76 sed -e 's/.*version.*/\"version\": \"$(NETCOREAPP_VERSION)\"/' < shared/Microsoft.AspNetCore.App/$(ASPNETCOREAPP_VERSION)/Microsoft.AspNetCore.App.runtimeconfig.json > 2 && mv 2 shared/Microsoft.AspNetCore.App/$(ASPNETCOREAPP_VERSION)/Microsoft.AspNetCore.App.runtimeconfig.json
78 update-corefx: corefx/.stamp-dl-corefx-$(NETCORETESTS_VERSION)
80 corefx/.stamp-dl-corefx-$(NETCORETESTS_VERSION): corefx-restore.csproj
81 $(DOTNET) build corefx-restore.csproj --runtime $(RID) --packages corefx/packages -p:MicrosoftPrivateCoreFxNETCoreAppVersion=$(NETCORETESTS_VERSION) -p:OutputPath=corefx/restore/
82 touch $@
84 update-roslyn: roslyn-restore.csproj
85 $(DOTNET) restore roslyn-restore.csproj -p:RoslynVersion=$(ROSLYN_VERSION) --packages roslyn/packages -p:OutputPath=roslyn/restore/
87 run-sample: prepare
88 $(DOTNET) build sample/HelloWorld
89 MONO_ENV_OPTIONS="--debug" COMPlus_DebugWriteToStdErr=1 ./dotnet --fx-version "$(NETCOREAPP_VERSION)" sample/HelloWorld/bin/netcoreapp3.0/HelloWorld.dll
91 run-aspnet-sample: prepare
92 rm -rf sample/AspNetCore/{bin,obj}
93 $(DOTNET) publish sample/AspNetCore -c Debug -r $(RID)
94 cp ../mono/mini/.libs/libmonosgen-2.0$(PLATFORM_AOT_SUFFIX) sample/AspNetCore/bin/Debug/netcoreapp3.0/$(RID)/publish/$(PLATFORM_AOT_PREFIX)coreclr$(PLATFORM_AOT_SUFFIX)
95 cp System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.dll sample/AspNetCore/bin/Debug/netcoreapp3.0/$(RID)/publish/
96 COMPlus_DebugWriteToStdErr=1 ./dotnet --fx-version "$(ASPNETCOREAPP_VERSION)" sample/AspNetCore/bin/Debug/netcoreapp3.0/$(RID)/publish/AspNetCore.dll
98 # COREHOST_TRACE=1
99 SHAREDRUNTIME := shared/Microsoft.NETCore.App/$(NETCOREAPP_VERSION)
101 System.Private.CoreLib/src/System/Environment.Mono.cs: System.Private.CoreLib/src/System/Environment.Mono.in
102 test -n '$(MONO_CORLIB_VERSION)'
103 sed -e 's,@''MONO_CORLIB_VERSION@,$(MONO_CORLIB_VERSION),' $< > $@
105 bcl: update-roslyn System.Private.CoreLib/src/System/Environment.Mono.cs
106 $(DOTNET) build $(CORETARGETS) $(CORLIB_BUILD_FLAGS) -p:BuildArch=$(COREARCH) \
107 -p:OutputPath=bin/$(COREARCH) \
108 -p:RoslynPropsFile="../roslyn/packages/microsoft.net.compilers.toolset/$(ROSLYN_VERSION)/build/Microsoft.Net.Compilers.Toolset.props" \
109 System.Private.CoreLib/System.Private.CoreLib.csproj
111 debug-bcl:
112 $(MAKE) bcl CORLIB_BUILD_FLAGS="-c Debug"
114 runtime:
115 $(MAKE) -C ../mono
117 link-mono:
118 cp ../mono/mini/.libs/libmonosgen-2.0$(PLATFORM_AOT_SUFFIX) $(SHAREDRUNTIME)/$(PLATFORM_AOT_PREFIX)coreclr$(PLATFORM_AOT_SUFFIX)
119 cp System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.dll $(SHAREDRUNTIME)
120 cp System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.pdb $(SHAREDRUNTIME)
122 prepare: $(ASPNETCORESDK_FILE) $(NETCORESDK_FILE) update-corefx update-roslyn link-mono
124 nupkg:
125 $(DOTNET) pack roslyn-restore.csproj -p:NuspecFile=runtime.nuspec -p:NuspecProperties=\"RID=$(RID)\;VERSION=$(VERSION)$(VERSTUB)\;PLATFORM_AOT_SUFFIX=$(PLATFORM_AOT_SUFFIX)\;COREARCH=$(COREARCH)\;PLATFORM_AOT_PREFIX=$(PLATFORM_AOT_PREFIX)\" --output ../artifacts/ --no-build
126 $(DOTNET) pack roslyn-restore.csproj -p:NuspecFile=metapackage.nuspec -p:NuspecProperties=\"RID=$(RID)\;VERSION=$(VERSION)$(VERSTUB)\;PLATFORM_AOT_SUFFIX=$(PLATFORM_AOT_SUFFIX)\;COREARCH=$(COREARCH)\;PLATFORM_AOT_PREFIX=$(PLATFORM_AOT_PREFIX)\" --output ../artifacts/ --no-build
128 clean:
129 rm -rf .configured ../.dotnet sdk shared host dotnet tests obj corefx roslyn LICENSE.txt ThirdPartyNotices.txt $(NETCORESDK_FILE) $(ASPNETCORESDK_FILE)
132 update-tests-corefx: corefx/.stamp-dl-corefx-tests-$(NETCORETESTS_VERSION)
134 corefx/.stamp-dl-corefx-tests-$(NETCORETESTS_VERSION):
135 curl $(TEST_ASSETS_URL) --output corefx-test-assets.xml
136 python dl-test-assets.py corefx-test-assets.xml $(FEED_BASE_URL) corefx/tests
137 touch $@
140 # Running CoreFX tests
142 # You can run either individual test assembly or run all CoreFX tests. The tests are automatically downloaded
143 # from the shared location and built locally.
145 # Running all test: `make run-tests-corefx`
147 # Running individual test: MONO_ENV_OPTIONS="--debug" make run-tests-corefx-System.Collections.Tests
150 run-tests-corefx: update-tests-corefx
151 for testdir in corefx/tests/extracted/*; do \
152 $(MAKE) run-tests-corefx-$$(basename $${testdir}); \
153 done; \
154 $(MAKE) xunit-summary
156 run-tests-corefx-%: prepare update-tests-corefx
157 echo -n "***************** $* *********************"
158 cp corefx/restore/corefx-restore.deps.json corefx/tests/extracted/$*/xunit.console.deps.json
159 cp corefx/restore/corefx-restore.deps.json corefx/tests/extracted/$*/Microsoft.DotNet.RemoteExecutorHost.deps.json
160 cp corefx/restore/corefx-restore.runtimeconfig.dev.json corefx/tests/extracted/$*/xunit.console.runtimeconfig.dev.json
161 cp corefx/restore/corefx-restore.runtimeconfig.dev.json corefx/tests/extracted/$*/Microsoft.DotNet.RemoteExecutorHost.runtimeconfig.dev.json
162 cp corefx/restore/corefx-restore.dll corefx/tests/extracted/$*/corefx-restore.dll
163 sed -i -e 's/9.9.9/$(NETCOREAPP_VERSION)/g' corefx/tests/extracted/$*/*.runtimeconfig.json
164 cd corefx/tests/extracted/$* && \
165 COMPlus_DebugWriteToStdErr=1 $(CURDIR)/./dotnet --fx-version "$(NETCOREAPP_VERSION)" xunit.console.dll $*.dll \
166 -html ../../TestResult-$*.html -xml ../../TestResult-$*-netcore-xunit.xml \
167 $(XUNIT_FLAGS) @../../../../CoreFX.issues.rsp \
168 $(FIXTURE) || true
170 # build a test assembly in COREFX_ROOT (path to a fully built corefx repo) and copy it to corefx/tests/extracted
171 # e.g. `make build-test-corefx-System.Runtime COREFX_ROOT=/prj/corefx-master`
172 build-test-corefx-%:
173 cd $(COREFX_ROOT)/src/$*/tests && $(DOTNET) msbuild /p:OutputPath=tmp
174 cp $(COREFX_ROOT)/src/$*/tests/tmp/$*.Tests.{dll,pdb} $(CURDIR)/corefx/tests/extracted/$*.Tests/
175 rm -rf $(COREFX_ROOT)/src/$*/tests/tmp
177 xunit-summary:
178 python xunit-summary.py "corefx/tests"
180 endif
182 distdir: