diff --git a/INTERNAL.md b/INTERNAL.md index 81d5c2ae199..b30446072c2 100644 --- a/INTERNAL.md +++ b/INTERNAL.md @@ -56,13 +56,21 @@ it's a good idea to check the previous link for any old or stalled insertions in ## Less interesting links [FSharp.Core (Official NuGet Release)](https://dev.azure.com/dnceng/internal/_release?_a=releases&definitionId=72). -Uploads the final FSharp.Core package from the specified build to NuGet. This should only be run when we know for +Uploads the final `FSharp.Core` package from the specified build to NuGet. This should only be run when we know for certain which build produced the final offical package. [FSharp.Core (Preview NuGet Release)](https://dev.azure.com/dnceng/internal/_release?_a=releases&definitionId=92). -Uploads the preview FSharp.Core.5.0.0-beta.* package from the specified build to NuGet. This should be run every time +Uploads the preview `FSharp.Core.*-beta.*` package from the specified build to NuGet. This should be run every time a new SDK preview is released. +[FCS (Official NuGet Release)](https://dev.azure.com/dnceng/internal/_release?view=mine&_a=releases&definitionId=99). +Uploads the final `FSharp.Compiler.Service` package from the specified build to NuGet. Only builds from the `release/fcs` +branch can be selected. This should only be run when we're fairly certain that the package is complete. + +[FCS (Preview NuGet Release)](https://dev.azure.com/dnceng/internal/_release?view=mine&_a=releases&definitionId=98). +Uploads the preview `FSharp.Compiler.Service.*-beta.*` package from the specified build to NuGet. Only builds from the +`main` branch can be selected. This can be run whenever we think we're ready to preview a new FCS build. + [Nightly VSIX (main) uploader](https://dev.azure.com/dnceng/internal/_release?_a=releases&definitionId=70). Uploads a package from every build of `main` to the [Nightly VSIX feed](README.md#using-nightly-releases-in-visual-studio). diff --git a/eng/Versions.props b/eng/Versions.props index b31763a4870..507a144f8e0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -24,11 +24,11 @@ $(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion) $(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion).$(FSRevisionVersion) 38 - $(FSMinorVersion) - $(FSBuildVersion) + 0 + 1 $(FSRevisionVersion) $(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion) - $(FCSMajorVersion)-$(FCSMinorVersion)-$(FCSBuildVersion) + $(FCSMajorVersion)$(FCSMinorVersion)$(FCSBuildVersion) 4.7.2 diff --git a/src/fsharp/DotNetFrameworkDependencies.fs b/src/fsharp/DotNetFrameworkDependencies.fs index 0fcb0e6d9b8..8b03f590787 100644 --- a/src/fsharp/DotNetFrameworkDependencies.fs +++ b/src/fsharp/DotNetFrameworkDependencies.fs @@ -29,7 +29,7 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies location let inline ifEmptyUse alternative filename = if String.IsNullOrWhiteSpace filename then alternative else filename - + let getFSharpCoreLibraryName = "FSharp.Core" let getFsiLibraryName = "FSharp.Compiler.Interactive.Settings" let getDefaultFSharpCoreLocation = Path.Combine(fSharpCompilerLocation, getFSharpCoreLibraryName + ".dll") @@ -62,15 +62,27 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies // packs\Microsoft.NETCore.App.Ref\sdk-version\netcoreappn.n // we will rely on the sdk-version match on the two paths to ensure that we get the product that ships with the // version of the runtime we are executing on - // Use the reference assemblies for the highest netcoreapp tfm that we find in that location. + // Use the reference assemblies for the highest netcoreapp tfm that we find in that location that is + // lower than or equal to the implementation version. + let zeroVersion = Version("0.0.0.0") let version, frameworkRefsPackDirectoryRoot = try - let version = DirectoryInfo(implementationAssemblyDir).Name + let computeVersion version = + match Version.TryParse(version) with + | true, v -> v + | false, _ -> zeroVersion + + let version = computeVersion (DirectoryInfo(implementationAssemblyDir).Name) let microsoftNETCoreAppRef = Path.Combine(implementationAssemblyDir, "../../../packs/Microsoft.NETCore.App.Ref") if Directory.Exists(microsoftNETCoreAppRef) then - Some version, Some microsoftNETCoreAppRef + let directory = DirectoryInfo(microsoftNETCoreAppRef).GetDirectories() + |> Array.map (fun di -> computeVersion di.Name) + |> Array.sort + |> Array.filter(fun v -> v <= version) + |> Array.last + Some (directory.ToString()), Some microsoftNETCoreAppRef else - Some version, None + None, None with | _ -> None, None // Tries to figure out the tfm for the compiler instance. @@ -369,91 +381,132 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies // referenced from TcGlobals must be listed here. let systemAssemblies = HashSet [ + // NOTE: duplicates are ok in this list + + // .NET Framework list yield "mscorlib" yield "netstandard" - yield "System.Runtime" - yield getFSharpCoreLibraryName - yield "System" - yield "System.Xml" - yield "System.Runtime.Remoting" - yield "System.Runtime.Serialization.Formatters.Soap" - yield "System.Data" - yield "System.Deployment" - yield "System.Design" - yield "System.Messaging" - yield "System.Drawing" - yield "System.Net" - yield "System.Web" - yield "System.Web.Services" - yield "System.Windows.Forms" - yield "System.Core" - yield "System.Runtime" - yield "System.Observable" - yield "System.Numerics" - yield "System.ValueTuple" - - // Additions for coreclr and portable profiles - yield "System.Collections" - yield "System.Collections.Concurrent" - yield "System.Console" - yield "System.Diagnostics.Debug" - yield "System.Diagnostics.Tools" - yield "System.Globalization" - yield "System.IO" - yield "System.Linq" - yield "System.Linq.Expressions" - yield "System.Linq.Queryable" - yield "System.Net.Requests" - yield "System.Reflection" - yield "System.Reflection.Emit" - yield "System.Reflection.Emit.ILGeneration" - yield "System.Reflection.Extensions" - yield "System.Resources.ResourceManager" - yield "System.Runtime.Extensions" - yield "System.Runtime.InteropServices" - yield "System.Runtime.InteropServices.PInvoke" - yield "System.Runtime.Numerics" - yield "System.Text.Encoding" - yield "System.Text.Encoding.Extensions" - yield "System.Text.RegularExpressions" - yield "System.Threading" - yield "System.Threading.Tasks" - yield "System.Threading.Tasks.Parallel" - yield "System.Threading.Thread" - yield "System.Threading.ThreadPool" - yield "System.Threading.Timer" - + yield getFSharpCoreLibraryName yield "FSharp.Compiler.Interactive.Settings" - yield "Microsoft.Win32.Registry" - yield "System.Diagnostics.Tracing" - yield "System.Globalization.Calendars" - yield "System.Reflection.Primitives" - yield "System.Runtime.Handles" + yield "Microsoft.CSharp" + yield "Microsoft.VisualBasic" + yield "Microsoft.VisualBasic.Core" yield "Microsoft.Win32.Primitives" - yield "System.IO.FileSystem" - yield "System.Net.Primitives" - yield "System.Net.Sockets" - yield "System.Private.Uri" + yield "Microsoft.Win32.Registry" yield "System.AppContext" yield "System.Buffers" + yield "System.Collections" + yield "System.Collections.Concurrent" yield "System.Collections.Immutable" + yield "System.Collections.NonGeneric" + yield "System.Collections.Specialized" + yield "System.ComponentModel" + yield "System.ComponentModel.Annotations" + yield "System.ComponentModel.DataAnnotations" + yield "System.ComponentModel.EventBasedAsync" + yield "System.ComponentModel.Primitives" + yield "System.ComponentModel.TypeConverter" + yield "System.Configuration" + yield "System.Console" + yield "System.Core" + yield "System.Data" + yield "System.Data.Common" + yield "System.Data.DataSetExtensions" + yield "System.Deployment" + yield "System.Design" + yield "System.Diagnostics.Contracts" + yield "System.Diagnostics.Debug" yield "System.Diagnostics.DiagnosticSource" + yield "System.Diagnostics.FileVersionInfo" yield "System.Diagnostics.Process" + yield "System.Diagnostics.StackTrace" + yield "System.Diagnostics.TextWriterTraceListener" + yield "System.Diagnostics.Tools" yield "System.Diagnostics.TraceSource" + yield "System.Diagnostics.Tracing" + yield "System.Drawing" + yield "System.Drawing.Primitives" + yield "System.Dynamic.Runtime" + yield "System.Formats.Asn1" + yield "System.Globalization" + yield "System.Globalization.Calendars" yield "System.Globalization.Extensions" + yield "System.IO" yield "System.IO.Compression" + yield "System.IO.Compression.Brotli" + yield "System.IO.Compression.FileSystem" yield "System.IO.Compression.ZipFile" + yield "System.IO.FileSystem" + yield "System.IO.FileSystem.DriveInfo" yield "System.IO.FileSystem.Primitives" + yield "System.IO.FileSystem.Watcher" + yield "System.IO.IsolatedStorage" + yield "System.IO.MemoryMappedFiles" + yield "System.IO.Pipes" + yield "System.IO.UnmanagedMemoryStream" + yield "System.Linq" + yield "System.Linq.Expressions" + yield "System.Linq.Expressions" + yield "System.Linq.Parallel" + yield "System.Linq.Queryable" + yield "System.Memory" + yield "System.Messaging" + yield "System.Net" yield "System.Net.Http" + yield "System.Net.Http.Json" + yield "System.Net.HttpListener" + yield "System.Net.Mail" yield "System.Net.NameResolution" + yield "System.Net.NetworkInformation" + yield "System.Net.Ping" + yield "System.Net.Primitives" + yield "System.Net.Requests" + yield "System.Net.Security" + yield "System.Net.ServicePoint" + yield "System.Net.Sockets" + yield "System.Net.WebClient" yield "System.Net.WebHeaderCollection" + yield "System.Net.WebProxy" + yield "System.Net.WebSockets" + yield "System.Net.WebSockets.Client" + yield "System.Numerics" + yield "System.Numerics.Vectors" yield "System.ObjectModel" + yield "System.Observable" + yield "System.Private.Uri" + yield "System.Reflection" + yield "System.Reflection.DispatchProxy" + yield "System.Reflection.Emit" + yield "System.Reflection.Emit.ILGeneration" yield "System.Reflection.Emit.Lightweight" + yield "System.Reflection.Extensions" yield "System.Reflection.Metadata" + yield "System.Reflection.Primitives" yield "System.Reflection.TypeExtensions" + yield "System.Resources.Reader" + yield "System.Resources.ResourceManager" + yield "System.Resources.Writer" + yield "System.Runtime" + yield "System.Runtime.CompilerServices.Unsafe" + yield "System.Runtime.CompilerServices.VisualC" + yield "System.Runtime.Extensions" + yield "System.Runtime.Handles" + yield "System.Runtime.InteropServices" + yield "System.Runtime.InteropServices.PInvoke" yield "System.Runtime.InteropServices.RuntimeInformation" + yield "System.Runtime.InteropServices.WindowsRuntime" + yield "System.Runtime.Intrinsics" yield "System.Runtime.Loader" + yield "System.Runtime.Numerics" + yield "System.Runtime.Remoting" + yield "System.Runtime.Serialization" + yield "System.Runtime.Serialization.Formatters" + yield "System.Runtime.Serialization.Formatters.Soap" + yield "System.Runtime.Serialization.Json" + yield "System.Runtime.Serialization.Primitives" + yield "System.Runtime.Serialization.Xml" + yield "System.Security" yield "System.Security.Claims" yield "System.Security.Cryptography.Algorithms" yield "System.Security.Cryptography.Cng" @@ -464,10 +517,43 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies yield "System.Security.Cryptography.X509Certificates" yield "System.Security.Principal" yield "System.Security.Principal.Windows" + yield "System.Security.SecureString" + yield "System.ServiceModel.Web" + yield "System.ServiceProcess" + yield "System.Text.Encoding" + yield "System.Text.Encoding.CodePages" + yield "System.Text.Encoding.Extensions" + yield "System.Text.Encodings.Web" + yield "System.Text.Json" + yield "System.Text.RegularExpressions" + yield "System.Threading" + yield "System.Threading.Channels" yield "System.Threading.Overlapped" + yield "System.Threading.Tasks" + yield "System.Threading.Tasks.Dataflow" yield "System.Threading.Tasks.Extensions" + yield "System.Threading.Tasks.Parallel" + yield "System.Threading.Thread" + yield "System.Threading.ThreadPool" + yield "System.Threading.Timer" + yield "System.Transactions" + yield "System.Transactions.Local" + yield "System.ValueTuple" + yield "System.Web" + yield "System.Web.HttpUtility" + yield "System.Web.Services" + yield "System.Windows" + yield "System.Windows.Forms" + yield "System.Xml" + yield "System.Xml.Linq" yield "System.Xml.ReaderWriter" + yield "System.Xml.Serialization" yield "System.Xml.XDocument" + yield "System.Xml.XmlDocument" + yield "System.Xml.XmlSerializer" + yield "System.Xml.XPath" + yield "System.Xml.XPath.XDocument" + yield "WindowsBase" ] // The set of references entered into the TcConfigBuilder for scripts prior to computing the load closure. diff --git a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index b1f2c20fc07..10a562e7e21 100644 --- a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -20,14 +20,38 @@ FSharp.Compiler.Service.nuspec true The F# Compiler Services package For F# $(FSLanguageVersion) exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications. Contains code from the F# Software Foundation. - /blob/main/release-notes.md#FSharp-Compiler-Service-$(FSharpCompilerServiceReleaseNotesVersion) + https://github.com/dotnet/fsharp/blob/main/release-notes.md#FSharp-Compiler-Service-$(FSharpCompilerServiceReleaseNotesVersion) F#, fsharp, interactive, compiler, editor + $(MSBuildThisFileDirectory)logo.png - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -44,7 +68,6 @@ - FSComp.txt diff --git a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.nuspec b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.nuspec index 981ead516c9..80b698bf220 100644 --- a/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.nuspec +++ b/src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.nuspec @@ -4,11 +4,34 @@ $CommonMetadataElements$ en-US - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - $CommonFileElements$ diff --git a/src/fsharp/FSharp.Compiler.Service/logo.png b/src/fsharp/FSharp.Compiler.Service/logo.png new file mode 100644 index 00000000000..9d7b823ec9a Binary files /dev/null and b/src/fsharp/FSharp.Compiler.Service/logo.png differ diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index c8f934f8ed5..91ef240a031 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -494,7 +494,7 @@ All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. - Todas las ramas de una expresión de coincidencia de patrón deben devolver valores del mismo tipo. La primera rama devolvió un valor de tipo "{0}", pero esta rama devolvió un valor de tipo "\{1 \}". + All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index 7dd3b1872ee..9fc529525ff 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -67,7 +67,11 @@ ScriptOptionsTests.fs - + Program.fs diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index f50a4783dc7..c163edb7617 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -117,6 +117,16 @@ type CompilerAssert private () = """ + static let directoryBuildProps = """ + + + true + + + + +""" + static let programFs = """ open System @@ -127,13 +137,17 @@ let main argv = 0""" let mutable output = "" let mutable errors = "" let mutable cleanUp = true - let projectDirectory = Path.Combine(Path.GetTempPath(), "CompilerAssert", Path.GetRandomFileName()) + let pathToArtifacts = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../..")) + if Path.GetFileName(pathToArtifacts) <> "artifacts" then failwith "CompilerAssert did not find artifacts directory --- has the location changed????" + let pathToTemp = Path.Combine(pathToArtifacts, "Temp") + let projectDirectory = Path.Combine(pathToTemp, "CompilerAssert", Path.GetRandomFileName()) let pathToFSharpCore = typeof.Assembly.Location try try Directory.CreateDirectory(projectDirectory) |> ignore let projectFileName = Path.Combine(projectDirectory, "ProjectFile.fsproj") let programFsFileName = Path.Combine(projectDirectory, "Program.fs") + let directoryBuildPropsFileName = Path.Combine(projectDirectory, "Directory.Build.props") let frameworkReferencesFileName = Path.Combine(projectDirectory, "FrameworkReferences.txt") #if NETCOREAPP File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "netcoreapp3.1").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) @@ -141,6 +155,7 @@ let main argv = 0""" File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net472").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) #endif File.WriteAllText(programFsFileName, programFs) + File.WriteAllText(directoryBuildPropsFileName, directoryBuildProps) let pInfo = ProcessStartInfo () pInfo.FileName <- config.DotNetExe @@ -166,7 +181,9 @@ let main argv = 0""" cleanUp <- false printfn "Project directory: %s" projectDirectory printfn "STDOUT: %s" output + File.WriteAllText(Path.Combine(projectDirectory, "project.stdout"), output) printfn "STDERR: %s" errors + File.WriteAllText(Path.Combine(projectDirectory, "project.stderror"), errors) raise (new Exception (sprintf "An error occurred getting netcoreapp references: %A" e)) finally if cleanUp then diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index f49281339ba..c12080d761e 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -3,6 +3,7 @@ open System open System.IO open System.Diagnostics +open System.Reflection open NUnit.Framework open TestFramework open HandleExpects @@ -222,12 +223,15 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = let mutable result = "" lock lockObj <| (fun () -> let rec loop () = - let dir = Path.Combine(Path.GetTempPath(), "FSharp.Cambridge", Path.GetRandomFileName()) - if Directory.Exists(dir) then + let pathToArtifacts = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../..")) + if Path.GetFileName(pathToArtifacts) <> "artifacts" then failwith "FSharp.Cambridge did not find artifacts directory --- has the location changed????" + let pathToTemp = Path.Combine(pathToArtifacts, "Temp") + let projectDirectory = Path.Combine(pathToTemp, "FSharp.Cambridge", Path.GetRandomFileName()) + if Directory.Exists(projectDirectory) then loop () else - Directory.CreateDirectory(dir) |>ignore - dir + Directory.CreateDirectory(projectDirectory) |>ignore + projectDirectory result <- loop()) result diff --git a/tests/service/ScriptOptionsTests.fs b/tests/service/ScriptOptionsTests.fs index f89a861f110..9ceae471bd4 100644 --- a/tests/service/ScriptOptionsTests.fs +++ b/tests/service/ScriptOptionsTests.fs @@ -31,4 +31,27 @@ let ``can generate options for different frameworks regardless of execution envi |> Async.RunSynchronously match errors with | [] -> () - | errors -> failwithf "Error while parsing script with assumeDotNetFramework:%b, useSdkRefs:%b, and otherFlags:%A:\n%A" assumeNetFx useSdk flags errors \ No newline at end of file + | errors -> failwithf "Error while parsing script with assumeDotNetFramework:%b, useSdkRefs:%b, and otherFlags:%A:\n%A" assumeNetFx useSdk flags errors + +[] +[] +[] +let ``all default assembly references are system assemblies``(assumeNetFx, useSdk, flags) = + let path = Path.GetTempPath() + let file = Path.GetTempFileName() + let tempFile = Path.Combine(path, file) + let (options, errors) = + checker.GetProjectOptionsFromScript(tempFile, SourceText.ofString scriptSource, assumeDotNetFramework = assumeNetFx, useSdkRefs = useSdk, otherFlags = flags) + |> Async.RunSynchronously + match errors with + | [] -> () + | errors -> failwithf "Error while parsing script with assumeDotNetFramework:%b, useSdkRefs:%b, and otherFlags:%A:\n%A" assumeNetFx useSdk flags errors + for r in options.OtherOptions do + if r.StartsWith("-r:") then + let ref = Path.GetFullPath(r.[3..]) + let baseName = Path.GetFileNameWithoutExtension(ref) + if not (FSharp.Compiler.DotNetFrameworkDependencies.systemAssemblies.Contains(baseName)) then + printfn "Failing, printing options from GetProjectOptionsFromScript..." + for opt in options.OtherOptions do + printfn "option: %s" opt + failwithf "expected FSharp.Compiler.DotNetFrameworkDependencies.systemAssemblies to contain '%s' because '%s' is a default reference for a script, (assumeNetFx, useSdk, flags) = %A" baseName ref (assumeNetFx, useSdk, flags) \ No newline at end of file