[netcore] Restore Roslyn compilers from NuGet to allow up-to-date version to be used...
authorFilip Navara <filip.navara@gmail.com>
Wed, 24 Apr 2019 15:24:46 +0000 (17:24 +0200)
committerMarek Safar <marek.safar@gmail.com>
Wed, 24 Apr 2019 15:24:46 +0000 (17:24 +0200)
* Restore Roslyn compilers from NuGet to allow up-to-date version to be used

* Move the Roslyn version to makefile, ensure that it is updated before building System.Private.CoreLib

* Pass the whole path to Roslyn props file instead of just Roslyn version to dotnet build

* Make the Roslyn restore compatible with .NET Core 2.2 SDK

Commit migrated from https://github.com/mono/mono/commit/019b4563d3ef09e91b4382091232964d9548d69a

src/mono/netcore/.gitignore
src/mono/netcore/Makefile
src/mono/netcore/roslyn-restore.csproj [new file with mode: 0644]
src/mono/netcore/roslyn.make [new file with mode: 0644]

index afffbea..b001f5c 100644 (file)
@@ -8,6 +8,7 @@ netcoreapp2.0/
 netcoreapp3.0/
 packs/
 /corefx
+/roslyn
 /obj
 corefx-test-assets.xml
 Makefile
index 6f8307b..7e61651 100644 (file)
@@ -10,6 +10,8 @@ NETCORETESTS_VERSION := 4.6.0-preview5.19217.2
 # Extracted MicrosoftNETCoreAppVersion from https://github.com/dotnet/coreclr/blob/master/eng/Versions.props#L14
 NETCOREAPP_VERSION := 3.0.0-preview5-27620-01
 
+include roslyn.make
+
 ifeq ($(HOST_PLATFORM),win32)
 NETCORESDK_EXT = zip
 UNZIPCMD = python -c "import zipfile,sys; zipfile.ZipFile(sys.argv[1], 'r').extractall()"
@@ -40,9 +42,12 @@ $(NETCORESDK_FILE):
 update-corefx: corefx/.stamp-dl-corefx-$(NETCORETESTS_VERSION)
 
 corefx/.stamp-dl-corefx-$(NETCORETESTS_VERSION): corefx-restore.csproj
-       dotnet build --runtime $(RID) --packages corefx/packages -p:MicrosoftPrivateCoreFxNETCoreAppVersion=$(NETCORETESTS_VERSION) -p:OutputPath=corefx/restore/
+       dotnet build corefx-restore.csproj --runtime $(RID) --packages corefx/packages -p:MicrosoftPrivateCoreFxNETCoreAppVersion=$(NETCORETESTS_VERSION) -p:OutputPath=corefx/restore/
        touch $@
 
+update-roslyn: roslyn-restore.csproj roslyn.make
+       dotnet restore roslyn-restore.csproj -p:RoslynVersion=$(ROSLYN_VERSION) --packages roslyn/packages -p:OutputPath=roslyn/restore/
+
 update-corefx-tests: corefx/.stamp-dl-corefx-tests-$(NETCORETESTS_VERSION)
 
 corefx/.stamp-dl-corefx-tests-$(NETCORETESTS_VERSION):
@@ -72,13 +77,13 @@ link-mono:
        cp ../mono/mini/.libs/libmonosgen-2.0$(PLATFORM_AOT_SUFFIX) $(SHAREDRUNTIME)/$(PLATFORM_AOT_PREFIX)coreclr$(PLATFORM_AOT_SUFFIX)
        cp ../mcs/class/System.Private.CoreLib/bin/$(COREARCH)/System.Private.CoreLib.{dll,pdb} $(SHAREDRUNTIME)
 
-prepare: $(NETCORESDK_FILE) update-corefx link-mono
+prepare: $(NETCORESDK_FILE) update-corefx update-roslyn link-mono
 
 nupkg:
        nuget pack runtime.nuspec -properties VERSION=$(VERSION)\;RID=$(RID)\;PLATFORM_AOT_SUFFIX=$(PLATFORM_AOT_SUFFIX)\;COREARCH=$(COREARCH)
 
 clean:
-       rm -rf sdk shared host dotnet tests obj corefx LICENSE.txt ThirdPartyNotices.txt $(NETCORESDK_FILE)
+       rm -rf sdk shared host dotnet tests obj corefx roslyn LICENSE.txt ThirdPartyNotices.txt $(NETCORESDK_FILE)
 
 #
 # Running tests:
diff --git a/src/mono/netcore/roslyn-restore.csproj b/src/mono/netcore/roslyn-restore.csproj
new file mode 100644 (file)
index 0000000..f86ebab
--- /dev/null
@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>Library</OutputType>
+    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
+    <EnableDefaultItems>false</EnableDefaultItems>
+    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
+    <SkipImportRoslynProps>true</SkipImportRoslynProps>
+  </PropertyGroup>
+  <ItemGroup>
+    <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="$(RoslynVersion)" />
+  </ItemGroup>
+</Project>
diff --git a/src/mono/netcore/roslyn.make b/src/mono/netcore/roslyn.make
new file mode 100644 (file)
index 0000000..82e277e
--- /dev/null
@@ -0,0 +1 @@
+ROSLYN_VERSION := 3.1.0-beta3-19213-02
\ No newline at end of file