From f78cb7b8dc2deae4d9160815f791b395ea92af44 Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Fri, 23 Feb 2024 14:54:07 +0100 Subject: [PATCH 1/2] Add GetProjectSnapshotFromScript to FSharpChecker (#16735) * Initial attempt for GetProjectSnapshotFromScript * Add GetProjectSnapshotFromScript to service. * Address feedback from code review. * Assert both return the same results. * Remove old comment * Construct cache key in ComputeScriptClosure * Include stamp * Don't take projectSnapshot as input for ComputeScriptClosure * Add other flags * Add checksum directly. * Remove duplicate checksum * Use ISourceTextNew for Source * Mark API as experimental --- src/Compiler/Service/BackgroundCompiler.fs | 48 +++++ src/Compiler/Service/BackgroundCompiler.fsi | 14 ++ src/Compiler/Service/FSharpProjectSnapshot.fs | 2 +- src/Compiler/Service/TransparentCompiler.fs | 167 +++++++++++++++++- src/Compiler/Service/service.fs | 31 ++++ src/Compiler/Service/service.fsi | 28 +++ .../FSharpChecker/TransparentCompiler.fs | 19 +- ...ervice.SurfaceArea.netstandard20.debug.bsl | 1 + ...vice.SurfaceArea.netstandard20.release.bsl | 1 + 9 files changed, 300 insertions(+), 11 deletions(-) diff --git a/src/Compiler/Service/BackgroundCompiler.fs b/src/Compiler/Service/BackgroundCompiler.fs index 54bea5584ad..d66847b5c17 100644 --- a/src/Compiler/Service/BackgroundCompiler.fs +++ b/src/Compiler/Service/BackgroundCompiler.fs @@ -123,6 +123,20 @@ type internal IBackgroundCompiler = userOpName: string -> Async + abstract GetProjectSnapshotFromScript: + fileName: string * + sourceText: ISourceTextNew * + previewEnabled: bool option * + loadedTimeStamp: System.DateTime option * + otherFlags: string array option * + useFsiAuxLib: bool option * + useSdkRefs: bool option * + sdkDirOverride: string option * + assumeDotNetFramework: bool option * + optionsStamp: int64 option * + userOpName: string -> + Async + abstract member GetSemanticClassificationForFile: fileName: string * options: FSharpProjectOptions * userOpName: string -> NodeCode @@ -1595,6 +1609,40 @@ type internal BackgroundCompiler userOpName ) + member _.GetProjectSnapshotFromScript + ( + fileName: string, + sourceText: ISourceTextNew, + previewEnabled: bool option, + loadedTimeStamp: DateTime option, + otherFlags: string array option, + useFsiAuxLib: bool option, + useSdkRefs: bool option, + sdkDirOverride: string option, + assumeDotNetFramework: bool option, + optionsStamp: int64 option, + userOpName: string + ) : Async = + async { + let! options, diagnostics = + self.GetProjectOptionsFromScript( + fileName, + sourceText, + previewEnabled, + loadedTimeStamp, + otherFlags, + useFsiAuxLib, + useSdkRefs, + sdkDirOverride, + assumeDotNetFramework, + optionsStamp, + userOpName + ) + + let! snapshot = FSharpProjectSnapshot.FromOptions(options, DocumentSource.FileSystem) + return snapshot, diagnostics + } + member _.GetSemanticClassificationForFile ( fileName: string, diff --git a/src/Compiler/Service/BackgroundCompiler.fsi b/src/Compiler/Service/BackgroundCompiler.fsi index 6d63c3b93e9..cd7c163a0d1 100644 --- a/src/Compiler/Service/BackgroundCompiler.fsi +++ b/src/Compiler/Service/BackgroundCompiler.fsi @@ -102,6 +102,20 @@ type internal IBackgroundCompiler = userOpName: string -> Async + abstract GetProjectSnapshotFromScript: + fileName: string * + sourceText: ISourceTextNew * + previewEnabled: bool option * + loadedTimeStamp: System.DateTime option * + otherFlags: string array option * + useFsiAuxLib: bool option * + useSdkRefs: bool option * + sdkDirOverride: string option * + assumeDotNetFramework: bool option * + optionsStamp: int64 option * + userOpName: string -> + Async + abstract GetSemanticClassificationForFile: fileName: string * snapshot: FSharpProjectSnapshot * userOpName: string -> NodeCode diff --git a/src/Compiler/Service/FSharpProjectSnapshot.fs b/src/Compiler/Service/FSharpProjectSnapshot.fs index a5ae2447db6..7ab252ef73b 100644 --- a/src/Compiler/Service/FSharpProjectSnapshot.fs +++ b/src/Compiler/Service/FSharpProjectSnapshot.fs @@ -123,7 +123,7 @@ type FSharpFileSnapshot(FileName: string, Version: string, GetSource: unit -> Ta /// A source file snapshot with loaded source text. type internal FSharpFileSnapshotWithSource - (FileName: string, SourceHash: ImmutableArray, Source: ISourceText, IsLastCompiland: bool, IsExe: bool) = + (FileName: string, SourceHash: ImmutableArray, Source: ISourceTextNew, IsLastCompiland: bool, IsExe: bool) = let version = lazy (SourceHash.ToBuilder().ToArray()) let stringVersion = lazy (version.Value |> BitConverter.ToString) diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index 19d383d00bd..e85488e7738 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -1,6 +1,7 @@ namespace FSharp.Compiler.CodeAnalysis.TransparentCompiler open System +open System.Linq open System.Collections.Generic open System.Runtime.CompilerServices open System.Diagnostics @@ -377,26 +378,51 @@ type internal TransparentCompiler let ComputeScriptClosure (fileName: string) - (source: ISourceText) + (source: ISourceTextNew) (defaultFSharpBinariesDir: string) (useSimpleResolution: bool) (useFsiAuxLib: bool option) (useSdkRefs: bool option) (sdkDirOverride: string option) (assumeDotNetFramework: bool option) - (projectSnapshot: ProjectSnapshot) + (projectIdentifier: ProjectIdentifier) + (otherOptions: string list) + (stamp: int64 option) = + let useFsiAuxLib = defaultArg useFsiAuxLib true + let useSdkRefs = defaultArg useSdkRefs true + let assumeDotNetFramework = defaultArg assumeDotNetFramework false + + let key = + { new ICacheKey with + member _.GetKey() = fileName, projectIdentifier + member _.GetLabel() = $"ScriptClosure for %s{fileName}" + + member _.GetVersion() = + Md5Hasher.empty + |> Md5Hasher.addStrings + [| + yield! otherOptions + match stamp with + | None -> () + | Some stamp -> string stamp + |] + |> Md5Hasher.addBytes (source.GetChecksum().ToArray()) + |> Md5Hasher.addBool useFsiAuxLib + |> Md5Hasher.addBool useFsiAuxLib + |> Md5Hasher.addBool useSdkRefs + |> Md5Hasher.addBool assumeDotNetFramework + |> Md5Hasher.toString + } + caches.ScriptClosure.Get( - projectSnapshot.FileKey fileName, + key, node { - let useFsiAuxLib = defaultArg useFsiAuxLib true - let useSdkRefs = defaultArg useSdkRefs true let reduceMemoryUsage = ReduceMemoryFlag.Yes - let assumeDotNetFramework = defaultArg assumeDotNetFramework false let applyCompilerOptions tcConfig = let fsiCompilerOptions = GetCoreFsiCompilerOptions tcConfig - ParseCompilerOptions(ignore, fsiCompilerOptions, projectSnapshot.OtherOptions) + ParseCompilerOptions(ignore, fsiCompilerOptions, otherOptions) let closure = LoadClosure.ComputeClosureOfScriptText( @@ -665,7 +691,9 @@ type internal TransparentCompiler None None None - projectSnapshot + projectSnapshot.Identifier + projectSnapshot.OtherOptions + projectSnapshot.Stamp return (Some closure) } @@ -1521,7 +1549,9 @@ type internal TransparentCompiler (Some tcConfig.useSdkRefs) tcConfig.sdkDirOverride (Some tcConfig.assumeDotNetFramework) - projectSnapshot + projectSnapshot.Identifier + projectSnapshot.OtherOptions + projectSnapshot.Stamp let typedResults = FSharpCheckFileResults.Make( @@ -2111,6 +2141,125 @@ type internal TransparentCompiler userOpName ) + member this.GetProjectSnapshotFromScript + ( + fileName: string, + sourceText: ISourceTextNew, + previewEnabled: bool option, + loadedTimeStamp: DateTime option, + otherFlags: string array option, + useFsiAuxLib: bool option, + useSdkRefs: bool option, + sdkDirOverride: string option, + assumeDotNetFramework: bool option, + optionsStamp: int64 option, + userOpName: string + ) : Async = + use _ = + Activity.start + "BackgroundCompiler.GetProjectOptionsFromScript" + [| Activity.Tags.fileName, fileName; Activity.Tags.userOpName, userOpName |] + + async { + // Use the same default as the background compiler. + let useFsiAuxLib = defaultArg useFsiAuxLib true + let useSdkRefs = defaultArg useSdkRefs true + let previewEnabled = defaultArg previewEnabled false + + // Do we assume .NET Framework references for scripts? + let assumeDotNetFramework = defaultArg assumeDotNetFramework true + + let extraFlags = + if previewEnabled then + [| "--langversion:preview" |] + else + [||] + + let otherFlags = defaultArg otherFlags extraFlags + use diagnostics = new DiagnosticsScope(otherFlags |> Array.contains "--flaterrors") + + let useSimpleResolution = + otherFlags |> Array.exists (fun x -> x = "--simpleresolution") + + let loadedTimeStamp = defaultArg loadedTimeStamp DateTime.MaxValue // Not 'now', we don't want to force reloading + let projectFileName = fileName + ".fsproj" + + let currentSourceFile = + FSharpFileSnapshot.Create(fileName, sourceText.GetHashCode().ToString(), (fun () -> Task.FromResult sourceText)) + + let! loadClosure = + ComputeScriptClosure + fileName + sourceText + FSharpCheckerResultsSettings.defaultFSharpBinariesDir + useSimpleResolution + (Some useFsiAuxLib) + (Some useSdkRefs) + sdkDirOverride + (Some assumeDotNetFramework) + (projectFileName, fileName) + (List.ofArray otherFlags) + optionsStamp + |> Async.AwaitNodeCode + + let otherFlags = + [ + yield "--noframework" + yield "--warn:3" + yield! otherFlags + for code, _ in loadClosure.NoWarns do + yield "--nowarn:" + code + ] + + let sourceFiles = + loadClosure.SourceFiles + |> List.map (fun (sf, _) -> + if sf = fileName then + currentSourceFile + else + FSharpFileSnapshot.CreateFromFileSystem sf) + + let references = + loadClosure.References + |> List.map (fun (r, _) -> + let lastModified = FileSystem.GetLastWriteTimeShim r + + { + Path = r + LastModified = lastModified + }) + + let snapshot = + FSharpProjectSnapshot.Create( + fileName + ".fsproj", + None, + sourceFiles, + references, + otherFlags, + List.empty, + false, + true, + loadedTimeStamp, + Some(FSharpUnresolvedReferencesSet(loadClosure.UnresolvedReferences)), + loadClosure.OriginalLoadReferences, + optionsStamp + ) + + let diags = + loadClosure.LoadClosureRootFileDiagnostics + |> List.map (fun (exn, isError) -> + FSharpDiagnostic.CreateFromException( + exn, + isError, + range.Zero, + false, + otherFlags |> List.contains "--flaterrors", + None + )) + + return snapshot, (diags @ diagnostics.Diagnostics) + } + member this.GetSemanticClassificationForFile(fileName: string, snapshot: FSharpProjectSnapshot, userOpName: string) = node { ignore userOpName diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 82b43827e1f..94dce6286b5 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -557,6 +557,37 @@ type FSharpChecker userOpName ) + /// For a given script file, get the ProjectSnapshot implied by the #load closure + member _.GetProjectSnapshotFromScript + ( + fileName, + source, + ?previewEnabled, + ?loadedTimeStamp, + ?otherFlags, + ?useFsiAuxLib, + ?useSdkRefs, + ?assumeDotNetFramework, + ?sdkDirOverride, + ?optionsStamp: int64, + ?userOpName: string + ) = + let userOpName = defaultArg userOpName "Unknown" + + backgroundCompiler.GetProjectSnapshotFromScript( + fileName, + source, + previewEnabled, + loadedTimeStamp, + otherFlags, + useFsiAuxLib, + useSdkRefs, + sdkDirOverride, + assumeDotNetFramework, + optionsStamp, + userOpName + ) + member _.GetProjectOptionsFromCommandLineArgs(projectFileName, argv, ?loadedTimeStamp, ?isInteractive, ?isEditing) = let isEditing = defaultArg isEditing false let isInteractive = defaultArg isInteractive false diff --git a/src/Compiler/Service/service.fsi b/src/Compiler/Service/service.fsi index b8e87b805f8..cb8272b0f69 100644 --- a/src/Compiler/Service/service.fsi +++ b/src/Compiler/Service/service.fsi @@ -251,6 +251,34 @@ type public FSharpChecker = ?userOpName: string -> Async + /// Used to differentiate between scripts, to consider each script a separate project. Also used in formatted error messages. + /// The source for the file. + /// Is the preview compiler enabled. + /// Indicates when the script was loaded into the editing environment, + /// so that an 'unload' and 'reload' action will cause the script to be considered as a new project, + /// so that references are re-resolved. + /// Other flags for compilation. + /// Add a default reference to the FSharp.Compiler.Interactive.Settings library. + /// Use the implicit references from the .NET SDK. + /// Set up compilation and analysis for .NET Framework scripts. + /// Override the .NET SDK used for default references. + /// An optional unique stamp for the options. + /// An optional string used for tracing compiler operations associated with this request. + [] + member GetProjectSnapshotFromScript: + fileName: string * + source: ISourceTextNew * + ?previewEnabled: bool * + ?loadedTimeStamp: DateTime * + ?otherFlags: string[] * + ?useFsiAuxLib: bool * + ?useSdkRefs: bool * + ?assumeDotNetFramework: bool * + ?sdkDirOverride: string * + ?optionsStamp: int64 * + ?userOpName: string -> + Async + /// Get the FSharpProjectOptions implied by a set of command line arguments. /// /// Used to differentiate between projects and for the base directory of the project. diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs index cbc8e7690fe..2adb305a2ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs @@ -3,6 +3,7 @@ open System.Collections.Concurrent open System.Diagnostics open FSharp.Compiler.CodeAnalysis +open FSharp.Compiler.Text open Internal.Utilities.Collections open FSharp.Compiler.CodeAnalysis.TransparentCompiler open Internal.Utilities.Library.Extras @@ -894,4 +895,20 @@ let ``LoadClosure for script is recomputed after changes`` () = |> Seq.map (fun (k, g) -> k, g |> Seq.map fst |> Seq.toList) |> Map - Assert.Equal([Weakened; Requested; Started; Finished; Weakened; Requested; Started; Finished], closureComputations["FileFirst.fs"]) \ No newline at end of file + Assert.Equal([Weakened; Requested; Started; Finished; Weakened; Requested; Started; Finished], closureComputations["FileFirst.fs"]) + +[] +let ``Background compiler and Transparent compiler return the same options`` () = + async { + let backgroundChecker = FSharpChecker.Create(useTransparentCompiler = false) + let transparentChecker = FSharpChecker.Create(useTransparentCompiler = true) + let scriptName = Path.Combine(__SOURCE_DIRECTORY__, "script.fsx") + let content = SourceTextNew.ofString "" + + let! backgroundSnapshot, backgroundDiags = backgroundChecker.GetProjectSnapshotFromScript(scriptName, content) + let! transparentSnapshot, transparentDiags = transparentChecker.GetProjectSnapshotFromScript(scriptName, content) + Assert.Empty(backgroundDiags) + Assert.Empty(transparentDiags) + Assert.Equal(backgroundSnapshot.OtherOptions, transparentSnapshot.OtherOptions) + Assert.Equal(backgroundSnapshot.ReferencesOnDisk, transparentSnapshot.ReferencesOnDisk) + } diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index e526351effd..69fb762ea84 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -2067,6 +2067,7 @@ FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, Int32, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults]] GetBackgroundCheckResultsForFileInProject(System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Diagnostics.FSharpDiagnostic[],System.Int32]] Compile(System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpParsingOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index e526351effd..69fb762ea84 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -2067,6 +2067,7 @@ FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileAnswer]] ParseAndCheckFileInProject(System.String, Int32, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpParseFileResults,FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults]] GetBackgroundCheckResultsForFileInProject(System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.FSharpProjectOptions,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectOptionsFromScript(System.String, FSharp.Compiler.Text.ISourceText, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.CodeAnalysis.ProjectSnapshot+FSharpProjectSnapshot,Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Diagnostics.FSharpDiagnostic]]] GetProjectSnapshotFromScript(System.String, FSharp.Compiler.Text.ISourceTextNew, Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.String[]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Int64], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Diagnostics.FSharpDiagnostic[],System.Int32]] Compile(System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, FSharp.Compiler.Text.ISourceText, FSharp.Compiler.CodeAnalysis.FSharpParsingOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.CodeAnalysis.FSharpChecker: Microsoft.FSharp.Control.FSharpAsync`1[System.Tuple`2[FSharp.Compiler.Text.Range,FSharp.Compiler.Text.Range][]] MatchBraces(System.String, System.String, FSharp.Compiler.CodeAnalysis.FSharpProjectOptions, Microsoft.FSharp.Core.FSharpOption`1[System.String]) From d071ddc854baf5fa016987360d5216739c251da1 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Fri, 23 Feb 2024 15:57:33 +0100 Subject: [PATCH 2/2] WIP: Use Arcade's NetCurrent (#16682) * WIP: Use Arcade's NetCurrent * WIP: Use Arcade's NetCurrent * Ordering of property groups * Build scripts? * Typo * Typo2 * Fix nuspec, please * Updates to support VMR build * Only set tfm option if SourceBuildBootstrapTfm is set * Fix ordering, set tfm before we account for building without arcade * Add rest of test projects * typos * Trimming is isolated and can't use global TFM value * Fix arcade interaction with our build props --------- Co-authored-by: Matt Thalman Co-authored-by: Petr --- Directory.Build.props | 43 +++++++--- FSharpTests.Directory.Build.props | 6 +- buildtools/AssemblyCheck/AssemblyCheck.fsproj | 2 +- .../FSharp.Compiler.Service_notshipped.fsproj | 4 +- buildtools/fslex/fslex.fsproj | 2 +- buildtools/fsyacc/fsyacc.fsproj | 2 +- eng/Build.ps1 | 80 ++++++++++--------- eng/DumpPackageRoot/DumpPackageRoot.csproj | 2 +- eng/SourceBuild.props | 6 +- eng/build-utils.ps1 | 9 ++- eng/build.sh | 17 ++-- eng/test-determinism.ps1 | 3 +- .../EditorService/EditorService.fsproj | 2 +- src/Compiler/FSharp.Compiler.Service.fsproj | 6 +- .../Microsoft.FSharp.Compiler.fsproj | 3 +- .../Microsoft.FSharp.Compiler.nuspec | 28 +++---- src/fsc/fscProject/fsc.fsproj | 6 +- src/fsi/fsiProject/fsi.fsproj | 6 +- .../BasicProvider.DesignTime.fsproj | 2 +- .../BasicProvider.Tests.fsproj | 2 +- .../BasicProvider/BasicProvider.fsproj | 2 +- .../FSharp.Build.UnitTests.fsproj | 4 +- .../FSharp.Compiler.ComponentTests.fsproj | 4 +- ...ompiler.Private.Scripting.UnitTests.fsproj | 4 +- .../FSharp.Compiler.Service.Tests.fsproj | 4 +- .../FSharp.Compiler.UnitTests.fsproj | 4 +- .../FSharp.Core.UnitTests.fsproj | 4 +- .../FSharp.Test.Utilities.fsproj | 4 +- .../MicroPerf/CS/MicroPerfCSharp.csproj | 2 +- .../MicroPerf/MicroPerf.fsproj | 2 +- .../TaskPerf/TaskPerf/TaskPerf.fsproj | 2 +- .../TaskPerfCSharp/TaskPerfCSharp.csproj | 2 +- .../HistoricalBenchmark.Runner.fsproj | 2 +- .../HistoricalBenchmark.fsproj | 2 +- .../FSharp.Compiler.Benchmarks.fsproj | 2 +- .../FCSSourceFiles/FCSSourceFiles.fsproj | 2 +- .../FSharp.Benchmarks.Common.fsproj | 2 +- tests/fsharp/FSharpSuite.Tests.fsproj | 4 +- .../Sample_ConsoleApp_net7.fsproj | 6 +- .../Sample_ConsoleApp_net7.fsproj | 6 +- .../LocalCompilerAndFslib.fsproj | 6 +- .../tailcallaltattr.fsproj | 2 +- 42 files changed, 172 insertions(+), 131 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index ed0556c07fa..3dd057f702b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,12 +4,12 @@ $(FSharpLangVersion) $(MSBuildThisFileDirectory) true + net8.0 @@ -21,7 +21,7 @@ true - + false @@ -30,15 +30,40 @@ $(MSBuildThisFileDirectory)artifacts/ $(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/ $(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/ - $(ArtifactsDir)/bin/fslex/$(Configuration)/net8.0/fslex.dll - $(ArtifactsDir)/bin/fsyacc/$(Configuration)/net8.0/fsyacc.dll + + $(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/fslex.dll + $(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/fsyacc.dll NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants) + - + + + + + + + $(NetCurrent) + + + + + $(FSharpNetCoreProductDefaultTargetFramework) + + + - - + + diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 03c26b4b075..2be5d4f2702 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -22,18 +22,18 @@ $([System.IO.Path]::GetDirectoryName('$(DOTNET_HOST_PATH)')) dotnet.exe dotnet - $(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\net8.0\fsc.dll + $(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(FSharpNetCoreProductTargetFramework)\fsc.dll $([System.IO.Path]::GetDirectoryName('$(DOTNET_HOST_PATH)')) dotnet.exe dotnet - $(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\net8.0\fsi.dll + $(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\$(FSharpNetCoreProductTargetFramework)\fsi.dll <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'!='Core'">net472 - <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'=='Core'">net8.0 + <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'=='Core'">$(FSharpNetCoreProductTargetFramework) <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(_FSharpBuildTargetFramework) $(_FSharpBuildBinPath)\FSharp.Build.dll diff --git a/buildtools/AssemblyCheck/AssemblyCheck.fsproj b/buildtools/AssemblyCheck/AssemblyCheck.fsproj index 46ffb722cd4..1f01406c734 100644 --- a/buildtools/AssemblyCheck/AssemblyCheck.fsproj +++ b/buildtools/AssemblyCheck/AssemblyCheck.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) true false diff --git a/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj b/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj index 514b1f4ddf6..8a0874bff6a 100644 --- a/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj +++ b/buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj @@ -1,9 +1,9 @@  - + - net8.0 + $(FSharpNetCoreProductTargetFramework) true $(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid()) $(CachePath)\bin diff --git a/buildtools/fslex/fslex.fsproj b/buildtools/fslex/fslex.fsproj index 674dde7c759..50c1e4e3668 100644 --- a/buildtools/fslex/fslex.fsproj +++ b/buildtools/fslex/fslex.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) true false LatestMajor diff --git a/buildtools/fsyacc/fsyacc.fsproj b/buildtools/fsyacc/fsyacc.fsproj index fc072b7cf02..0cc67482b3a 100644 --- a/buildtools/fsyacc/fsyacc.fsproj +++ b/buildtools/fsyacc/fsyacc.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) true false LatestMajor diff --git a/eng/Build.ps1 b/eng/Build.ps1 index fe7eb56a5b1..049ba91217d 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -36,6 +36,7 @@ param ( [switch][Alias('proto')]$bootstrap, [string]$bootstrapConfiguration = "Proto", [string]$bootstrapTfm = "net472", + [string]$fsharpNetCoreProductTfm = "net8.0", [switch][Alias('bl')]$binaryLog = $true, [switch][Alias('nobl')]$excludeCIBinaryLog = $false, [switch][Alias('nolog')]$noBinaryLog = $false, @@ -76,6 +77,9 @@ $ErrorActionPreference = "Stop" $BuildCategory = "" $BuildMessage = "" +$desktopTargetFramework = "net472" +$coreclrTargetFramework = "net8.0" + function Print-Usage() { Write-Host "Common settings:" Write-Host " -configuration Build configuration: 'Debug' or 'Release' (short: -c)" @@ -229,11 +233,11 @@ function Process-Arguments() { function Update-Arguments() { if ($script:noVisualStudio) { - $script:bootstrapTfm = "net8.0" + $script:bootstrapTfm = $script:coreclrTargetFramework $script:msbuildEngine = "dotnet" } - if ($bootstrapTfm -eq "net8.0") { + if ($bootstrapTfm -eq $script:coreclrTargetFramework) { if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.runtimeconfig.json")) { $script:bootstrap = $True } @@ -255,7 +259,7 @@ function BuildSolution([string] $solutionName, $nopack) { $officialBuildId = if ($official) { $env:BUILD_BUILDNUMBER } else { "" } $toolsetBuildProj = InitializeToolset $quietRestore = !$ci - $testTargetFrameworks = if ($testCoreClr) { "net8.0" } else { "" } + $testTargetFrameworks = if ($testCoreClr) { $script:coreclrTargetFramework } else { "" } # Do not set the property to true explicitly, since that would override value projects might set. $suppressExtensionDeployment = if (!$deployExtensions) { "/p:DeployExtension=false" } else { "" } @@ -312,8 +316,8 @@ function UpdatePath() { } TestAndAddToPath $subdir - TestAndAddToPath "$ArtifactsDir\bin\fsc\$configuration\net472" - TestAndAddToPath "$ArtifactsDir\bin\fsiAnyCpu\$configuration\net472" + TestAndAddToPath "$ArtifactsDir\bin\fsc\$configuration\$script:desktopTargetFramework" + TestAndAddToPath "$ArtifactsDir\bin\fsiAnyCpu\$configuration\$script:desktopTargetFramework" } function VerifyAssemblyVersionsAndSymbols() { @@ -565,18 +569,16 @@ try { $script:BuildCategory = "Test" $script:BuildMessage = "Failure running tests" - $desktopTargetFramework = "net472" - $coreclrTargetFramework = "net8.0" if ($testCoreClr) { - $bgJob = TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true + $bgJob = TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.UnitTests\" - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.UnitTests\" + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" # Collect output from background jobs Wait-job $bgJob | out-null @@ -584,14 +586,14 @@ try { } if ($testDesktop) { - $bgJob = TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true + $bgJob = TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.UnitTests\" - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.UnitTests\" + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" # Collect output from background jobs Wait-job $bgJob | out-null @@ -609,7 +611,7 @@ try { UpdatePath $env:HOSTED_COMPILER = 1 $env:CSC_PIPE = "$nugetPackages\Microsoft.Net.Compilers\4.3.0-1.22220.8\tools\csc.exe" - $env:FSCOREDLLPATH = "$ArtifactsDir\bin\fsc\$configuration\net472\FSharp.Core.dll" + $env:FSCOREDLLPATH = "$ArtifactsDir\bin\fsc\$configuration\$script:desktopTargetFramework\FSharp.Core.dll" $env:LINK_EXE = "$RepoRoot\tests\fsharpqa\testenv\bin\link\link.exe" $env:OSARCH = $env:PROCESSOR_ARCHITECTURE @@ -626,46 +628,46 @@ try { } if ($testFSharpCore) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\" } if ($testCompiler) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.UnitTests\" - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.UnitTests\" + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.UnitTests\" } if ($testCompilerComponentTests) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -noTestFilter $true } if ($testCompilerService) { - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\" } if ($testCambridge) { - TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" - TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" + TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" + TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" } if ($testScripting) { - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" - TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\" } if ($testVs -and -not $noVisualStudio) { - TestUsingXUnit -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" - TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\VisualFSharp.UnitTests\" + TestUsingXUnit -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" + TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\VisualFSharp.UnitTests\" } if ($testIntegration) { - TestUsingXUnit -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.IntegrationTests\" + TestUsingXUnit -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.IntegrationTests\" } if ($testAOT) { diff --git a/eng/DumpPackageRoot/DumpPackageRoot.csproj b/eng/DumpPackageRoot/DumpPackageRoot.csproj index 5cbfdca4db5..da79505fcf1 100644 --- a/eng/DumpPackageRoot/DumpPackageRoot.csproj +++ b/eng/DumpPackageRoot/DumpPackageRoot.csproj @@ -3,7 +3,7 @@ - net8.0 + $(FSharpNetCoreProductTargetFramework) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 3ac9370d1a5..550215bd643 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -24,6 +24,10 @@ + + + --tfm $(SourceBuildBootstrapTfm) + diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index a0c5299cb95..f73195c7ccd 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -14,6 +14,7 @@ $nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { $false } $bootstrapDir = if (Test-Path variable:bootstrapDir) { $bootstrapDir } else { "" } $bootstrapConfiguration = if (Test-Path variable:bootstrapConfiguration) { $bootstrapConfiguration } else { "Proto" } $bootstrapTfm = if (Test-Path variable:bootstrapTfm) { $bootstrapTfm } else { "net472" } +$fsharpNetCoreProductTfm = if (Test-Path variable:fsharpNetCoreProductTfm) { $fsharpNetCoreProductTfm } else { "net8.0" } $properties = if (Test-Path variable:properties) { $properties } else { @() } function GetProjectOutputBinary([string]$fileName, [string]$projectName = "", [string]$configuration = $script:configuration, [string]$tfm = "net472", [string]$rid = "", [bool]$published = $false) { @@ -230,7 +231,7 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] # Important to not set $script:bootstrapDir here yet as we're actually in the process of # building the bootstrap. function Make-BootstrapBuild() { - Write-Host "Building bootstrap '$bootstrapTfm' compiler" + Write-Host "Building bootstrap '$bootstrapTfm' compiler with '$fsharpNetCoreProductTfm' .NET Core product TFM" $dir = Join-Path $ArtifactsDir "Bootstrap" Remove-Item -re $dir -ErrorAction SilentlyContinue @@ -251,9 +252,9 @@ function Make-BootstrapBuild() { } Exec-Console $dotnetExe $args - Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\net8.0" -Destination "$dir\fslex" -Force -Recurse - Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\net8.0" -Destination "$dir\fsyacc" -Force -Recurse - Copy-Item "$ArtifactsDir\bin\AssemblyCheck\$bootstrapConfiguration\net8.0" -Destination "$dir\AssemblyCheck" -Force -Recurse + Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\$fsharpNetCoreProductTfm" -Destination "$dir\fslex" -Force -Recurse + Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\$fsharpNetCoreProductTfm" -Destination "$dir\fsyacc" -Force -Recurse + Copy-Item "$ArtifactsDir\bin\AssemblyCheck\$bootstrapConfiguration\$fsharpNetCoreProductTfm" -Destination "$dir\AssemblyCheck" -Force -Recurse # prepare compiler $protoProject = "`"$RepoRoot\proto.sln`"" diff --git a/eng/build.sh b/eng/build.sh index b8915397d25..6e5d09b79d5 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -34,6 +34,7 @@ usage() echo " --skipBuild Do not run the build" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --sourceBuild Simulate building for source-build" + echo " --tfm Override the default target framework" echo "" echo "Command line arguments starting with '/p:' are passed through to MSBuild." } @@ -72,6 +73,8 @@ properties="" docker=false args="" +tfm="net8.0" # This needs to be changed every time it's bumped by arcade/us. + BuildCategory="" BuildMessage="" @@ -149,6 +152,10 @@ while [[ $# > 0 ]]; do --sourcebuild) source_build=true ;; + --tfm) + tfm=$2 + shift + ;; /p:*) properties="$properties $1" ;; @@ -269,8 +276,8 @@ function BuildSolution { MSBuild "$repo_root/buildtools/buildtools.proj" /restore "$bltools" /p:Configuration=$bootstrap_config mkdir -p "$bootstrap_dir" - cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/net8.0 $bootstrap_dir/fslex - cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/net8.0 $bootstrap_dir/fsyacc + cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/$tfm $bootstrap_dir/fslex + cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/$tfm $bootstrap_dir/fsyacc fi if [ ! -f "$bootstrap_dir/fsc.exe" ]; then local bltools="" @@ -279,7 +286,7 @@ function BuildSolution { fi BuildMessage="Error building bootstrap" MSBuild "$repo_root/Proto.sln" /restore "$bltools" /p:Configuration=$bootstrap_config - cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/net8.0 $bootstrap_dir/fsc + cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/$tfm $bootstrap_dir/fsc fi fi @@ -321,7 +328,7 @@ InitializeDotNetCli $restore BuildSolution if [[ "$test_core_clr" == true ]]; then - coreclrtestframework=net8.0 + coreclrtestframework=$tfm TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework --notestfilter TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj" --targetframework $coreclrtestframework --notestfilter TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj" --targetframework $coreclrtestframework @@ -331,7 +338,7 @@ if [[ "$test_core_clr" == true ]]; then fi if [[ "$test_compilercomponent_tests" == true ]]; then - coreclrtestframework=net8.0 + coreclrtestframework=$tfm TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework --notestfilter fi diff --git a/eng/test-determinism.ps1 b/eng/test-determinism.ps1 index 5b9a079f078..499c1187a0d 100644 --- a/eng/test-determinism.ps1 +++ b/eng/test-determinism.ps1 @@ -378,9 +378,10 @@ try { $script:bootstrap = $true $script:bootstrapConfiguration = "Proto" $script:bootstrapTfm = "net472" + $script:fsharpNetCoreProductTfm = "net8.0" if ($script:msbuildEngine -eq "dotnet") { - $script.bootstrapTfm = "net8.0" + $script.bootstrapTfm = $script:fsharpNetCoreProductTfm } $bootstrapDir = Make-BootstrapBuild diff --git a/fcs-samples/EditorService/EditorService.fsproj b/fcs-samples/EditorService/EditorService.fsproj index e4103999fcb..214bb75afc9 100644 --- a/fcs-samples/EditorService/EditorService.fsproj +++ b/fcs-samples/EditorService/EditorService.fsproj @@ -1,7 +1,7 @@  - $(FcsTargetNetFxFramework);net8.0 + $(FcsTargetNetFxFramework);$(FSharpNetCoreProductTargetFramework) true Exe false diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index dd7b6e25c1a..6a52de46022 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -543,15 +543,15 @@ - TargetFramework=net8.0 + TargetFramework=$(FSharpNetCoreProductTargetFramework) compile - TargetFramework=net8.0 + TargetFramework=$(FSharpNetCoreProductTargetFramework) compile - TargetFramework=net8.0 + TargetFramework=$(FSharpNetCoreProductTargetFramework) compile diff --git a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj index a427f7006dd..7c186a76bb4 100644 --- a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj +++ b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj @@ -3,7 +3,7 @@ true Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) Microsoft.FSharp.Compiler.nuspec true .NET Core compatible version of the F# compiler fsc.exe. @@ -24,6 +24,7 @@ + diff --git a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec index ca36309d5da..24df391b69f 100644 --- a/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec +++ b/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.nuspec @@ -4,7 +4,7 @@ $CommonMetadataElements$ en-US - + @@ -26,16 +26,16 @@ this approach gives a very small deployment. Which is kind of necessary. --> - - - - - - + + + + + + + target="lib\$fSharpNetCoreProductTargetFramework$" /> + target="lib\$fSharpNetCoreProductTargetFramework$" /> @@ -45,14 +45,14 @@ - + + target="lib\$fSharpNetCoreProductTargetFramework$" /> - + target="lib\$fSharpNetCoreProductTargetFramework$" /> + + target="lib\$fSharpNetCoreProductTargetFramework$" /> diff --git a/src/fsc/fscProject/fsc.fsproj b/src/fsc/fscProject/fsc.fsproj index 64c4651a7f4..b382709200d 100644 --- a/src/fsc/fscProject/fsc.fsproj +++ b/src/fsc/fscProject/fsc.fsproj @@ -3,15 +3,15 @@ - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) x86 Debug;Release;Proto;ReleaseCompressed net472 - net8.0 + $(FSharpNetCoreProductTargetFramework) x86 diff --git a/src/fsi/fsiProject/fsi.fsproj b/src/fsi/fsiProject/fsi.fsproj index dd17f8bd53d..653122fc76d 100644 --- a/src/fsi/fsiProject/fsi.fsproj +++ b/src/fsi/fsiProject/fsi.fsproj @@ -3,15 +3,15 @@ - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) x86 Debug;Release;Proto;ReleaseCompressed net472 - net8.0 + $(FSharpNetCoreProductTargetFramework) x86 diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj index b05e1882f6e..ba15e56c359 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.DesignTime/BasicProvider.DesignTime.fsproj @@ -2,7 +2,7 @@ Library - net8.0;net472 + $(FSharpNetCoreProductTargetFramework);net472 typeproviders NO_GENERATIVE IS_DESIGNTIME diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj index 5da0cbb3bfb..da2c065fe49 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj @@ -2,7 +2,7 @@ Library - net8.0 + $(FSharpNetCoreProductTargetFramework) $(TestTargetFramework) false NO_GENERATIVE diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj index 96006f06673..4a8d1df2302 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider/BasicProvider.fsproj @@ -2,7 +2,7 @@ Library - net8.0;net472 + $(FSharpNetCoreProductTargetFramework);net472 typeproviders $(FSharpCoreShippedPackageVersionValue) typeproviders diff --git a/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj b/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj index e3c796d0bdd..0a2421f3262 100644 --- a/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj +++ b/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj @@ -3,8 +3,8 @@ - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) Library true xunit diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index ec4fc441f29..ebfe6938aa8 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -3,8 +3,8 @@ - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) Library false true diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj index cdfd467e5c3..8f69b337c5a 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj @@ -2,8 +2,8 @@ - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) Library true xunit 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 780ba10f3f4..59b5fc43d65 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -3,8 +3,8 @@ Exe - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) $(NoWarn);44;75; true false diff --git a/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj b/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj index 0e4b91b42a7..dd3e21cea91 100644 --- a/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj +++ b/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj @@ -3,8 +3,8 @@ - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) Library true $(DefineConstants);ASSUME_PREVIEW_FSHARP_CORE diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 4b6c5c53481..9acbcef398e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -3,8 +3,8 @@ - net8.0;net472 - net8.0 + $(FSharpNetCoreProductTargetFramework);net472 + $(FSharpNetCoreProductTargetFramework) Library FSharp.Core.UnitTests diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index 8c18161775f..0bee6d1e015 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -1,8 +1,8 @@  - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) win-x86;win-x64;linux-x64;osx-x64 $(AssetTargetFallback);portable-net45+win8+wp8+wpa81 true diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/CS/MicroPerfCSharp.csproj b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/CS/MicroPerfCSharp.csproj index 50bba8f6f23..168c8b546e6 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/CS/MicroPerfCSharp.csproj +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/CS/MicroPerfCSharp.csproj @@ -1,7 +1,7 @@ - net8.0 + $(FSharpNetCoreProductTargetFramework) Library 8.0 diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/MicroPerf.fsproj b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/MicroPerf.fsproj index 919c4cc073c..c96d342298f 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/MicroPerf.fsproj +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/MicroPerf.fsproj @@ -1,6 +1,6 @@ - net8.0 + $(FSharpNetCoreProductTargetFramework) Exe true diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fsproj b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fsproj index 9706167ff62..31d404fb061 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fsproj +++ b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fsproj @@ -1,7 +1,7 @@  - net8.0 + $(FSharpNetCoreProductTargetFramework) Exe true diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.csproj b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.csproj index d23714e40f2..29148a7450d 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.csproj +++ b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.csproj @@ -1,7 +1,7 @@  - net8.0 + $(FSharpNetCoreProductTargetFramework) Library 8.0 diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/HistoricalBenchmark.Runner.fsproj b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/HistoricalBenchmark.Runner.fsproj index fe6d95f9050..1781b4784dc 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/HistoricalBenchmark.Runner.fsproj +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/HistoricalBenchmark.Runner.fsproj @@ -1,7 +1,7 @@ - net8.0 + $(FSharpNetCoreProductTargetFramework) true HistoricalBenchmark.Utilities $(NoWarn);NETSDK1206 diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj index 09ca5cb6912..48cfa7b4975 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) true Release diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj index 043de02d374..c7a873a2cc4 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) true false diff --git a/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/FCSSourceFiles.fsproj b/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/FCSSourceFiles.fsproj index 92255adb462..265ab45ac19 100644 --- a/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/FCSSourceFiles.fsproj +++ b/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/FCSSourceFiles.fsproj @@ -2,7 +2,7 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) true diff --git a/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj b/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj index 2e6b2e9ceb7..615a5ab3a77 100644 --- a/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj +++ b/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj @@ -1,7 +1,7 @@  - net8.0 + $(FSharpNetCoreProductTargetFramework) true diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index b6d69d8ae1a..ac97046351b 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -2,8 +2,8 @@ - net472;net8.0 - net8.0 + net472;$(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) win-x86;win-x64 $(AssetTargetFallback);portable-net45+win8+wp8+wpa81 true diff --git a/tests/projects/Sample_ConsoleApp_FileSystemTests/Sample_ConsoleApp_net7.fsproj b/tests/projects/Sample_ConsoleApp_FileSystemTests/Sample_ConsoleApp_net7.fsproj index 13d42aeb283..6fa21d9b264 100644 --- a/tests/projects/Sample_ConsoleApp_FileSystemTests/Sample_ConsoleApp_net7.fsproj +++ b/tests/projects/Sample_ConsoleApp_FileSystemTests/Sample_ConsoleApp_net7.fsproj @@ -2,13 +2,13 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) true - $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/net8.0/fsc.dll - $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/net8.0/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/$(FSharpNetCoreProductTargetFramework)/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/$(FSharpNetCoreProductTargetFramework)/fsc.dll False True diff --git a/tests/projects/Sample_ConsoleApp_net7/Sample_ConsoleApp_net7.fsproj b/tests/projects/Sample_ConsoleApp_net7/Sample_ConsoleApp_net7.fsproj index bf06c1ce7a3..94e78cddcfc 100644 --- a/tests/projects/Sample_ConsoleApp_net7/Sample_ConsoleApp_net7.fsproj +++ b/tests/projects/Sample_ConsoleApp_net7/Sample_ConsoleApp_net7.fsproj @@ -2,13 +2,13 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) preview - $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/net8.0/fsc.dll - $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/net8.0/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/$(FSharpNetCoreProductTargetFramework)/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/$(FSharpNetCoreProductTargetFramework)/fsc.dll False True diff --git a/tests/projects/Sample_Local_Compiler_and_FSLib/LocalCompilerAndFslib.fsproj b/tests/projects/Sample_Local_Compiler_and_FSLib/LocalCompilerAndFslib.fsproj index c2164b65666..4f47ab1a711 100644 --- a/tests/projects/Sample_Local_Compiler_and_FSLib/LocalCompilerAndFslib.fsproj +++ b/tests/projects/Sample_Local_Compiler_and_FSLib/LocalCompilerAndFslib.fsproj @@ -2,15 +2,15 @@ Exe - net8.0 + $(FSharpNetCoreProductTargetFramework) preview true true - $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/net8.0/fsc.dll - $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/net8.0/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/$(FSharpNetCoreProductTargetFramework)/fsc.dll + $(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Debug/$(FSharpNetCoreProductTargetFramework)/fsc.dll False True diff --git a/tests/projects/misc/SelfDefinedTailCallAttribute/tailcallaltattr.fsproj b/tests/projects/misc/SelfDefinedTailCallAttribute/tailcallaltattr.fsproj index 92c5ae861d4..45f9002aa14 100644 --- a/tests/projects/misc/SelfDefinedTailCallAttribute/tailcallaltattr.fsproj +++ b/tests/projects/misc/SelfDefinedTailCallAttribute/tailcallaltattr.fsproj @@ -7,7 +7,7 @@ - $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Debug/net8.0/fsc.dll + $(MSBuildThisFileDirectory)../../../../artifacts/bin/fsc/Debug/$(FSharpNetCoreProductTargetFramework)/fsc.dll