Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit 34e0e32

Browse files
vzarytovskiiKevinRansom
authored andcommitted
Netstandard2.0 FSharp.Core in master + netcoreapp3.1 fix for tests (dotnet#9870)
* Net Standard 2.0 only FSharp.Core (dotnet#9801) * Net standard only FSharp.Core * temp * Cherry-pick of FSharp.Core netstandard + fix for netcoreapp3.1 tests * Fixed netcoreapp30 -> netcoreapp31 test references * Cleaned up projects, added testplatform package, moved some tests to new suite * Tests changes * Revert accidental revert * Added missing tests * Cleaned up packages, fixed tests * Add System.Runtime to references Co-authored-by: Kevin Ransom (msft) <[email protected]>
1 parent 08fe686 commit 34e0e32

File tree

83 files changed

+1069
-899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1069
-899
lines changed

FSharp.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Private.Scr
5252
EndProject
5353
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "DependencyManager", "src\fsharp\Microsoft.DotNet.DependencyManager\Microsoft.DotNet.DependencyManager.fsproj", "{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}"
5454
EndProject
55-
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.ComponentTests", "tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{FAC5A3BF-C0D6-437A-868A-E962AA00B418}"
55+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.ComponentTests", "tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{FAC5A3BF-C0D6-437A-868A-E962AA00B418}"
5656
EndProject
5757
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fsharpqa", "fsharpqa", "{292C4F92-A313-4CAF-9552-731F39C6C21F}"
5858
EndProject

VisualFSharp.sln

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{647810D0
140140
EndProject
141141
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.FSharp.Compiler", "src\fsharp\FSharp.Compiler.nuget\Microsoft.FSharp.Compiler.csproj", "{04C59F6E-1C76-4F6A-AC21-2EA7F296A1B8}"
142142
EndProject
143-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FSharp.Core.nuget", "src\fsharp\FSharp.Core.nuget\FSharp.Core.nuget.csproj", "{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}"
144-
EndProject
145143
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Private.Scripting", "src\fsharp\FSharp.Compiler.Private.Scripting\FSharp.Compiler.Private.Scripting.fsproj", "{20B7BC36-CF51-4D75-9E13-66681C07977F}"
146144
EndProject
147145
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Private.Scripting.UnitTests", "tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj", "{09F56540-AFA5-4694-B7A6-0DBF6D4618C2}"
@@ -842,18 +840,6 @@ Global
842840
{04C59F6E-1C76-4F6A-AC21-2EA7F296A1B8}.Release|Any CPU.Build.0 = Release|Any CPU
843841
{04C59F6E-1C76-4F6A-AC21-2EA7F296A1B8}.Release|x86.ActiveCfg = Release|Any CPU
844842
{04C59F6E-1C76-4F6A-AC21-2EA7F296A1B8}.Release|x86.Build.0 = Release|Any CPU
845-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
846-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
847-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Debug|x86.ActiveCfg = Debug|Any CPU
848-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Debug|x86.Build.0 = Debug|Any CPU
849-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Proto|Any CPU.ActiveCfg = Release|Any CPU
850-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Proto|Any CPU.Build.0 = Release|Any CPU
851-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Proto|x86.ActiveCfg = Release|Any CPU
852-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Proto|x86.Build.0 = Release|Any CPU
853-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
854-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Release|Any CPU.Build.0 = Release|Any CPU
855-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Release|x86.ActiveCfg = Release|Any CPU
856-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC}.Release|x86.Build.0 = Release|Any CPU
857843
{20B7BC36-CF51-4D75-9E13-66681C07977F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
858844
{20B7BC36-CF51-4D75-9E13-66681C07977F}.Debug|Any CPU.Build.0 = Debug|Any CPU
859845
{20B7BC36-CF51-4D75-9E13-66681C07977F}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -1039,7 +1025,6 @@ Global
10391025
{E93E7D28-1C6B-4E04-BE83-68428CF7E039} = {6235B3AF-774D-4EA1-8F37-789E767F6368}
10401026
{9482211E-23D0-4BD0-9893-E4AA5559F67A} = {6235B3AF-774D-4EA1-8F37-789E767F6368}
10411027
{04C59F6E-1C76-4F6A-AC21-2EA7F296A1B8} = {647810D0-5307-448F-99A2-E83917010DAE}
1042-
{8EC30B2E-F1F9-4A98-BBB5-DD0CF6C84DDC} = {647810D0-5307-448F-99A2-E83917010DAE}
10431028
{20B7BC36-CF51-4D75-9E13-66681C07977F} = {B8DDA694-7939-42E3-95E5-265C2217C142}
10441029
{09F56540-AFA5-4694-B7A6-0DBF6D4618C2} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
10451030
{DFA30881-C0B1-4813-B087-C21B5AF9B77F} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}

eng/Build.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,10 @@ try {
505505

506506
if ($testCompiler) {
507507
if (-not $noVisualStudio) {
508+
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $desktopTargetFramework
508509
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework
509510
}
511+
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $coreclrTargetFramework
510512
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $coreclrTargetFramework
511513
}
512514

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
<MicrosoftCompositionVersion>1.0.30</MicrosoftCompositionVersion>
175175
<MicrosoftMSXMLVersion>8.0.0-alpha</MicrosoftMSXMLVersion>
176176
<MicrosoftNetCompilersVersion>2.7.0</MicrosoftNetCompilersVersion>
177+
<MicrosoftNETCoreAppRefVersion>3.1.0</MicrosoftNETCoreAppRefVersion>
177178
<MicrosoftNETCoreILDAsmVersion>3.0.0-preview-27318-01</MicrosoftNETCoreILDAsmVersion>
178179
<MicrosoftNETCoreILAsmVersion>3.0.0-preview-27318-01</MicrosoftNETCoreILAsmVersion>
179180
<MicrosoftNETTestSdkVersion>16.6.1</MicrosoftNETTestSdkVersion>

fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2020
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2121
<DebugType>embedded</DebugType>
22+
<MicrosoftBuildOverallPackagesVersion>16.6</MicrosoftBuildOverallPackagesVersion>
23+
<MicrosoftBuildVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildVersion>
24+
<MicrosoftBuildFrameworkVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildFrameworkVersion>
25+
<MicrosoftBuildTasksCoreVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildTasksCoreVersion>
26+
<MicrosoftBuildUtilitiesCoreVersion>$(MicrosoftBuildOverallPackagesVersion)</MicrosoftBuildUtilitiesCoreVersion>
2227
</PropertyGroup>
2328
<PropertyGroup>
2429
<Summary>The F# compiler as library. For editors, for tools, for scripting. For you.</Summary>
@@ -723,6 +728,9 @@
723728
<PackageReference Include="System.Buffers" Version="4.5.0" />
724729
<PackageReference Include="System.Memory" Version="4.5.3" />
725730
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
731+
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" />
732+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildVersion)" />
733+
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" />
726734
</ItemGroup>
727735
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
728736
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />

fcs/netfx.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net462'">$(BaseFrameworkPathOverrideForMono)/4.6.2-api</FrameworkPathOverride>
2121
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net47'">$(BaseFrameworkPathOverrideForMono)/4.7-api</FrameworkPathOverride>
2222
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net471'">$(BaseFrameworkPathOverrideForMono)/4.7.1-api</FrameworkPathOverride>
23+
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net472'">$(BaseFrameworkPathOverrideForMono)/4.7.2-api</FrameworkPathOverride>
24+
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net48'">$(BaseFrameworkPathOverrideForMono)/4.8-api</FrameworkPathOverride>
2325
<EnableFrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != ''">true</EnableFrameworkPathOverride>
2426

2527
<!-- Add the Facades directory. Not sure how else to do this. Necessary at least for .NET 4.5 -->

setup/Swix/Microsoft.FSharp.Compiler.MSBuild/Microsoft.FSharp.Compiler.MSBuild.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp\%(_XlfLanguages
4848
file source="$(ArtifactsBinDir)FSharp.Build\$(Configuration)\$(TargetFramework)\%(_XlfLanguages.Identity)\FSharp.Build.resources.dll"
4949
file source="$(ArtifactsBinDir)FSharp.Compiler.Interactive.Settings\$(Configuration)\$(TargetFramework)\%(_XlfLanguages.Identity)\FSharp.Compiler.Interactive.Settings.resources.dll"
5050
file source="$(ArtifactsBinDir)FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\%(_XlfLanguages.Identity)\FSharp.Compiler.Private.resources.dll"
51-
file source="$(ArtifactsBinDir)FSharp.Core\$(Configuration)\net45\%(_XlfLanguages.Identity)\FSharp.Core.resources.dll"
51+
file source="$(ArtifactsBinDir)FSharp.Core\$(Configuration)\netstandard2.0\%(_XlfLanguages.Identity)\FSharp.Core.resources.dll"
5252
]]>
5353
</_Line>
5454
</PropertyGroup>
@@ -98,9 +98,9 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp"
9898
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Runtime.CompilerServices.Unsafe.dll"
9999
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Threading.Tasks.Dataflow.dll"
100100
file source="$(BinariesFolder)\FSharp.Compiler.Server.Shared\$(Configuration)\$(TargetFramework)\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
101-
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
102-
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.optdata"
103-
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\net45\FSharp.Core.sigdata"
101+
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
102+
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.optdata"
103+
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.sigdata"
104104
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\FSharp.Build.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
105105
file source="$(BinariesFolder)\Microsoft.DotNet.DependencyManager\$(Configuration)\net472\Microsoft.DotNet.DependencyManager.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
106106
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Framework.dll"

src/fsharp/CompileOps.fs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3700,12 +3700,17 @@ type TcAssemblyResolutions(tcConfig: TcConfig, results: AssemblyResolution list,
37003700

37013701
static member GetAllDllReferences (tcConfig: TcConfig) = [
37023702
let primaryReference = tcConfig.PrimaryAssemblyDllReference()
3703-
//yield primaryReference
3703+
3704+
let assumeDotNetFramework = primaryReference.SimpleAssemblyNameIs("mscorlib")
37043705

37053706
if not tcConfig.compilingFslib then
37063707
yield tcConfig.CoreLibraryDllReference()
3708+
if assumeDotNetFramework then
3709+
// When building desktop then we need these additional dependencies
3710+
yield AssemblyReference(rangeStartup, "System.Numerics.dll", None)
3711+
yield AssemblyReference(rangeStartup, "System.dll", None)
3712+
yield AssemblyReference(rangeStartup, "netstandard.dll", None)
37073713

3708-
let assumeDotNetFramework = primaryReference.SimpleAssemblyNameIs("mscorlib")
37093714
if tcConfig.framework then
37103715
for s in defaultReferencesForScriptsAndOutOfProjectSources tcConfig.useFsiAuxLib assumeDotNetFramework tcConfig.useSdkRefs do
37113716
yield AssemblyReference(rangeStartup, (if s.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) then s else s+".dll"), None)
@@ -4107,7 +4112,6 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
41074112
| None ->
41084113
tcImports.ImplicitLoadIfAllowed(ctok, m, assemblyName, lookupOnly)
41094114
look tcImports
4110-
41114115

41124116
member tcImports.FindDllInfo (ctok, m, assemblyName) =
41134117
match tcImports.TryFindDllInfo (ctok, m, assemblyName, lookupOnly=false) with
@@ -4784,7 +4788,7 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
47844788
// If the user is asking for the default framework then also try to resolve other implicit assemblies as they are discovered.
47854789
// Using this flag to mean 'allow implicit discover of assemblies'.
47864790
let tcConfig = tcConfigP.Get ctok
4787-
if not lookupOnly && tcConfig.implicitlyResolveAssemblies then
4791+
if not lookupOnly && tcConfig.implicitlyResolveAssemblies then
47884792
let tryFile speculativeFileName =
47894793
let foundFile = tcImports.TryResolveAssemblyReference (ctok, AssemblyReference (m, speculativeFileName, None), ResolveAssemblyReferenceMode.Speculative)
47904794
match foundFile with
@@ -4825,7 +4829,7 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
48254829
ResultD [assemblyResolution]
48264830
| None ->
48274831
#if NO_MSBUILD_REFERENCE_RESOLUTION
4828-
try
4832+
try
48294833
ResultD [tcConfig.ResolveLibWithDirectories assemblyReference]
48304834
with e ->
48314835
ErrorD e
@@ -4846,7 +4850,7 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
48464850
ResultD [resolved]
48474851
| None ->
48484852
ErrorD(AssemblyNotResolved(assemblyReference.Text, assemblyReference.Range))
4849-
else
4853+
else
48504854
// This is a previously unencountered assembly. Resolve it and add it to the list.
48514855
// But don't cache resolution failures because the assembly may appear on the disk later.
48524856
let resolved, unresolved = TcConfig.TryResolveLibsUsingMSBuildRules(tcConfig, [ assemblyReference ], assemblyReference.Range, mode)
@@ -4861,9 +4865,7 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
48614865
// Note, if mode=ResolveAssemblyReferenceMode.Speculative and the resolution failed then TryResolveLibsUsingMSBuildRules returns
48624866
// the empty list and we convert the failure into an AssemblyNotResolved here.
48634867
ErrorD(AssemblyNotResolved(assemblyReference.Text, assemblyReference.Range))
4864-
4865-
#endif
4866-
4868+
#endif
48674869

48684870
member tcImports.ResolveAssemblyReference(ctok, assemblyReference, mode) : AssemblyResolution list =
48694871
CommitOperationResult(tcImports.TryResolveAssemblyReference(ctok, assemblyReference, mode))

src/fsharp/CompileOps.fsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,8 @@ type TcImports =
673673
member ReportUnresolvedAssemblyReferences: UnresolvedAssemblyReference list -> unit
674674
member SystemRuntimeContainsType: string -> bool
675675

676+
member internal Base: TcImports option
677+
676678
static member BuildFrameworkTcImports : CompilationThreadToken * TcConfigProvider * AssemblyResolution list * AssemblyResolution list -> Cancellable<TcGlobals * TcImports>
677679
static member BuildNonFrameworkTcImports : CompilationThreadToken * TcConfigProvider * TcGlobals * TcImports * AssemblyResolution list * UnresolvedAssemblyReference list -> Cancellable<TcImports>
678680
static member BuildTcImports : CompilationThreadToken * TcConfigProvider -> Cancellable<TcGlobals * TcImports>

src/fsharp/CompileOptions.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,9 @@ let advancedFlagsFsc tcConfigB =
983983

984984
yield CompilerOption
985985
("staticlink", tagFile,
986-
OptionString (fun s -> tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [s]), None,
986+
OptionString (fun s ->
987+
tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [s]
988+
tcConfigB.implicitlyResolveAssemblies <- true), None,
987989
Some (FSComp.SR.optsStaticlink()))
988990

989991
#if ENABLE_MONO_SUPPORT

0 commit comments

Comments
 (0)