[netcore] Bump roslyn version
[mono-project.git] / netcore / Makefile
blob2c0ae531c66bf73e4069e13b6b8f1025269a8b20
1 include ../mcs/build/config.make
4 # NETCORETESTS_VERSION and NETCOREAPP_VERSION must be updated in sync, we are using coreclr repo for that but that's fine for now
7 # Extracted MicrosoftPrivateCoreFxNETCoreAppVersion from https://github.com/dotnet/coreclr/blob/master/eng/Versions.props#L21
8 NETCORETESTS_VERSION := 4.6.0-preview7.19305.1
10 # Extracted MicrosoftNETCoreAppVersion from https://github.com/dotnet/coreclr/blob/master/eng/Versions.props#L25
11 NETCOREAPP_VERSION := 3.0.0-preview7-27804-03
13 # Extracted from https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/master/latest.version
14 ASPNETCOREAPP_VERSION := 3.0.0-preview-18614-0151
16 ROSLYN_VERSION := 3.2.0-beta3-19310-04
18 ifeq ($(HOST_PLATFORM),win32)
19 NETCORESDK_EXT = zip
20 UNZIPCMD = python -c "import zipfile,sys; zipfile.ZipFile(sys.argv[1], 'r').extractall()"
21 XUNIT_FLAGS =
22 TESTS_PLATFORM = Windows_NT.x64
23 DOTNET := $(shell powershell -ExecutionPolicy Bypass -Command "./init-tools.ps1")/dotnet.exe
24 DOTNET := "$(subst \,/,$(DOTNET))"
25 endif
27 ifeq ($(HOST_PLATFORM),macos)
28 NETCORESDK_EXT = tar.gz
29 UNZIPCMD = tar -xvf
30 XUNIT_FLAGS = -notrait category=nonosxtests
31 TESTS_PLATFORM = OSX.x64
32 DOTNET := $(shell ./init-tools.sh | tail -1)
33 endif
35 ifeq ($(HOST_PLATFORM),linux)
36 NETCORESDK_EXT = tar.gz
37 UNZIPCMD = tar -xvf
38 XUNIT_FLAGS = -notrait category=nonlinuxtests @../../../../CoreFX.issues_linux.rsp
39 TESTS_PLATFORM = Linux.x64
40 DOTNET := $(shell ./init-tools.sh | tail -1)
41 endif
43 NETCORESDK_FILE := dotnet-runtime-$(NETCOREAPP_VERSION)-$(RID).$(NETCORESDK_EXT)
44 ASPNETCORESDK_FILE := aspnetcore-runtime-$(ASPNETCOREAPP_VERSION)-$(RID).$(NETCORESDK_EXT)
45 NETCORE_URL := https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$(NETCOREAPP_VERSION)/$(NETCORESDK_FILE)
46 ASPNETCORE_URL := https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/$(ASPNETCOREAPP_VERSION)/$(ASPNETCORESDK_FILE)
47 FEED_BASE_URL := https://dotnetfeed.blob.core.windows.net/dotnet-core
48 TEST_ASSETS_URL = $(FEED_BASE_URL)/corefx-tests/$(NETCORETESTS_VERSION)/$(TESTS_PLATFORM)/netcoreapp/corefx-test-assets.xml
50 # used to calculate exact version number for generating nupkg
51 BLAME = $(shell git blame ../configure.ac | grep AC_INIT | cut -f1 -d' ')
52 VERSTUB = .$(shell git rev-list --count $(BLAME)..HEAD)
54 all: runtime bcl
56 $(NETCORESDK_FILE):
57 curl $(NETCORE_URL) --output $(NETCORESDK_FILE)
58 rm -rf shared/Microsoft.NETCore.App
59 $(UNZIPCMD) $(NETCORESDK_FILE)
61 # AspNetCoreApp contains its own .NET Core Runtime but we don't need it so let's remove it
62 # and update version in Microsoft.AspNetCore.App.runtimeconfig.json to NETCOREAPP_VERSION
63 $(ASPNETCORESDK_FILE):
64 curl $(ASPNETCORE_URL) --output $(ASPNETCORESDK_FILE)
65 $(UNZIPCMD) $(ASPNETCORESDK_FILE)
66 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
68 update-corefx: corefx/.stamp-dl-corefx-$(NETCORETESTS_VERSION)
70 corefx/.stamp-dl-corefx-$(NETCORETESTS_VERSION): corefx-restore.csproj
71 $(DOTNET) build corefx-restore.csproj --runtime $(RID) --packages corefx/packages -p:MicrosoftPrivateCoreFxNETCoreAppVersion=$(NETCORETESTS_VERSION) -p:OutputPath=corefx/restore/
72 touch $@
74 update-roslyn: roslyn-restore.csproj
75 $(DOTNET) restore roslyn-restore.csproj -p:RoslynVersion=$(ROSLYN_VERSION) --packages roslyn/packages -p:OutputPath=roslyn/restore/
77 update-corefx-tests: corefx/.stamp-dl-corefx-tests-$(NETCORETESTS_VERSION)
79 corefx/.stamp-dl-corefx-tests-$(NETCORETESTS_VERSION):
80 curl $(TEST_ASSETS_URL) --output corefx-test-assets.xml
81 python dl-test-assets.py corefx-test-assets.xml $(FEED_BASE_URL) corefx/tests
82 touch $@
84 run-sample: prepare
85 $(DOTNET) build sample/HelloWorld
86 MONO_ENV_OPTIONS="--debug" COMPlus_DebugWriteToStdErr=1 ./dotnet --fx-version "$(NETCOREAPP_VERSION)" sample/HelloWorld/bin/Debug/netcoreapp3.0/HelloWorld.dll
88 run-aspnet-sample: prepare
89 rm -rf sample/AspNetCore/{bin,obj}
90 $(DOTNET) publish sample/AspNetCore -c Debug -r $(RID)
91 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)
92 cp ../mcs/class/System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.dll sample/AspNetCore/bin/Debug/netcoreapp3.0/$(RID)/publish/
93 COMPlus_DebugWriteToStdErr=1 ./dotnet --fx-version "$(ASPNETCOREAPP_VERSION)" sample/AspNetCore/bin/Debug/netcoreapp3.0/$(RID)/publish/AspNetCore.dll
95 # COREHOST_TRACE=1
96 SHAREDRUNTIME := shared/Microsoft.NETCore.App/$(NETCOREAPP_VERSION)
98 bcl: update-roslyn
99 $(MAKE) -C ../mcs/build/ common/Consts.cs
100 $(DOTNET) build $(CORETARGETS) $(CORLIB_BUILD_FLAGS) -p:BuildArch=$(COREARCH) \
101 -p:OutputPath=bin/$(COREARCH) \
102 -p:RoslynPropsFile="../../../netcore/roslyn/packages/microsoft.net.compilers.toolset/$(ROSLYN_VERSION)/build/Microsoft.Net.Compilers.Toolset.props" \
103 ../mcs/class/System.Private.CoreLib/System.Private.CoreLib.csproj
105 debug-bcl:
106 $(MAKE) bcl CORLIB_BUILD_FLAGS="-c Debug"
108 runtime:
109 $(MAKE) -C ../mono
111 link-mono:
112 cp ../mono/mini/.libs/libmonosgen-2.0$(PLATFORM_AOT_SUFFIX) $(SHAREDRUNTIME)/$(PLATFORM_AOT_PREFIX)coreclr$(PLATFORM_AOT_SUFFIX)
113 cp ../mcs/class/System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.dll $(SHAREDRUNTIME)
114 cp ../mcs/class/System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.pdb $(SHAREDRUNTIME)
116 prepare: $(ASPNETCORESDK_FILE) $(NETCORESDK_FILE) update-corefx update-roslyn link-mono
118 nupkg:
119 $(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
120 $(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
122 clean:
123 rm -rf .configured ../.dotnet sdk shared host dotnet tests obj corefx roslyn LICENSE.txt ThirdPartyNotices.txt $(NETCORESDK_FILE) $(ASPNETCORESDK_FILE)
126 # Running tests:
128 # We have two modes to run then with xtest-Foo.Test to be the prefered one because it runs all tests and simple runner
129 # with rules like tes-Foo which runs limited set of test
132 # e.g. `make xtest-System.Collections.Tests`
133 xtest-%: prepare update-corefx-tests
134 echo -n "***************** $* *********************"
135 cp corefx/restore/corefx-restore.deps.json corefx/tests/extracted/$*/xunit.console.deps.json
136 cp corefx/restore/corefx-restore.deps.json corefx/tests/extracted/$*/Microsoft.DotNet.RemoteExecutorHost.deps.json
137 cp corefx/restore/corefx-restore.runtimeconfig.dev.json corefx/tests/extracted/$*/xunit.console.runtimeconfig.dev.json
138 cp corefx/restore/corefx-restore.runtimeconfig.dev.json corefx/tests/extracted/$*/Microsoft.DotNet.RemoteExecutorHost.runtimeconfig.dev.json
139 cp corefx/restore/corefx-restore.dll corefx/tests/extracted/$*/corefx-restore.dll
140 sed -i -e 's/9.9.9/$(NETCOREAPP_VERSION)/g' corefx/tests/extracted/$*/*.runtimeconfig.json
141 cd corefx/tests/extracted/$* && \
142 COMPlus_DebugWriteToStdErr=1 $(CURDIR)/./dotnet --fx-version "$(NETCOREAPP_VERSION)" xunit.console.dll $*.dll \
143 -html ../../TestResult-$*.html -xml ../../TestResult-$*-netcore-xunit.xml \
144 $(XUNIT_FLAGS) @../../../../CoreFX.issues.rsp \
145 $(FIXTURE) || true
147 debug-xtest-%:
148 MONO_ENV_OPTIONS="--debug" $(MAKE) xtest-$*
150 # these tests won't be included in `xtestall`
151 EXCLUDED_COREFX_TESTS =
153 xtestall-noload: $(foreach workingtest, $(foreach test, $(wildcard corefx/tests/extracted/*), \
154 $(filter-out $(EXCLUDED_COREFX_TESTS), $(notdir $(test)))), $(addprefix xtest-, $(workingtest)))
156 xtestall: update-corefx-tests
157 $(MAKE) xtestall-noload
159 # build a test assembly in COREFX_ROOT and copy it to corefx/tests/extracted
160 # e.g. `make build-local-corefx-test-System.Runtime COREFX_ROOT=/prj/corefx-master`
161 build-local-corefx-test-%: check-env
162 cd $(COREFX_ROOT)/src/$*/tests && $(DOTNET) build -o "$(CURDIR)/corefx/tests/extracted/tmp"
163 cp $(CURDIR)/corefx/tests/extracted/tmp/$*.Tests.{dll,pdb} $(CURDIR)/corefx/tests/extracted/$*.Tests/
164 rm -rf $(CURDIR)/corefx/tests/extracted/tmp
167 # console test runner (obsolete)
169 TEST_SUITES = \
170 System.Runtime.Tests \
171 System.Runtime.CompilerServices.Unsafe.Tests \
172 System.Collections.Tests
174 # The binary directory under $(COREFIX_BINDIR)
175 System.Runtime.CompilerServices.Unsafe.Tests_PROFILE = netstandard-Debug
176 System.Runtime.Tests_PROFILE = netcoreapp-Unix-Debug
177 System.Collections.Tests_PROFILE = netcoreapp-Debug
178 System.Reflection.Emit.Tests_PROFILE = netcoreapp-Debug
179 System.Reflection.Emit.ILGeneration.Tests_PROFILE = netcoreapp-Debug
180 System.Reflection.Emit.Lightweight.Tests_PROFILE = netcoreapp-Debug
181 System.Threading.Tests_PROFILE = netcoreapp-Debug
182 System.Threading.Thread.Tests_PROFILE = netcoreapp-Debug
184 COREFX_BINDIR=$(COREFX_ROOT)/artifacts/bin
186 check-env:
187 @if [ "x$(COREFX_ROOT)" == "x" ]; then echo "Set COREFX_ROOT to the root of the fully built corefx repo."; exit 1; fi
189 build-%: check-env
190 cd gen-xunit-runner && $(DOTNET) run ../tests $(COREFX_ROOT) $(COREFX_BINDIR)/$*/$($*_PROFILE)/$*.dll $(XUNIT_FLAGS) @../CoreFX.issues.rsp $(XUNIT_ARGS)
191 cp $(COREFX_BINDIR)/RemoteExecutorConsoleApp/netstandard-Debug/RemoteExecutorConsoleApp.* tests/$*
192 cp $(COREFX_BINDIR)/System.Runtime.Tests/netcoreapp-Unix-Debug/TestLoadAssembly.dll tests/$*
193 sed -e 's/9.9.9/$(VERSION)/g' < tests/$*/RemoteExecutorConsoleApp.runtimeconfig.json > 2 && mv 2 tests/$*/RemoteExecutorConsoleApp.runtimeconfig.json
194 cd tests/$* && $(DOTNET) build
196 run-%: check-env
197 cd tests/$* && MONO_PATH=bin/Debug/netcoreapp3.0 MONO_ENV_OPTIONS="--debug --explicit-null-checks" COMPlus_DebugWriteToStdErr=1 ../../dotnet bin/Debug/netcoreapp3.0/$*-runner.dll
199 build-base: $(addprefix build-, $(TEST_SUITES))
201 check: $(addprefix run-, $(TEST_SUITES))
203 distdir: