From 41dbed48e8389f332d322e39f2e73a34478edc74 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Wed, 20 Nov 2019 16:40:34 -0600 Subject: [PATCH] move to netstandard2.0 and purge old net461 related code/projects/includes --- fcs/Directory.Build.props | 1 - ...FSharp.Compiler.Service.MSBuild.v12.fsproj | 35 -- ...arp.Compiler.Service.ProjectCracker.fsproj | 33 -- .../ProjectCracker.fs | 127 ----- .../App.config | 22 - ...rp.Compiler.Service.ProjectCracker.targets | 7 - ...Compiler.Service.ProjectCrackerTool.fsproj | 25 - .../Program.fs | 46 -- .../ProjectCrackerOptions.fs | 11 - .../ProjectCrackerTool.fs | 471 ------------------ .../CSharp_Analysis/CSharp_Analysis.csproj | 3 +- .../FSharp.Compiler.Service.Tests.fsproj | 26 +- fcs/FSharp.Compiler.Service.sln | 34 -- .../FSharp.Compiler.Service.fsproj | 40 +- fcs/docsrc/content/caches.fsx | 2 +- fcs/docsrc/content/compiler.fsx | 2 +- fcs/docsrc/content/corelib.fsx | 2 +- fcs/docsrc/content/editor.fsx | 2 +- fcs/docsrc/content/filesystem.fsx | 2 +- fcs/docsrc/content/interactive.fsx | 2 +- fcs/docsrc/content/ja/compiler.fsx | 2 +- fcs/docsrc/content/ja/corelib.fsx | 2 +- fcs/docsrc/content/ja/editor.fsx | 2 +- fcs/docsrc/content/ja/filesystem.fsx | 2 +- fcs/docsrc/content/ja/interactive.fsx | 2 +- fcs/docsrc/content/ja/project.fsx | 2 +- fcs/docsrc/content/ja/symbols.fsx | 2 +- fcs/docsrc/content/ja/tokenizer.fsx | 2 +- fcs/docsrc/content/ja/untypedtree.fsx | 2 +- fcs/docsrc/content/project.fsx | 57 +-- fcs/docsrc/content/queue.fsx | 2 +- fcs/docsrc/content/react.fsx | 2 +- fcs/docsrc/content/symbols.fsx | 2 +- fcs/docsrc/content/tokenizer.fsx | 2 +- fcs/docsrc/content/typedtree.fsx | 2 +- fcs/docsrc/content/untypedtree.fsx | 2 +- fcs/docsrc/tools/generate.fsx | 2 +- fcs/netfx.props | 28 -- .../EditorService/EditorService.fsproj | 7 +- fcs/samples/FscExe/App.config | 10 - fcs/samples/FscExe/FscExe.fsproj | 23 - fcs/samples/FscExe/FscMain.fs | 307 ------------ fcs/samples/FsiExe/App.config | 10 - fcs/samples/FsiExe/FsiExe.fsproj | 25 - fcs/samples/FsiExe/console.fs | 434 ---------------- fcs/samples/FsiExe/fsimain.fs | 240 --------- fcs/samples/FsiExe/fsiserver.fs | 56 --- fcs/samples/InteractiveService/App.config | 7 - .../InteractiveService.fsproj | 8 +- fcs/samples/Tokenizer/App.config | 7 - fcs/samples/Tokenizer/Tokenizer.fsproj | 8 +- fcs/samples/UntypedTree/App.config | 7 - fcs/samples/UntypedTree/UntypedTree.fsproj | 8 +- 53 files changed, 42 insertions(+), 2125 deletions(-) delete mode 100644 fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj delete mode 100644 fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj delete mode 100644 fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs delete mode 100644 fcs/FSharp.Compiler.Service.ProjectCrackerTool/App.config delete mode 100644 fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCracker.targets delete mode 100644 fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj delete mode 100644 fcs/FSharp.Compiler.Service.ProjectCrackerTool/Program.fs delete mode 100644 fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerOptions.fs delete mode 100644 fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs delete mode 100644 fcs/netfx.props delete mode 100644 fcs/samples/FscExe/App.config delete mode 100644 fcs/samples/FscExe/FscExe.fsproj delete mode 100644 fcs/samples/FscExe/FscMain.fs delete mode 100644 fcs/samples/FsiExe/App.config delete mode 100644 fcs/samples/FsiExe/FsiExe.fsproj delete mode 100644 fcs/samples/FsiExe/console.fs delete mode 100644 fcs/samples/FsiExe/fsimain.fs delete mode 100644 fcs/samples/FsiExe/fsiserver.fs delete mode 100644 fcs/samples/InteractiveService/App.config delete mode 100644 fcs/samples/Tokenizer/App.config delete mode 100644 fcs/samples/UntypedTree/App.config diff --git a/fcs/Directory.Build.props b/fcs/Directory.Build.props index 2841a5fb34f..3afd56797b3 100644 --- a/fcs/Directory.Build.props +++ b/fcs/Directory.Build.props @@ -32,6 +32,5 @@ $(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools fsi.exe 4.6.2 - net461 diff --git a/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj b/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj deleted file mode 100644 index ad6a9d7cd62..00000000000 --- a/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - $(FcsTargetNetFxFramework) - true - $(DefineConstants);CROSS_PLATFORM_COMPILER - $(DefineConstants);ENABLE_MONO_SUPPORT - - - Additional DLL for legacy compat for the F# compiler service. - Additional DLL for legacy compat for the F# compiler service. - false - Microsoft Corporation; F# community contributors - https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE - https://github.com/fsharp/FSharp.Compiler.Service - logo.png - F#, compiler, msbuild - - - - - Service/MSBuildReferenceResolver.fs - - - - - - - - - - - - - \ No newline at end of file diff --git a/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj b/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj deleted file mode 100644 index b12fa10ee5b..00000000000 --- a/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - $(FcsTargetNetFxFramework) - true - - - Legacy project file cracker for the F# compiler service. - Legacy project file cracker for the F# compiler service. - false - Microsoft Corporation; F# community contributors - https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE - https://github.com/fsharp/FSharp.Compiler.Service - logo.png - F#, compiler, msbuild - - - - - ProjectCrackerOptions.fs - - - - - - - - - - - - - \ No newline at end of file diff --git a/fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs b/fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs deleted file mode 100644 index 3a096cb5660..00000000000 --- a/fcs/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs +++ /dev/null @@ -1,127 +0,0 @@ -namespace FSharp.Compiler.SourceCodeServices - -#if !NETSTANDARD -open System.Runtime.Serialization.Json -#endif -open System.Text -open System.IO -open System - -module Utils = - - let Convert loadedTimeStamp (originalOpts: ProjectCrackerTool.ProjectOptions) = - let logMap = ref Map.empty - - let rec convertProject (opts: ProjectCrackerTool.ProjectOptions) = - if not (isNull opts.Error) then failwith opts.Error - - let referencedProjects() = Array.map (fun (a, b) -> a,convertProject b) opts.ReferencedProjectOptions - - let sourceFiles, otherOptions = - opts.Options - |> Array.partition (fun x -> - let extension = Path.GetExtension(x).ToLower() - x.IndexOfAny(Path.GetInvalidPathChars()) = -1 - && (extension = ".fs" || extension = ".fsi")) - - let sepChar = Path.DirectorySeparatorChar - - let sourceFiles = sourceFiles |> Array.map (fun x -> - match sepChar with - | '\\' -> x.Replace('/', '\\') - | '/' -> x.Replace('\\', '/') - | _ -> x - ) - - logMap := Map.add opts.ProjectFile opts.LogOutput !logMap - { ProjectFileName = opts.ProjectFile - ProjectId = None - SourceFiles = sourceFiles - OtherOptions = otherOptions - ReferencedProjects = referencedProjects() - IsIncompleteTypeCheckEnvironment = false - UseScriptResolutionRules = false - LoadTime = loadedTimeStamp - UnresolvedReferences = None - OriginalLoadReferences = [] - ExtraProjectInfo = None - Stamp = None } - - convertProject originalOpts, !logMap - -type ProjectCracker = - - static member GetProjectOptionsFromProjectFileLogged(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp, ?enableLogging) = - let loadedTimeStamp = defaultArg loadedTimeStamp DateTime.MaxValue // Not 'now', we don't want to force reloading - let properties = defaultArg properties [] - let enableLogging = defaultArg enableLogging true - - -#if NETSTANDARD - let arguments = [| - yield projectFileName - yield enableLogging.ToString() - for k, v in properties do - yield k - yield v - |] - - let ret, opts = FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectCrackerTool.crackOpen arguments - ignore ret -#else - let arguments = new StringBuilder() - arguments.Append('"').Append(projectFileName).Append('"') |> ignore - arguments.Append(' ').Append(enableLogging.ToString()) |> ignore - for k, v in properties do - arguments.Append(' ').Append(k).Append(' ').Append(v) |> ignore - let codebase = Path.GetDirectoryName(Uri(typeof.Assembly.CodeBase).LocalPath) - - let crackerFilename = Path.Combine(codebase,"FSharp.Compiler.Service.ProjectCrackerTool.exe") - if not (File.Exists crackerFilename) then - failwithf "ProjectCracker exe not found at: %s it must be next to the ProjectCracker dll." crackerFilename - - let p = new System.Diagnostics.Process() - - p.StartInfo.FileName <- crackerFilename - p.StartInfo.Arguments <- arguments.ToString() - p.StartInfo.UseShellExecute <- false - p.StartInfo.CreateNoWindow <- true - p.StartInfo.RedirectStandardOutput <- true - p.StartInfo.RedirectStandardError <- true - - let sbOut = StringBuilder() - let sbErr = StringBuilder() - - p.ErrorDataReceived.AddHandler(fun _ a -> sbErr.AppendLine a.Data |> ignore) - p.OutputDataReceived.AddHandler(fun _ a -> sbOut.AppendLine a.Data |> ignore) - - ignore <| p.Start() - - p.EnableRaisingEvents <- true - p.BeginOutputReadLine() - p.BeginErrorReadLine() - - p.WaitForExit() - - let crackerOut = sbOut.ToString() - let crackerErr = sbErr.ToString() - - let opts = - try - let ser = new DataContractJsonSerializer(typeof) - let stringBytes = Encoding.Unicode.GetBytes crackerOut - use ms = new MemoryStream(stringBytes) - ser.ReadObject(ms) :?> ProjectCrackerTool.ProjectOptions - with - exn -> - raise (Exception(sprintf "error parsing ProjectCrackerTool output, stdoutput was:\n%s\n\nstderr was:\n%s" crackerOut crackerErr, exn)) -#endif - - Utils.Convert loadedTimeStamp opts - - static member GetProjectOptionsFromProjectFile(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp) = - fst (ProjectCracker.GetProjectOptionsFromProjectFileLogged( - projectFileName, - ?properties=properties, - ?loadedTimeStamp=loadedTimeStamp, - enableLogging=false)) diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/App.config b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/App.config deleted file mode 100644 index fdab151af22..00000000000 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCracker.targets b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCracker.targets deleted file mode 100644 index ed01293adaf..00000000000 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCracker.targets +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj deleted file mode 100644 index 19789a96299..00000000000 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/FSharp.Compiler.Service.ProjectCrackerTool.fsproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - Exe - $(FcsTargetNetFxFramework) - true - $(DefineConstants);CROSS_PLATFORM_COMPILER - $(DefineConstants);ENABLE_MONO_SUPPORT - $(OtherFlags) --staticlink:FSharp.Core - true - false - - - - - - - - - - - - - - diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/Program.fs b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/Program.fs deleted file mode 100644 index 8379737c939..00000000000 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/Program.fs +++ /dev/null @@ -1,46 +0,0 @@ -namespace FSharp.Compiler.SourceCodeServices.ProjectCrackerTool - -open System -open System.Reflection -open System.Runtime.Serialization.Json - -module Program = - -#if !NETCOREAPP2_0 - let addMSBuildv14BackupResolution () = - let onResolveEvent = new ResolveEventHandler(fun sender evArgs -> - let requestedAssembly = AssemblyName(evArgs.Name) - if requestedAssembly.Name.StartsWith("Microsoft.Build", StringComparison.Ordinal) && - not (requestedAssembly.Name.EndsWith(".resources", StringComparison.Ordinal)) && - not (requestedAssembly.Version.ToString().Contains("12.0.0.0")) - then - // If the version of MSBuild that we're using wasn't present on the machine, then - // just revert back to 12.0.0.0 since that's normally installed as part of the .NET - // Framework. - requestedAssembly.Version <- Version("12.0.0.0") - Assembly.Load requestedAssembly - else - null) - AppDomain.CurrentDomain.add_AssemblyResolve(onResolveEvent) -#endif - - let crackAndSendOutput asText argv = - let ret, opts = ProjectCrackerTool.crackOpen argv - - if asText then - printfn "%A" opts - else - let ser = new DataContractJsonSerializer(typeof) - ser.WriteObject(Console.OpenStandardOutput(), opts) - ret - - - [][] - let main argv = - let asText = Array.exists (fun (s: string) -> s = "--text") argv - let argv = Array.filter (fun (s: string) -> s <> "--text") argv - -#if !NETCOREAPP2_0 - addMSBuildv14BackupResolution () -#endif - crackAndSendOutput asText argv diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerOptions.fs b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerOptions.fs deleted file mode 100644 index a48bdc25aa7..00000000000 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerOptions.fs +++ /dev/null @@ -1,11 +0,0 @@ -namespace FSharp.Compiler.SourceCodeServices.ProjectCrackerTool - -[] -type ProjectOptions = - { - ProjectFile: string - Options: string[] - ReferencedProjectOptions: (string * ProjectOptions)[] - LogOutput: string - Error: string - } diff --git a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs b/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs deleted file mode 100644 index 93a74cbb0e8..00000000000 --- a/fcs/FSharp.Compiler.Service.ProjectCrackerTool/ProjectCrackerTool.fs +++ /dev/null @@ -1,471 +0,0 @@ -namespace FSharp.Compiler.SourceCodeServices.ProjectCrackerTool - -open System -open System.IO -open System.Text -open Microsoft.Build.Framework -open Microsoft.Build.Utilities - -module internal ProjectCrackerTool = - open System.Collections.Generic - - let runningOnMono = -#if NETCOREAPP2_0 - false -#else - try match System.Type.GetType("Mono.Runtime") with null -> false | _ -> true - with e -> false -#endif - - type internal BasicStringLogger() = - inherit Logger() - - let sb = new StringBuilder() - - let log (e: BuildEventArgs) = - sb.Append(e.Message) |> ignore - sb.AppendLine() |> ignore - - override x.Initialize(eventSource:IEventSource) = - sb.Clear() |> ignore - eventSource.AnyEventRaised.Add(log) - - member x.Log = sb.ToString() - - type internal HostCompile() = - member th.Compile(_:obj, _:obj, _:obj) = 0 - interface ITaskHost - - let vs = - let programFiles = - let getEnv v = - let result = System.Environment.GetEnvironmentVariable(v) - match result with - | null -> None - | _ -> Some result - - match List.tryPick getEnv [ "ProgramFiles(x86)"; "ProgramFiles" ] with - | Some r -> r - | None -> "C:\\Program Files (x86)" - - let vsVersions = ["14.0"; "12.0"] - let msbuildBin v = IO.Path.Combine(programFiles, "MSBuild", v, "Bin", "MSBuild.exe") - List.tryFind (fun v -> IO.File.Exists(msbuildBin v)) vsVersions - - let mkAbsolute dir v = - if Path.IsPathRooted v then v - else Path.Combine(dir, v) - - let mkAbsoluteOpt dir v = Option.map (mkAbsolute dir) v - - let CrackProjectUsingNewBuildAPI fsprojFile properties logOpt = - let fsprojFullPath = try Path.GetFullPath(fsprojFile) with _ -> fsprojFile - let fsprojAbsDirectory = Path.GetDirectoryName fsprojFullPath - - use _pwd = - let dir = Directory.GetCurrentDirectory() - Directory.SetCurrentDirectory(fsprojAbsDirectory) - { new System.IDisposable with - member x.Dispose() = Directory.SetCurrentDirectory(dir) } - use engine = new Microsoft.Build.Evaluation.ProjectCollection() - let host = new HostCompile() - - engine.HostServices.RegisterHostObject(fsprojFullPath, "CoreCompile", "Fsc", host) - - let projectInstanceFromFullPath (fsprojFullPath: string) = - use file = new FileStream(fsprojFullPath, FileMode.Open, FileAccess.Read, FileShare.Read) - use stream = new StreamReader(file) - use xmlReader = System.Xml.XmlReader.Create(stream) - - let project = - try - engine.LoadProject(xmlReader, FullPath=fsprojFullPath) - with - | exn -> - let tools = engine.Toolsets |> Seq.map (fun x -> x.ToolsPath) |> Seq.toList - raise (new Exception(sprintf "Could not load project %s in ProjectCollection. Available tools: %A. Message: %s" fsprojFullPath tools exn.Message)) - - project.SetGlobalProperty("BuildingInsideVisualStudio", "true") |> ignore - if not (List.exists (fun (p,_) -> p = "VisualStudioVersion") properties) then - match vs with - | Some version -> project.SetGlobalProperty("VisualStudioVersion", version) |> ignore - | None -> () - project.SetGlobalProperty("ShouldUnsetParentConfigurationAndPlatform", "false") |> ignore - for (prop, value) in properties do - project.SetGlobalProperty(prop, value) |> ignore - - project.CreateProjectInstance() - - let project = projectInstanceFromFullPath fsprojFullPath - let directory = project.Directory - - let getprop (p: Microsoft.Build.Execution.ProjectInstance) s = - let v = p.GetPropertyValue s - if String.IsNullOrWhiteSpace v then None - else Some v - - let outFileOpt = getprop project "TargetPath" - - let log = match logOpt with - | None -> [] - | Some l -> [l :> ILogger] - - project.Build([| "Build" |], log) |> ignore - - let getItems s = [ for f in project.GetItems(s) -> mkAbsolute directory f.EvaluatedInclude ] - - let projectReferences = - [ for cp in project.GetItems("ProjectReference") do - yield cp.GetMetadataValue("FullPath") - ] - - let references = - [ for i in project.GetItems("ReferencePath") do - yield i.EvaluatedInclude - for i in project.GetItems("ChildProjectReferences") do - yield i.EvaluatedInclude ] - - outFileOpt, directory, getItems, references, projectReferences, getprop project, project.FullPath - -#if !NETCOREAPP2_0 - let CrackProjectUsingOldBuildAPI (fsprojFile:string) properties logOpt = - let engine = new Microsoft.Build.BuildEngine.Engine() - Option.iter (fun l -> engine.RegisterLogger(l)) logOpt - - let bpg = Microsoft.Build.BuildEngine.BuildPropertyGroup() - - bpg.SetProperty("BuildingInsideVisualStudio", "true") - for (prop, value) in properties do - bpg.SetProperty(prop, value) - - engine.GlobalProperties <- bpg - - let projectFromFile (fsprojFile:string) = - // We seem to need to pass 12.0/4.0 in here for some unknown reason - let project = new Microsoft.Build.BuildEngine.Project(engine, engine.DefaultToolsVersion) - do project.Load(fsprojFile) - project - - let project = projectFromFile fsprojFile - project.Build([| "ResolveReferences" |]) |> ignore - let directory = Path.GetDirectoryName project.FullFileName - - let getProp (p: Microsoft.Build.BuildEngine.Project) s = - let v = p.GetEvaluatedProperty s - if String.IsNullOrWhiteSpace v then None - else Some v - - let outFileOpt = - match mkAbsoluteOpt directory (getProp project "OutDir") with - | None -> None - | Some d -> mkAbsoluteOpt d (getProp project "TargetFileName") - - let getItems s = - let fs = project.GetEvaluatedItemsByName(s) - [ for f in fs -> mkAbsolute directory f.FinalItemSpec ] - - let projectReferences = - [ for i in project.GetEvaluatedItemsByName("ProjectReference") do - yield mkAbsolute directory i.FinalItemSpec - ] - - let references = - [ for i in project.GetEvaluatedItemsByName("ReferencePath") do - yield i.FinalItemSpec - for i in project.GetEvaluatedItemsByName("ChildProjectReferences") do - yield i.FinalItemSpec ] - // Duplicate slashes sometimes appear in the output here, which prevents - // them from matching keys used in FSharpProjectOptions.ReferencedProjects - |> List.map (fun (s: string) -> s.Replace("//","/")) - - outFileOpt, directory, getItems, references, projectReferences, getProp project, project.FullFileName - -#endif - - //---------------------------------------------------------------------------- - // FSharpProjectFileInfo - // - [] - type FSharpProjectFileInfo (fsprojFileName:string, ?properties, ?enableLogging) = - let properties = defaultArg properties [] - let enableLogging = defaultArg enableLogging false - - let logOpt = - if enableLogging then - let log = new BasicStringLogger() - do log.Verbosity <- Microsoft.Build.Framework.LoggerVerbosity.Diagnostic - Some log - else - None - - let outFileOpt, directory, getItems, references, projectReferences, getProp, fsprojFullPath = - try -#if NETCOREAPP2_0 - CrackProjectUsingNewBuildAPI fsprojFileName properties logOpt - with -#else - if runningOnMono then - CrackProjectUsingOldBuildAPI fsprojFileName properties logOpt - else - CrackProjectUsingNewBuildAPI fsprojFileName properties logOpt - with - | :? Microsoft.Build.BuildEngine.InvalidProjectFileException as e -> - raise (Microsoft.Build.Exceptions.InvalidProjectFileException( - e.ProjectFile, - e.LineNumber, - e.ColumnNumber, - e.EndLineNumber, - e.EndColumnNumber, - e.Message, - e.ErrorSubcategory, - e.ErrorCode, - e.HelpKeyword)) -#endif - | :? ArgumentException as e -> raise (IO.FileNotFoundException(e.Message)) - - let logOutput = match logOpt with None -> "" | Some l -> l.Log - let pages = getItems "Page" - let embeddedResources = getItems "EmbeddedResource" - let files = getItems "Compile" - let resources = getItems "Resource" - let noaction = getItems "None" - let content = getItems "Content" - - let split (s : string option) (cs : char []) = - match s with - | None -> [||] - | Some s -> - if String.IsNullOrWhiteSpace s then [||] - else s.Split(cs, StringSplitOptions.RemoveEmptyEntries) - - let getbool (s : string option) = - match s with - | None -> false - | Some s -> - match (Boolean.TryParse s) with - | (true, result) -> result - | (false, _) -> false - - let fxVer = getProp "TargetFrameworkVersion" - let optimize = getProp "Optimize" |> getbool - let assemblyNameOpt = getProp "AssemblyName" - let tailcalls = getProp "Tailcalls" |> getbool - let outputPathOpt = getProp "OutputPath" - let docFileOpt = getProp "DocumentationFile" - let outputTypeOpt = getProp "OutputType" - let debugTypeOpt = getProp "DebugType" - let baseAddressOpt = getProp "BaseAddress" - let sigFileOpt = getProp "GenerateSignatureFile" - let keyFileOpt = getProp "KeyFile" - let pdbFileOpt = getProp "PdbFile" - let platformOpt = getProp "Platform" - let targetTypeOpt = getProp "TargetType" - let versionFileOpt = getProp "VersionFile" - let targetProfileOpt = getProp "TargetProfile" - let warnLevelOpt = getProp "Warn" - let subsystemVersionOpt = getProp "SubsystemVersion" - let win32ResOpt = getProp "Win32ResourceFile" - let heOpt = getProp "HighEntropyVA" |> getbool - let win32ManifestOpt = getProp "Win32ManifestFile" - let debugSymbols = getProp "DebugSymbols" |> getbool - let prefer32bit = getProp "Prefer32Bit" |> getbool - let warnAsError = getProp "TreatWarningsAsErrors" |> getbool - let defines = split (getProp "DefineConstants") [| ';'; ','; ' ' |] - let nowarn = split (getProp "NoWarn") [| ';'; ','; ' ' |] - let warningsAsError = split (getProp "WarningsAsErrors") [| ';'; ','; ' ' |] - let libPaths = split (getProp "ReferencePath") [| ';'; ',' |] - let otherFlags = split (getProp "OtherFlags") [| ' ' |] - let isLib = (outputTypeOpt = Some "Library") - - let docFileOpt = - match docFileOpt with - | None -> None - | Some docFile -> Some(mkAbsolute directory docFile) - - - let options = - [ yield "--simpleresolution" - yield "--noframework" - match outFileOpt with - | None -> () - | Some outFile -> yield "--out:" + outFile - match docFileOpt with - | None -> () - | Some docFile -> yield "--doc:" + docFile - match baseAddressOpt with - | None -> () - | Some baseAddress -> yield "--baseaddress:" + baseAddress - match keyFileOpt with - | None -> () - | Some keyFile -> yield "--keyfile:" + keyFile - match sigFileOpt with - | None -> () - | Some sigFile -> yield "--sig:" + sigFile - match pdbFileOpt with - | None -> () - | Some pdbFile -> yield "--pdb:" + pdbFile - match versionFileOpt with - | None -> () - | Some versionFile -> yield "--versionfile:" + versionFile - match warnLevelOpt with - | None -> () - | Some warnLevel -> yield "--warn:" + warnLevel - match subsystemVersionOpt with - | None -> () - | Some s -> yield "--subsystemversion:" + s - if heOpt then yield "--highentropyva+" - match win32ResOpt with - | None -> () - | Some win32Res -> yield "--win32res:" + win32Res - match win32ManifestOpt with - | None -> () - | Some win32Manifest -> yield "--win32manifest:" + win32Manifest - match targetProfileOpt with - | None -> () - | Some targetProfile -> yield "--targetprofile:" + targetProfile - yield "--fullpaths" - yield "--flaterrors" - if warnAsError then yield "--warnaserror" - yield - if isLib then "--target:library" - else "--target:exe" - for symbol in defines do - if not (String.IsNullOrWhiteSpace symbol) then yield "--define:" + symbol - for nw in nowarn do - if not (String.IsNullOrWhiteSpace nw) then yield "--nowarn:" + nw - for nw in warningsAsError do - if not (String.IsNullOrWhiteSpace nw) then yield "--warnaserror:" + nw - yield if debugSymbols then "--debug+" - else "--debug-" - yield if optimize then "--optimize+" - else "--optimize-" - yield if tailcalls then "--tailcalls+" - else "--tailcalls-" - match debugTypeOpt with - | None -> () - | Some debugType -> - match debugType.ToUpperInvariant() with - | "NONE" -> () - | "PDBONLY" -> yield "--debug:pdbonly" - | "FULL" -> yield "--debug:full" - | _ -> () - match platformOpt |> Option.map (fun o -> o.ToUpperInvariant()), prefer32bit, - targetTypeOpt |> Option.map (fun o -> o.ToUpperInvariant()) with - | Some "ANYCPU", true, Some "EXE" | Some "ANYCPU", true, Some "WINEXE" -> yield "--platform:anycpu32bitpreferred" - | Some "ANYCPU", _, _ -> yield "--platform:anycpu" - | Some "X86", _, _ -> yield "--platform:x86" - | Some "X64", _, _ -> yield "--platform:x64" - | Some "ITANIUM", _, _ -> yield "--platform:Itanium" - | _ -> () - match targetTypeOpt |> Option.map (fun o -> o.ToUpperInvariant()) with - | Some "LIBRARY" -> yield "--target:library" - | Some "EXE" -> yield "--target:exe" - | Some "WINEXE" -> yield "--target:winexe" - | Some "MODULE" -> yield "--target:module" - | _ -> () - yield! otherFlags - for f in resources do - yield "--resource:" + f - for i in libPaths do - yield "--lib:" + mkAbsolute directory i - for r in references do - yield "-r:" + r - yield! files ] - - member x.Options = options - member x.FrameworkVersion = fxVer - member x.ProjectReferences = projectReferences - member x.References = references - member x.CompileFiles = files - member x.ResourceFiles = resources - member x.EmbeddedResourceFiles = embeddedResources - member x.ContentFiles = content - member x.OtherFiles = noaction - member x.PageFiles = pages - member x.OutputFile = outFileOpt - member x.Directory = directory - member x.AssemblyName = assemblyNameOpt - member x.OutputPath = outputPathOpt - member x.FullPath = fsprojFullPath - member x.LogOutput = logOutput - static member Parse(fsprojFileName:string, ?properties, ?enableLogging) = new FSharpProjectFileInfo(fsprojFileName, ?properties=properties, ?enableLogging=enableLogging) - - let getOptions file enableLogging properties = - let cache = new Dictionary<_,_>() - let rec getOptions file : Option * ProjectOptions = - match cache.TryGetValue file with - | true, option -> option - | _ -> - let parsedProject = FSharpProjectFileInfo.Parse(file, properties=properties, enableLogging=enableLogging) - - let referencedProjectOptions = - [| for file in parsedProject.ProjectReferences do - if Path.GetExtension(file) = ".fsproj" then - match getOptions file with - | Some outFile, opts -> yield outFile, opts - | None, _ -> () |] - - // Workaround for Mono 4.2, which doesn't populate the subproject - // details anymore outside of a solution context. See https://github.com/mono/mono/commit/76c6a08e730393927b6851709cdae1d397cbcc3a#diff-59afd196a55d61d5d1eaaef7bd49d1e5 - // and some explanation from the author at https://github.com/fsharp/FSharp.Compiler.Service/pull/455#issuecomment-154103963 - // - // In particular we want the output path, which we can get from - // fully parsing that project itself. We also have to specially parse - // C# referenced projects, as we don't look at them otherwise. - let referencedProjectOutputs = - if runningOnMono then - [ yield! Array.map (fun (s,_) -> "-r:" + s) referencedProjectOptions - for file in parsedProject.ProjectReferences do - let ext = Path.GetExtension(file) - if ext = ".csproj" || ext = ".vbproj" then - let parsedProject = FSharpProjectFileInfo.Parse(file, properties=properties, enableLogging=false) - match parsedProject.OutputFile with - | None -> () - | Some f -> yield "-r:" + f ] - else - [] - - // On some versions of Mono the referenced projects are already - // correctly included, so we make sure not to introduce duplicates - |> List.filter (fun r -> not (Set.contains r (set parsedProject.Options))) - - let options = { ProjectFile = file - Options = Array.ofSeq (parsedProject.Options @ referencedProjectOutputs) - ReferencedProjectOptions = referencedProjectOptions - LogOutput = parsedProject.LogOutput - Error = null } - - let result = parsedProject.OutputFile, options - cache.Add(file,result) - result - - snd (getOptions file) - - - let rec pairs l = - match l with - | [] | [_] -> [] - | x::y::rest -> (x,y) :: pairs rest - - let crackOpen (argv: string[])= - if argv.Length >= 2 then - let projectFile = argv.[0] - let enableLogging = match Boolean.TryParse(argv.[1]) with - | true, true -> true - | _ -> false - try - let props = pairs (List.ofArray argv.[2..]) - let opts = getOptions argv.[0] enableLogging props - 0, opts - with e -> - 2, { ProjectFile = projectFile; - Options = [||]; - ReferencedProjectOptions = [||]; - LogOutput = e.ToString() + " StackTrace: " + e.StackTrace - Error = e.Message + " StackTrace: " + e.StackTrace } - else - 1, { ProjectFile = ""; - Options = [||]; - ReferencedProjectOptions = [||]; - LogOutput = "At least two arguments required." - Error = null } diff --git a/fcs/FSharp.Compiler.Service.Tests/CSharp_Analysis/CSharp_Analysis.csproj b/fcs/FSharp.Compiler.Service.Tests/CSharp_Analysis/CSharp_Analysis.csproj index 534a1435415..290b5a2741b 100644 --- a/fcs/FSharp.Compiler.Service.Tests/CSharp_Analysis/CSharp_Analysis.csproj +++ b/fcs/FSharp.Compiler.Service.Tests/CSharp_Analysis/CSharp_Analysis.csproj @@ -1,7 +1,6 @@  - - $(FcsTargetNetFxFramework);netstandard2.0 + netstandard2.0 false $(NoWarn);0067;1591 diff --git a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index d6c71b55456..10a336332fa 100644 --- a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -1,9 +1,9 @@ - - $(FcsTargetNetFxFramework);netcoreapp2.0 + netcoreapp2.0 true 4.1.19 + $(DefineConstants);NO_PROJECTCRACKER $(NoWarn);44;75; true true @@ -11,9 +11,6 @@ true true - - $(DefineConstants);NO_PROJECTCRACKER - FsUnit.fs @@ -83,23 +80,4 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/fcs/FSharp.Compiler.Service.sln b/fcs/FSharp.Compiler.Service.sln index 192f8bd6242..49aacbe4c51 100644 --- a/fcs/FSharp.Compiler.Service.sln +++ b/fcs/FSharp.Compiler.Service.sln @@ -7,9 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{B6B6 build.cmd = build.cmd build.fsx = build.fsx build.sh = build.sh - nuget\FSharp.Compiler.Service.MSBuild.v12.nuspec = nuget\FSharp.Compiler.Service.MSBuild.v12.nuspec nuget\FSharp.Compiler.Service.nuspec = nuget\FSharp.Compiler.Service.nuspec - nuget\FSharp.Compiler.Service.ProjectCracker.nuspec = nuget\FSharp.Compiler.Service.ProjectCracker.nuspec paket.dependencies = paket.dependencies README.md = README.md RELEASE_NOTES.md = RELEASE_NOTES.md @@ -49,16 +47,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Tokenizer", "samples\Tokeni EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "UntypedTree", "samples\UntypedTree\UntypedTree.fsproj", "{C816728D-BBEA-472D-9F6C-E8913957A673}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FscExe", "samples\FscExe\FscExe.fsproj", "{C94C257C-3C0A-4858-B5D8-D746498D1F08}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp_Analysis", "FSharp.Compiler.Service.Tests\CSharp_Analysis\CSharp_Analysis.csproj", "{887630A3-4B1D-40EA-B8B3-2D842E9C40DB}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsiExe", "samples\FsiExe\FsiExe.fsproj", "{F9540CA8-1CE0-4546-A23A-A461E416E95B}" -EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCrackerTool", "FSharp.Compiler.Service.ProjectCrackerTool\FSharp.Compiler.Service.ProjectCrackerTool.fsproj", "{B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}" -EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.ProjectCracker", "FSharp.Compiler.Service.ProjectCracker\FSharp.Compiler.Service.ProjectCracker.fsproj", "{893C3CD9-5AF8-4027-A667-21E62FC2C703}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{098D1C35-D0FB-4720-83DD-8002293EA237}" ProjectSection(SolutionItems) = preProject .gitattributes = .gitattributes @@ -74,8 +64,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "package", "package", "{9020 nuget\projectcracker.template = nuget\projectcracker.template EndProjectSection EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.MSBuild.v12", "FSharp.Compiler.Service.MSBuild.v12\FSharp.Compiler.Service.MSBuild.v12.fsproj", "{8157B50E-397D-4232-A4E0-1977AFC7076D}" -EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service", "FSharp.Compiler.Service\FSharp.Compiler.Service.fsproj", "{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}" EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service.Tests", "FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj", "{EE85AAB7-CDA0-4C4E-BDA0-A64DDDD13E3F}" @@ -102,30 +90,10 @@ Global {C816728D-BBEA-472D-9F6C-E8913957A673}.Debug|Any CPU.Build.0 = Debug|Any CPU {C816728D-BBEA-472D-9F6C-E8913957A673}.Release|Any CPU.ActiveCfg = Release|Any CPU {C816728D-BBEA-472D-9F6C-E8913957A673}.Release|Any CPU.Build.0 = Release|Any CPU - {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|Any CPU.Build.0 = Release|Any CPU {887630A3-4B1D-40EA-B8B3-2D842E9C40DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {887630A3-4B1D-40EA-B8B3-2D842E9C40DB}.Debug|Any CPU.Build.0 = Debug|Any CPU {887630A3-4B1D-40EA-B8B3-2D842E9C40DB}.Release|Any CPU.ActiveCfg = Release|Any CPU {887630A3-4B1D-40EA-B8B3-2D842E9C40DB}.Release|Any CPU.Build.0 = Release|Any CPU - {F9540CA8-1CE0-4546-A23A-A461E416E95B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F9540CA8-1CE0-4546-A23A-A461E416E95B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F9540CA8-1CE0-4546-A23A-A461E416E95B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F9540CA8-1CE0-4546-A23A-A461E416E95B}.Release|Any CPU.Build.0 = Release|Any CPU - {B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1BDD96D-47E1-4E65-8107-FBAE23A06DB4}.Release|Any CPU.Build.0 = Release|Any CPU - {893C3CD9-5AF8-4027-A667-21E62FC2C703}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {893C3CD9-5AF8-4027-A667-21E62FC2C703}.Debug|Any CPU.Build.0 = Debug|Any CPU - {893C3CD9-5AF8-4027-A667-21E62FC2C703}.Release|Any CPU.ActiveCfg = Release|Any CPU - {893C3CD9-5AF8-4027-A667-21E62FC2C703}.Release|Any CPU.Build.0 = Release|Any CPU - {8157B50E-397D-4232-A4E0-1977AFC7076D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8157B50E-397D-4232-A4E0-1977AFC7076D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8157B50E-397D-4232-A4E0-1977AFC7076D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8157B50E-397D-4232-A4E0-1977AFC7076D}.Release|Any CPU.Build.0 = Release|Any CPU {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -144,8 +112,6 @@ Global {067E95E5-E3DC-4CA7-813A-4D1E277D2D52} = {E396742E-B4E5-4584-A9E4-CC1A491F5BC1} {92793069-816F-4F69-84AC-0966F8275E65} = {E396742E-B4E5-4584-A9E4-CC1A491F5BC1} {C816728D-BBEA-472D-9F6C-E8913957A673} = {E396742E-B4E5-4584-A9E4-CC1A491F5BC1} - {C94C257C-3C0A-4858-B5D8-D746498D1F08} = {E396742E-B4E5-4584-A9E4-CC1A491F5BC1} - {F9540CA8-1CE0-4546-A23A-A461E416E95B} = {E396742E-B4E5-4584-A9E4-CC1A491F5BC1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9E9BAC7B-3834-497C-B7AC-6B7988778D1A} diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 8f849da41b3..722a92b15c1 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -1,14 +1,20 @@  - - $(FcsTargetNetFxFramework);netstandard2.0 + netstandard2.0 true $(DefineConstants);COMPILER_SERVICE_AS_DLL $(DefineConstants);COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT $(DefineConstants);NO_STRONG_NAMES $(DefineConstants);LOCALIZATION_FSCOMP + $(DefineConstants);FX_NO_PDB_READER + $(DefineConstants);FX_NO_PDB_WRITER + $(DefineConstants);FX_NO_SYMBOLSTORE + $(DefineConstants);FX_NO_APP_DOMAINS + $(DefineConstants);FX_NO_WIN_REGISTRY + $(DefineConstants);FX_NO_SYSTEM_CONFIGURATION + $(DefineConstants);FX_RESHAPED_REFEMIT $(TargetFramework)\ $(TargetFramework)\ $(OtherFlags) /warnon:1182 @@ -28,15 +34,6 @@ logo.png F#, fsharp, interactive, compiler, editor - - $(DefineConstants);FX_NO_PDB_READER - $(DefineConstants);FX_NO_PDB_WRITER - $(DefineConstants);FX_NO_SYMBOLSTORE - $(DefineConstants);FX_NO_APP_DOMAINS - $(DefineConstants);FX_NO_WIN_REGISTRY - $(DefineConstants);FX_NO_SYSTEM_CONFIGURATION - $(DefineConstants);FX_RESHAPED_REFEMIT - @@ -223,13 +220,9 @@ AbsIL/ilmorph.fs - - AbsIL/ilsign.fs - - AbsIL/ilnativeres.fsi @@ -670,25 +663,16 @@ - - - - - + + + - - - - - - $(FSharpSourcesRoot)\..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll - - + \ No newline at end of file diff --git a/fcs/docsrc/content/caches.fsx b/fcs/docsrc/content/caches.fsx index 2f63c4b394e..6ea415bcfa5 100644 --- a/fcs/docsrc/content/caches.fsx +++ b/fcs/docsrc/content/caches.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Notes on the FSharpChecker caches ================================================= diff --git a/fcs/docsrc/content/compiler.fsx b/fcs/docsrc/content/compiler.fsx index a7e5303a06b..9688f0b01c7 100644 --- a/fcs/docsrc/content/compiler.fsx +++ b/fcs/docsrc/content/compiler.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Hosted Compiler =============== diff --git a/fcs/docsrc/content/corelib.fsx b/fcs/docsrc/content/corelib.fsx index a0c1e85f029..e8041369ea0 100644 --- a/fcs/docsrc/content/corelib.fsx +++ b/fcs/docsrc/content/corelib.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Notes on FSharp.Core.dll ================================================= diff --git a/fcs/docsrc/content/editor.fsx b/fcs/docsrc/content/editor.fsx index 46ddd882e58..f384c05cfda 100644 --- a/fcs/docsrc/content/editor.fsx +++ b/fcs/docsrc/content/editor.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Editor services ================================== diff --git a/fcs/docsrc/content/filesystem.fsx b/fcs/docsrc/content/filesystem.fsx index ad0a57712b9..73066ba828f 100644 --- a/fcs/docsrc/content/filesystem.fsx +++ b/fcs/docsrc/content/filesystem.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Virtualized File System ========================================== diff --git a/fcs/docsrc/content/interactive.fsx b/fcs/docsrc/content/interactive.fsx index 6226bcbee16..30f0c8a2f08 100644 --- a/fcs/docsrc/content/interactive.fsx +++ b/fcs/docsrc/content/interactive.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Interactive Service: Embedding F# Interactive ============================================= diff --git a/fcs/docsrc/content/ja/compiler.fsx b/fcs/docsrc/content/ja/compiler.fsx index 788c715294f..b69668d42c6 100644 --- a/fcs/docsrc/content/ja/compiler.fsx +++ b/fcs/docsrc/content/ja/compiler.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** コンパイラの組み込み ==================== diff --git a/fcs/docsrc/content/ja/corelib.fsx b/fcs/docsrc/content/ja/corelib.fsx index ea9ee87f8fb..d0dad506c3a 100644 --- a/fcs/docsrc/content/ja/corelib.fsx +++ b/fcs/docsrc/content/ja/corelib.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** コンパイラサービス: FSharp.Core.dll についてのメモ ================================================== diff --git a/fcs/docsrc/content/ja/editor.fsx b/fcs/docsrc/content/ja/editor.fsx index f8a33e9a75a..8351a56a44e 100644 --- a/fcs/docsrc/content/ja/editor.fsx +++ b/fcs/docsrc/content/ja/editor.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** コンパイラサービス: エディタサービス ==================================== diff --git a/fcs/docsrc/content/ja/filesystem.fsx b/fcs/docsrc/content/ja/filesystem.fsx index 0680f34122f..52c74f90e76 100644 --- a/fcs/docsrc/content/ja/filesystem.fsx +++ b/fcs/docsrc/content/ja/filesystem.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** コンパイラサービス: ファイルシステム仮想化 ========================================== diff --git a/fcs/docsrc/content/ja/interactive.fsx b/fcs/docsrc/content/ja/interactive.fsx index 59bae44f01b..0a9db5813fe 100644 --- a/fcs/docsrc/content/ja/interactive.fsx +++ b/fcs/docsrc/content/ja/interactive.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** インタラクティブサービス: F# Interactiveの組み込み ================================================== diff --git a/fcs/docsrc/content/ja/project.fsx b/fcs/docsrc/content/ja/project.fsx index 8b70e3df5f7..a5fb7219727 100644 --- a/fcs/docsrc/content/ja/project.fsx +++ b/fcs/docsrc/content/ja/project.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** コンパイラサービス: プロジェクトの分析 ====================================== diff --git a/fcs/docsrc/content/ja/symbols.fsx b/fcs/docsrc/content/ja/symbols.fsx index ff62b0de6b2..86fa00cded3 100644 --- a/fcs/docsrc/content/ja/symbols.fsx +++ b/fcs/docsrc/content/ja/symbols.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** コンパイラサービス: シンボルの処理 ================================== diff --git a/fcs/docsrc/content/ja/tokenizer.fsx b/fcs/docsrc/content/ja/tokenizer.fsx index 4daf29b7ead..b519b480e5d 100644 --- a/fcs/docsrc/content/ja/tokenizer.fsx +++ b/fcs/docsrc/content/ja/tokenizer.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** コンパイラサービス:F#トークナイザを使用する ============================================ diff --git a/fcs/docsrc/content/ja/untypedtree.fsx b/fcs/docsrc/content/ja/untypedtree.fsx index 447e3742fff..7ac239c6483 100644 --- a/fcs/docsrc/content/ja/untypedtree.fsx +++ b/fcs/docsrc/content/ja/untypedtree.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../../artifacts/bin/fcs/net461" +#I "../../../../artifacts/bin/fcs/netstandard2.0" (** コンパイラサービス:型無し構文木の処理 ====================================== diff --git a/fcs/docsrc/content/project.fsx b/fcs/docsrc/content/project.fsx index a537000435e..193af1b1945 100644 --- a/fcs/docsrc/content/project.fsx +++ b/fcs/docsrc/content/project.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Project Analysis ================================== @@ -306,61 +306,6 @@ correctly and then analyze each project in turn. *) -(** -Cracking a legacy project file ------------------------------ - -F# projects normally use the '.fsproj' project file format. -A project cracking facility for legacy old-style .fsproj is provided as a separate NuGet package: -FSharp.Compiler.Service.ProjectCracker. - -Project cracking for modern project files should be done using a library such as DotNetProjInfo. -See FsAutoComplete for example code. - -The legacy NuGet package `FSharp.Compiler.Service.ProjectCracker` contains a -library `FSharp.Compiler.Service.ProjectCracker.dll`, which should be -referenced by your application directly, and an executable -`FSharp.Compiler.Service.ProjectCrackerTool.exe`, which should be copied -into the output folder of your application by the build process. If -you install using Paket or NuGet, then this will be configured for you -automatically. If not, you should reference the provided `.targets` -file manually in your application. This can be found in the NuGet -package at `build/net461/FSharp.Compiler.Service.ProjectCrackerTool.targets`. - -The reason for this split was so the analysis of an F# project -file is performed out of process, in order that the necessary assembly -binding redirects can be applied without requiring the caller to -arrange this. In this way MSBuild versions from 4 up to 14 can be -accommodated transparently. - -In this example we get the project options for one of the -project files in the F# Compiler Service project itself - you should also be able to use this technique -for any project that builds cleanly using the command line tools 'xbuild' or 'msbuild'. - - -*) - -let projectFile = __SOURCE_DIRECTORY__ + @"/../../src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj" - -ProjectCracker.GetProjectOptionsFromProjectFile(projectFile) - - -(** - -You can also request RELEASE mode and set other build configuration parameters: - -*) - -ProjectCracker.GetProjectOptionsFromProjectFile(projectFile, [("Configuration", "Release")]) - -(** - -For debugging purposes it is also possible to obtain a detailed log from the assembly resolution process. - -*) - -let options, logs = ProjectCracker.GetProjectOptionsFromProjectFileLogged(projectFile, [("Configuration", "Release")]) - (** Summary ------- diff --git a/fcs/docsrc/content/queue.fsx b/fcs/docsrc/content/queue.fsx index 7cf14a7b709..deb9dd80379 100644 --- a/fcs/docsrc/content/queue.fsx +++ b/fcs/docsrc/content/queue.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Notes on the FSharpChecker operations queue ================================================= diff --git a/fcs/docsrc/content/react.fsx b/fcs/docsrc/content/react.fsx index be108b92adb..fab1f554d75 100644 --- a/fcs/docsrc/content/react.fsx +++ b/fcs/docsrc/content/react.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Reacting to Changes ============================================ diff --git a/fcs/docsrc/content/symbols.fsx b/fcs/docsrc/content/symbols.fsx index ab6b4657dcf..501c4d3b351 100644 --- a/fcs/docsrc/content/symbols.fsx +++ b/fcs/docsrc/content/symbols.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Working with symbols ============================================ diff --git a/fcs/docsrc/content/tokenizer.fsx b/fcs/docsrc/content/tokenizer.fsx index 93a1dd3bf16..53dc089df5f 100644 --- a/fcs/docsrc/content/tokenizer.fsx +++ b/fcs/docsrc/content/tokenizer.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Using the F# tokenizer ========================================= diff --git a/fcs/docsrc/content/typedtree.fsx b/fcs/docsrc/content/typedtree.fsx index 385822335e9..07b92fe5658 100644 --- a/fcs/docsrc/content/typedtree.fsx +++ b/fcs/docsrc/content/typedtree.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Processing typed expression tree ================================================= diff --git a/fcs/docsrc/content/untypedtree.fsx b/fcs/docsrc/content/untypedtree.fsx index 162fedfa196..62971af931c 100644 --- a/fcs/docsrc/content/untypedtree.fsx +++ b/fcs/docsrc/content/untypedtree.fsx @@ -1,5 +1,5 @@ (*** hide ***) -#I "../../../artifacts/bin/fcs/net461" +#I "../../../artifacts/bin/fcs/netstandard2.0" (** Compiler Services: Processing untyped syntax tree ================================================= diff --git a/fcs/docsrc/tools/generate.fsx b/fcs/docsrc/tools/generate.fsx index 09fa803a2f5..77ddb84fd51 100644 --- a/fcs/docsrc/tools/generate.fsx +++ b/fcs/docsrc/tools/generate.fsx @@ -33,7 +33,7 @@ open FSharp.Literate let root = "." // Paths with template/source/output locations -let bin = __SOURCE_DIRECTORY__ @@ "../../../release/fcs/net461" +let bin = __SOURCE_DIRECTORY__ @@ "../../../release/fcs/netstandard2.0" let content = __SOURCE_DIRECTORY__ @@ "../content" let output = __SOURCE_DIRECTORY__ @@ "../../../docs" let files = __SOURCE_DIRECTORY__ @@ "../files" diff --git a/fcs/netfx.props b/fcs/netfx.props deleted file mode 100644 index 064f29b1809..00000000000 --- a/fcs/netfx.props +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - true - - - /Library/Frameworks/Mono.framework/Versions/Current/lib/mono - /usr/lib/mono - /usr/local/lib/mono - - - $(BaseFrameworkPathOverrideForMono)/4.5-api - $(BaseFrameworkPathOverrideForMono)/4.5.1-api - $(BaseFrameworkPathOverrideForMono)/4.5.2-api - $(BaseFrameworkPathOverrideForMono)/4.6-api - $(BaseFrameworkPathOverrideForMono)/4.6.1-api - $(BaseFrameworkPathOverrideForMono)/4.6.2-api - $(BaseFrameworkPathOverrideForMono)/4.7-api - $(BaseFrameworkPathOverrideForMono)/4.7.1-api - true - - - $(FrameworkPathOverride)/Facades;$(AssemblySearchPaths) - - \ No newline at end of file diff --git a/fcs/samples/EditorService/EditorService.fsproj b/fcs/samples/EditorService/EditorService.fsproj index d71d6dc2913..d7c99bed010 100644 --- a/fcs/samples/EditorService/EditorService.fsproj +++ b/fcs/samples/EditorService/EditorService.fsproj @@ -1,7 +1,6 @@  - - $(FcsTargetNetFxFramework);netcoreapp2.0 + netcoreapp2.0 true Exe false @@ -15,8 +14,4 @@ - - - - diff --git a/fcs/samples/FscExe/App.config b/fcs/samples/FscExe/App.config deleted file mode 100644 index ab704c8783e..00000000000 --- a/fcs/samples/FscExe/App.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/fcs/samples/FscExe/FscExe.fsproj b/fcs/samples/FscExe/FscExe.fsproj deleted file mode 100644 index 97553e41249..00000000000 --- a/fcs/samples/FscExe/FscExe.fsproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - $(FcsTargetNetFxFramework) - true - Exe - false - $(DefineConstants);RESIDENT_COMPILER - - - - - - - - - - - - - - - diff --git a/fcs/samples/FscExe/FscMain.fs b/fcs/samples/FscExe/FscMain.fs deleted file mode 100644 index da272800d65..00000000000 --- a/fcs/samples/FscExe/FscMain.fs +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -module internal FSharp.Compiler.CommandLineMain - -open System -open System.Diagnostics -open System.IO -open System.Reflection -open System.Runtime.CompilerServices -open FSharp.Compiler.SourceCodeServices -open FSharp.Compiler.AbstractIL.IL // runningOnMono -open FSharp.Compiler.AbstractIL.Internal.Library -open FSharp.Compiler.ErrorLogger - -#if RESIDENT_COMPILER -type TypeInThisAssembly() = member x.Dummy = 1 - -let progress = ref false - -/// Implement the optional resident compilation service -module FSharpResidentCompiler = - - open System.Runtime.Remoting.Channels - open System.Runtime.Remoting - open System.Runtime.Remoting.Lifetime - open System.Text - - /// Collect the output from the stdout and stderr streams, character by character, - /// recording the console color used along the way. - type private OutputCollector() = - let output = ResizeArray() - let outWriter isOut = - { new TextWriter() with - member x.Write(c:char) = lock output (fun () -> output.Add (isOut, (try Some Console.ForegroundColor with _ -> None) ,c)) - member x.Encoding = Encoding.UTF8 } - do Console.SetOut (outWriter true) - do Console.SetError (outWriter false) - member x.GetTextAndClear() = lock output (fun () -> let res = output.ToArray() in output.Clear(); res) - - /// The compilation server, which runs in the server process. Accessed by clients using .NET remoting. - type FSharpCompilationServer() = - inherit MarshalByRefObject() - - static let onWindows = - match System.Environment.OSVersion.Platform with - | PlatformID.Win32NT | PlatformID.Win32S | PlatformID.Win32Windows | PlatformID.WinCE -> true - | _ -> false - - // The channel/socket name is qualified by the user name (and domain on windows) - static let domainName = if onWindows then Environment.GetEnvironmentVariable "USERDOMAIN" else "" - static let userName = Environment.GetEnvironmentVariable (if onWindows then "USERNAME" else "USER") - // Use different base channel names on mono and CLR as a CLR remoting process can't talk - // to a mono server - static let baseChannelName = - if runningOnMono then - "FSCChannelMono" - else - "FSCChannel" - static let channelName = baseChannelName + "_" + domainName + "_" + userName - static let serverName = - if runningOnMono then - "FSCServerMono" - else - "FSCSever" - static let mutable serverExists = true - - let outputCollector = new OutputCollector() - - // This background agent ensures all compilation requests sent to the server are serialized - let agent = MailboxProcessor<_>.Start(fun inbox -> - async { - while true do - let! (pwd,argv, reply: AsyncReplyChannel<_>) = inbox.Receive() - if !progress then printfn "server agent: got compilation request, argv = %A" argv - Environment.CurrentDirectory <- pwd - let errors, exitCode = FSharpChecker.Create().Compile (argv) |> Async.RunSynchronously - for error in errors do eprintfn "%s" (error.ToString()) - if !progress then printfn "server: finished compilation request, argv = %A" argv - let output = outputCollector.GetTextAndClear() - reply.Reply(output, exitCode) - GC.Collect(3) - // Exit the server if there are no outstanding requests and the - // current memory usage after collection is over 200MB - if inbox.CurrentQueueLength = 0 && GC.GetTotalMemory(true) > 200L * 1024L * 1024L then - exit 0 - }) - - member x.Run() = - while serverExists do - if !progress then printfn "server: startup thread sleeping..." - System.Threading.Thread.Sleep 1000 - - abstract Ping : unit -> string - abstract Compile : string * string[] -> (bool * System.ConsoleColor option * char) [] * int - default x.Ping() = "ping" - default x.Compile (pwd,argv) = - if !progress then printfn "server: got compilation request, (pwd, argv) = %A" (pwd, argv) - let res = agent.PostAndReply(fun reply -> (pwd,argv,reply)) - if !progress then printfn "server: got response, response = %A" res - res - - override x.Finalize() = - serverExists <- false - - // This is called on the server object by .NET remoting to initialize the lifetime characteristics - // of the server object. - override x.InitializeLifetimeService() = - let lease = (base.InitializeLifetimeService() :?> ILease) - if (lease.CurrentState = LeaseState.Initial) then - lease.InitialLeaseTime <- TimeSpan.FromDays(1.0); - lease.SponsorshipTimeout <- TimeSpan.FromMinutes(2.0); - lease.RenewOnCallTime <- TimeSpan.FromDays(1.0); - box lease - - static member RunServer() = - if !progress then printfn "server: initializing server object" - let server = new FSharpCompilationServer() - let chan = new Ipc.IpcChannel(channelName) - ChannelServices.RegisterChannel(chan,false); - RemotingServices.Marshal(server,serverName) |> ignore - - // On Unix, the file permissions of the implicit socket need to be set correctly to make this - // private to the user. - if runningOnMono then - try - let monoPosix = System.Reflection.Assembly.Load(new System.Reflection.AssemblyName("Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756")) - let monoUnixFileInfo = monoPosix.GetType("Mono.Unix.UnixFileSystemInfo") - let socketName = Path.Combine(FileSystem.GetTempPathShim(), channelName) - let fileEntry = monoUnixFileInfo.InvokeMember("GetFileSystemEntry", (BindingFlags.InvokeMethod ||| BindingFlags.Static ||| BindingFlags.Public), null, null, [| box socketName |],System.Globalization.CultureInfo.InvariantCulture) - // Add 0x00000180 (UserReadWriteExecute) to the access permissions on Unix - monoUnixFileInfo.InvokeMember("set_FileAccessPermissions", (BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public), null, fileEntry, [| box 0x00000180 |],System.Globalization.CultureInfo.InvariantCulture) |> ignore -#if DEBUG - if !progress then printfn "server: good, set permissions on socket name '%s'" socketName - let fileEntry = monoUnixFileInfo.InvokeMember("GetFileSystemEntry", (BindingFlags.InvokeMethod ||| BindingFlags.Static ||| BindingFlags.Public), null, null, [| box socketName |],System.Globalization.CultureInfo.InvariantCulture) - let currPermissions = monoUnixFileInfo.InvokeMember("get_FileAccessPermissions", (BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public), null, fileEntry, [| |],System.Globalization.CultureInfo.InvariantCulture) |> unbox - if !progress then printfn "server: currPermissions = '%o' (octal)" currPermissions -#endif - with e -> -#if DEBUG - printfn "server: failed to set permissions on socket, perhaps on windows? Is is not needed there." -#endif - () - // Fail silently - server.Run() - - static member private ConnectToServer() = - Activator.GetObject(typeof,"ipc://" + channelName + "/" + serverName) - :?> FSharpCompilationServer - - static member TryCompileUsingServer(fscServerExe,argv) = - // Enable these lines to write a log file, e.g. when running under xbuild - //let os = System.IO.File.CreateText "/tmp/fsc-client-log" - //let printfn fmt = Printf.kfprintf (fun () -> fprintfn os ""; os.Flush()) os fmt - let pwd = System.Environment.CurrentDirectory - let clientOpt = - if !progress then printfn "client: creating client" - // Detect the absence of the channel via the exception. Probably not the best way. - // Different exceptions get thrown here on Mono and Windows. - let client = FSharpCompilationServer.ConnectToServer() - try - if !progress then printfn "client: attempting to connect to existing service (1)" - client.Ping() |> ignore - if !progress then printfn "client: connected to existing service" - Some client - with _ -> - if !progress then printfn "client: error while creating client, starting client instead" - let procInfo = - if runningOnMono then - let shellName, useShellExecute = - match System.Environment.GetEnvironmentVariable("FSC_MONO") with - | null -> - if onWindows then - // e.g. "C:\Program Files\Mono-2.6.1\lib\mono\2.0\mscorlib.dll" --> "C:\Program Files\Mono-2.6.1\bin\mono.exe" - Path.Combine(Path.GetDirectoryName (typeof.Assembly.Location), @"..\..\..\bin\mono.exe"), false - else - "mono-sgen", true - | path -> path, true - - ProcessStartInfo(FileName = shellName, - Arguments = fscServerExe + " /server", - CreateNoWindow = true, - UseShellExecute = useShellExecute) - else - ProcessStartInfo(FileName=fscServerExe, - Arguments = "/server", - CreateNoWindow = true, - UseShellExecute = false) - let cmdProcess = new Process(StartInfo=procInfo) - - //let exitE = cmdProcess.Exited |> Observable.map (fun x -> x) - - cmdProcess.Start() |> ignore - //exitE.Add(fun _ -> if !progress then eprintfn "client: the server has exited") - cmdProcess.EnableRaisingEvents <- true; - - // Create the client proxy and attempt to connect to the server - let rec tryAcccesServer nRemaining = - if !progress then printfn "client: trying to access server, nRemaining = '%d'" nRemaining - if nRemaining = 0 then - // Failed to connect to server, give up - None - else - try - if !progress then printfn "client: attempting to connect to existing service (2)" - client.Ping() |> ignore - if !progress then printfn "client: connected to existing service" - Some client - // Detect the absence of the channel via the exception. Probably not the best way. - // Different exceptions get thrown here on Mono and Windows. - with _ (* System.Runtime.Remoting.RemotingException *) -> - // Sleep a bit - System.Threading.Thread.Sleep 50 - tryAcccesServer (nRemaining - 1) - - tryAcccesServer 20 - - match clientOpt with - | Some client -> - if !progress then printfn "client: calling client.Compile(%A)" argv - // Install the global error logger and never remove it. This logger does have all command-line flags considered. - try - let (output, exitCode) = - try client.Compile (pwd, argv) - with e -> - printfn "server error: %s" (e.ToString()) - failwith "remoting error" - - if !progress then printfn "client: returned from client.Compile(%A), res = %d" argv exitCode - use holder = - try let originalConsoleColor = Console.ForegroundColor - { new System.IDisposable with member x.Dispose() = Console.ForegroundColor <- originalConsoleColor } - with _ -> null - let mutable prevConsoleColor = try Console.ForegroundColor with _ -> ConsoleColor.Black - for (isOut, consoleColorOpt, c:char) in output do - try match consoleColorOpt with - | Some consoleColor -> - if prevConsoleColor <> consoleColor then - Console.ForegroundColor <- consoleColor; - | None -> () - with _ -> () - c |> (if isOut then Console.Out.Write else Console.Error.Write) - Some exitCode - with err -> - eprintfn "%s" (err.ToString()) - // We continue on and compile in-process - the server appears to have died half way through. - None - | None -> - None -#endif - -module Driver = - let main argv = - let inline hasArgument name args = - args |> Array.exists (fun x -> x = ("--" + name) || x = ("/" + name)) - let inline stripArgument name args = - args |> Array.filter (fun x -> x <> ("--" + name) && x <> ("/" + name)) - - // Check for --pause as the very first step so that a compiler can be attached here. - if hasArgument "pause" argv then - System.Console.WriteLine("Press any key to continue...") - System.Console.ReadKey() |> ignore - -#if RESIDENT_COMPILER - if runningOnMono && hasArgument "resident" argv then - let argv = stripArgument "resident" argv - - //if not (hasArgument "nologo" argv) then - // printfn "%s" (FSComp.SR.buildProductName(FSharpEnvironment.FSharpTeamVersionNumber)) - // printfn "%s" (FSComp.SR.optsCopyright()) - - let fscServerExe = typeof.Assembly.Location - let exitCodeOpt = FSharpResidentCompiler.FSharpCompilationServer.TryCompileUsingServer (fscServerExe, argv) - match exitCodeOpt with - | Some exitCode -> exitCode - | None -> - let errors, exitCode = FSharpChecker.Create().Compile (argv) |> Async.RunSynchronously - for error in errors do eprintfn "%s" (error.ToString()) - exitCode - - elif runningOnMono && hasArgument "server" argv then - FSharpResidentCompiler.FSharpCompilationServer.RunServer() - 0 -#endif - else - let errors, exitCode = FSharpChecker.Create().Compile (argv) |> Async.RunSynchronously - for error in errors do eprintfn "%s" (error.ToString()) - exitCode - -[] -do () - -[] -let main(argv) = - System.Runtime.GCSettings.LatencyMode <- System.Runtime.GCLatencyMode.Batch - use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter - -//#if NO_HEAPTERMINATION -//#else -// if not runningOnMono then Lib.UnmanagedProcessExecutionOptions.EnableHeapTerminationOnCorruption() (* SDL recommendation *) -// Lib.UnmanagedProcessExecutionOptions.EnableHeapTerminationOnCorruption() (* SDL recommendation *) -//#endif - - try - Driver.main(Array.append [| "fsc.exe" |] argv); - with e -> - errorRecovery e FSharp.Compiler.Range.range0; - 1 diff --git a/fcs/samples/FsiExe/App.config b/fcs/samples/FsiExe/App.config deleted file mode 100644 index 2d8be792223..00000000000 --- a/fcs/samples/FsiExe/App.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/fcs/samples/FsiExe/FsiExe.fsproj b/fcs/samples/FsiExe/FsiExe.fsproj deleted file mode 100644 index 94a2534c0e2..00000000000 --- a/fcs/samples/FsiExe/FsiExe.fsproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - $(FcsTargetNetFxFramework) - true - Exe - false - - - - - - - - - - - - - - - - - - diff --git a/fcs/samples/FsiExe/console.fs b/fcs/samples/FsiExe/console.fs deleted file mode 100644 index efde3707c25..00000000000 --- a/fcs/samples/FsiExe/console.fs +++ /dev/null @@ -1,434 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace FSharp.Compiler.Interactive - -open System -open System.Text -open System.Collections.Generic - - -type internal Style = Prompt | Out | Error - -/// Class managing the command History. -type internal History() = - let list = new List() - let mutable current = 0 - - member x.Count = list.Count - member x.Current = - if current >= 0 && current < list.Count then list.[current] else String.Empty - - member x.Clear() = list.Clear(); current <- -1 - member x.Add line = - match line with - | null | "" -> () - | _ -> list.Add(line) - - member x.AddLast line = - match line with - | null | "" -> () - | _ -> list.Add(line); current <- list.Count - - // Dead code - // member x.First() = current <- 0; x.Current - // member x.Last() = current <- list.Count - 1; x.Current; - - member x.Previous() = - if (list.Count > 0) then - current <- ((current - 1) + list.Count) % list.Count - x.Current - - member x.Next() = - if (list.Count > 0) then - current <- (current + 1) % list.Count - x.Current - -/// List of available optionsCache - -type internal Options() = - inherit History() - let mutable root = "" - member x.Root with get() = root and set(v) = (root <- v) - -/// Cursor position management - -module internal Utils = - - open System - open System.Reflection - open Microsoft.FSharp.Core - open Microsoft.FSharp.Collections - - let guard(f) = f() - - // Quick and dirty dirty method lookup for inlined IL - // In some situations, we can't use ldtoken to obtain a RuntimeMethodHandle, since the method - // in question's token may contain typars from an external type environment. Such a token would - // cause the PE file to be flagged as invalid. - // In such a situation, we'll want to search out the MethodRef in a similar fashion to bindMethodBySearch - // but since we can't use ldtoken to obtain System.Type objects, we'll need to do everything with strings. - // This is the least fool-proof method for resolving the binding, but since the scenarios it's used in are - // so constrained, (fsi 2.0, methods with generic multi-dimensional arrays in their signatures), it's - // acceptable - let findMethod (parentT:Type,nm,marity,argtys : string [],rty : string) = - let staticOrInstanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly - let methInfos = parentT.GetMethods(staticOrInstanceBindingFlags) |> Array.toList - - let methInfos = methInfos |> List.filter (fun methInfo -> methInfo.Name = nm) - match methInfos with - | [methInfo] -> - methInfo - | _ -> - let select (methInfo:MethodInfo) = - let mtyargTIs = if methInfo.IsGenericMethod then methInfo.GetGenericArguments() else [| |] - if mtyargTIs.Length <> marity then false else - - let haveArgTs = - let parameters = Array.toList (methInfo.GetParameters()) - parameters |> List.map (fun param -> param.ParameterType) - let haveResT = methInfo.ReturnType - - if argtys.Length <> haveArgTs.Length then false else - let res = rty :: (Array.toList argtys) = (List.map (fun (t : System.Type) -> t.Name) (haveResT::haveArgTs)) - res - - match List.tryFind select methInfos with - | None -> failwith "Internal Error: cannot bind to method" - | Some methInfo -> methInfo - -[] -type internal Cursor = - static member ResetTo(top,left) = - Utils.guard(fun () -> - Console.CursorTop <- min top (Console.BufferHeight - 1); - Console.CursorLeft <- left) - static member Move(inset, delta) = - let position = Console.CursorTop * (Console.BufferWidth - inset) + (Console.CursorLeft - inset) + delta - let top = position / (Console.BufferWidth - inset) - let left = inset + position % (Console.BufferWidth - inset) - Cursor.ResetTo(top,left) - -type internal Anchor = - {top:int; left:int} - static member Current(inset) = {top=Console.CursorTop;left= max inset Console.CursorLeft} - - member p.PlaceAt(inset, index) = - //printf "p.top = %d, p.left = %d, inset = %d, index = %d\n" p.top p.left inset index; - let left = inset + (( (p.left - inset) + index) % (Console.BufferWidth - inset)) - let top = p.top + ( (p.left - inset) + index) / (Console.BufferWidth - inset) - Cursor.ResetTo(top,left) - -type internal ReadLineConsole() = - let history = new History() - let mutable complete : (string option * string -> seq) = fun (_s1,_s2) -> Seq.empty - member x.SetCompletionFunction f = complete <- f - - /// Inset all inputs by this amount - member x.Prompt = "> " - member x.Prompt2 = "- " - member x.Inset = x.Prompt.Length - - member x.GetOptions(input:string) = - /// Tab optionsCache available in current context - let optionsCache = new Options() - - let rec look parenCount i = - if i <= 0 then i else - match input.Chars(i - 1) with - | c when Char.IsLetterOrDigit(c) (* or Char.IsWhiteSpace(c) *) -> look parenCount (i-1) - | '.' | '_' -> look parenCount (i-1) - | '}' | ')' | ']' -> look (parenCount+1) (i-1) - | '(' | '{' | '[' -> look (parenCount-1) (i-1) - | _ when parenCount > 0 -> look parenCount (i-1) - | _ -> i - let start = look 0 input.Length - - let name = input.Substring(start, input.Length - start); - if (name.Trim().Length > 0) then - let lastDot = name.LastIndexOf('.'); - let attr, pref, root = - if (lastDot < 0) then - None, name, input.Substring(0, start) - else - Some(name.Substring(0, lastDot)), - name.Substring(lastDot + 1), - input.Substring(0, start + lastDot + 1) - //printf "attr, pref, root = %s\n" (any_to_string (attr, pref, root)) - try - complete(attr,pref) - |> Seq.filter(fun option -> option.StartsWith(pref,StringComparison.Ordinal)) - |> Seq.iter (fun option -> optionsCache.Add(option)) - // engine.Evaluate(String.Format("dir({0})", attr)) as IEnumerable; - optionsCache.Root <-root; - with e -> - optionsCache.Clear(); - optionsCache,true; - else - optionsCache,false; - - member x.MapCharacter(c) : string = - match c with - | '\x1A'-> "^Z"; - | _ -> "^?" - - member x.GetCharacterSize(c) = - if (Char.IsControl(c)) - then x.MapCharacter(c).Length - else 1 - - static member TabSize = 4; - - member x.ReadLine() = - - let checkLeftEdge(prompt) = - let currLeft = Console.CursorLeft - if currLeft < x.Inset then - if currLeft = 0 then Console.Write (if prompt then x.Prompt2 else String(' ',x.Inset)) - Utils.guard(fun () -> - Console.CursorTop <- min Console.CursorTop (Console.BufferHeight - 1); - Console.CursorLeft <- x.Inset); - - // The caller writes the primary prompt. If we are reading the 2nd and subsequent lines of the - // input we're responsible for writing the secondary prompt. - checkLeftEdge true - - /// Cursor anchor - position of !anchor when the routine was called - let anchor = ref (Anchor.Current(x.Inset)); - /// Length of the output currently rendered on screen. - let rendered = ref 0 - /// Input has changed, therefore options cache is invalidated. - let changed = ref false - /// Cache of optionsCache - let optionsCache = ref (new Options()) - - let writeBlank() = - Console.Write(' '); - checkLeftEdge false - let writeChar(c) = - if Console.CursorTop = Console.BufferHeight - 1 && Console.CursorLeft = Console.BufferWidth - 1 then - //printf "bottom right!\n"; - anchor := { !anchor with top = (!anchor).top - 1 }; - checkLeftEdge true - if (Char.IsControl(c)) then - let s = x.MapCharacter(c) - Console.Write(s); - rendered := !rendered + s.Length; - else - Console.Write(c); - rendered := !rendered + 1; - checkLeftEdge true - - /// The console input buffer. - let input = new StringBuilder() - /// Current position - index into the input buffer - let current = ref 0; - - let render() = - //printf "render\n"; - let curr = !current - (!anchor).PlaceAt(x.Inset,0); - let output = new StringBuilder() - let mutable position = -1 - for i = 0 to input.Length - 1 do - if (i = curr) then - position <- output.Length - let c = input.Chars(i) - if (Char.IsControl(c)) then - output.Append(x.MapCharacter(c)) |> ignore; - else - output.Append(c) |> ignore; - - if (curr = input.Length) then - position <- output.Length; - - // render the current text, computing a new value for "rendered" - let old_rendered = !rendered - rendered := 0; - for i = 0 to input.Length - 1 do - writeChar(input.Chars(i)); - - // blank out any dangling old text - for i = !rendered to old_rendered - 1 do - writeBlank(); - - (!anchor).PlaceAt(x.Inset,position); - - render(); - - let insertChar(c:char) = - if (!current = input.Length) then - current := !current + 1; - input.Append(c) |> ignore; - writeChar(c) - else - input.Insert(!current, c) |> ignore; - current := !current + 1; - render(); - - let insertTab() = - for i = ReadLineConsole.TabSize - (!current % ReadLineConsole.TabSize) downto 1 do - insertChar(' ') - - let moveLeft() = - if (!current > 0 && (!current - 1 < input.Length)) then - current := !current - 1 - let c = input.Chars(!current) - Cursor.Move(x.Inset, - x.GetCharacterSize(c)) - - let moveRight() = - if (!current < input.Length) then - let c = input.Chars(!current); - current := !current + 1; - Cursor.Move(x.Inset, x.GetCharacterSize(c)); - - let setInput(line:string) = - input.Length <- 0; - input.Append(line) |> ignore; - current := input.Length; - render() - - let tabPress(shift) = - let opts,prefix = - if !changed then - changed := false; - x.GetOptions(input.ToString()); - else - !optionsCache,false - optionsCache := opts; - - if (opts.Count > 0) then - let part = - if shift - then opts.Previous() - else opts.Next(); - setInput(opts.Root + part); - else - if (prefix) then - Console.Beep(); - else - insertTab(); - - let delete() = - if (input.Length > 0 && !current < input.Length) then - input.Remove(!current, 1) |> ignore; - render(); - - let deleteToEndOfLine() = - if (!current < input.Length) then - input.Remove (!current, input.Length - !current) |> ignore; - render(); - - let insert(key: ConsoleKeyInfo) = - // REVIEW: is this F6 rewrite required? 0x1A looks like Ctrl-Z. - // REVIEW: the Ctrl-Z code is not recognised as EOF by the lexer. - // REVIEW: looks like a relic of the port of readline, which is currently removable. - let c = if (key.Key = ConsoleKey.F6) then '\x1A' else key.KeyChar - insertChar(c); - - let backspace() = - if (input.Length > 0 && !current > 0) then - input.Remove(!current - 1, 1) |> ignore; - current := !current - 1; - render(); - - let enter() = - Console.Write("\n"); - let line = input.ToString(); - if (line = "\x1A") then null - else - if (line.Length > 0) then - history.AddLast(line); - line; - - let rec read() = - let key = Console.ReadKey true - - match (key.Key) with - | ConsoleKey.Backspace -> - backspace(); - change() - | ConsoleKey.Delete -> - delete(); - change() - | ConsoleKey.Enter -> - enter() - | ConsoleKey.Tab -> - tabPress(key.Modifiers &&& ConsoleModifiers.Shift <> enum 0); - read() - | ConsoleKey.UpArrow -> - setInput(history.Previous()); - change() - | ConsoleKey.DownArrow -> - setInput(history.Next()); - change() - | ConsoleKey.RightArrow -> - moveRight() - change() - | ConsoleKey.LeftArrow -> - moveLeft() - change() - | ConsoleKey.Escape -> - setInput(String.Empty); - change() - | ConsoleKey.Home -> - current := 0; - (!anchor).PlaceAt(x.Inset,0) - change() - | ConsoleKey.End -> - current := input.Length; - (!anchor).PlaceAt(x.Inset,!rendered); - change() - | _ -> - match (key.Modifiers, key.KeyChar) with - // Control-A - | (ConsoleModifiers.Control, '\001') -> - current := 0; - (!anchor).PlaceAt(x.Inset,0) - change () - // Control-E - | (ConsoleModifiers.Control, '\005') -> - current := input.Length; - (!anchor).PlaceAt(x.Inset,!rendered) - change () - // Control-B - | (ConsoleModifiers.Control, '\002') -> - moveLeft() - change () - // Control-f - | (ConsoleModifiers.Control, '\006') -> - moveRight() - change () - // Control-k delete to end of line - | (ConsoleModifiers.Control, '\011') -> - deleteToEndOfLine() - change() - // Control-P - | (ConsoleModifiers.Control, '\016') -> - setInput(history.Previous()); - change() - // Control-n - | (ConsoleModifiers.Control, '\014') -> - setInput(history.Next()); - change() - // Control-d - | (ConsoleModifiers.Control, '\004') -> - if (input.Length = 0) then - exit 0 //quit - else - delete() - change() - | _ -> - // Note: If KeyChar=0, the not a proper char, e.g. it could be part of a multi key-press character, - // e.g. e-acute is ' and e with the French (Belgium) IME and US Intl KB. - // Here: skip KeyChar=0 (except for F6 which maps to 0x1A (ctrl-Z?)). - if key.KeyChar <> '\000' || key.Key = ConsoleKey.F6 then - insert(key); - change() - else - // Skip and read again. - read() - - and change() = - changed := true; - read() - read() diff --git a/fcs/samples/FsiExe/fsimain.fs b/fcs/samples/FsiExe/fsimain.fs deleted file mode 100644 index 5fb34c3af17..00000000000 --- a/fcs/samples/FsiExe/fsimain.fs +++ /dev/null @@ -1,240 +0,0 @@ -//---------------------------------------------------------------------------- -// This sample checks that the standard fsi.exe can be built when using the compiler API -// through appropriate configuration parameters. -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// Copyright (c) 2002-2012 Microsoft Corporation. -// All Rights Reserved. -// -// See License.txt in the project root for license information. -// -// You must not remove this notice, or any other, from this software. -//---------------------------------------------------------------------------- - - -module internal Sample.FSharp.Compiler.Interactive.Main - -open System -open System.Globalization -open System.Reflection -open System.Threading -open System.Windows.Forms - -open FSharp.Compiler.Interactive.Shell -open FSharp.Compiler - -#nowarn "55" - -[] -[] -do() - -/// Set the current ui culture for the current thread. -let internal SetCurrentUICultureForThread (lcid : int option) = - match lcid with - | Some n -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(n) - | None -> () - -///Use a dummy to access protected member -type internal DummyForm() = - inherit Form() - member x.DoCreateHandle() = x.CreateHandle() - /// Creating the dummy form object can crash on Mono Mac, and then prints a nasty background - /// error during finalization of the half-initialized object... - override x.Finalize() = () - -#if USE_WINFORMS_EVENT_LOOP -/// This is the event loop implementation for winforms -let WinFormsEventLoop(lcid : int option) = - let mainForm = new DummyForm() - do mainForm.DoCreateHandle(); - // Set the default thread exception handler - let restart = ref false - { new FSharp.Compiler.Interactive.IEventLoop with - member x.Run() = - restart := false - Application.Run() - !restart - member x.Invoke (f: unit -> 'T) : 'T = - if not mainForm.InvokeRequired then - f() - else - - // Workaround: Mono's Control.Invoke returns a null result. Hence avoid the problem by - // transferring the resulting state using a mutable location. - let mainFormInvokeResultHolder = ref None - - // Actually, Mono's Control.Invoke isn't even blocking (or wasn't on 1.1.15)! So use a signal to indicate completion. - // Indeed, we should probably do this anyway with a timeout so we can report progress from - // the GUI thread. - use doneSignal = new AutoResetEvent(false) - - - // BLOCKING: This blocks the stdin-reader thread until the - // form invocation has completed. NOTE: does not block on Mono, or did not on 1.1.15 - mainForm.Invoke(new MethodInvoker(fun () -> - try - // When we get called back, someone may jack our culture - // So we must reset our UI culture every time - SetCurrentUICultureForThread lcid - mainFormInvokeResultHolder := Some(f ()) - finally - doneSignal.Set() |> ignore)) |> ignore - - //if !progress then fprintfn outWriter "RunCodeOnWinFormsMainThread: Waiting for completion signal...." - while not (doneSignal.WaitOne(new TimeSpan(0,0,1),true)) do - () // if !progress then fprintf outWriter "." outWriter.Flush() - - //if !progress then fprintfn outWriter "RunCodeOnWinFormsMainThread: Got completion signal, res = %b" (Option.isSome !mainFormInvokeResultHolder) - !mainFormInvokeResultHolder |> Option.get - - member x.ScheduleRestart() = restart := true; Application.Exit() } - -#endif - -let StartServer (fsiSession : FsiEvaluationSession) (fsiServerName) = - let server = - {new Server.Shared.FSharpInteractiveServer() with - member this.Interrupt() = - //printf "FSI-SERVER: received CTRL-C request...\n" - try - fsiSession.Interrupt() - with e -> - // Final sanity check! - catch all exns - but not expected - assert false - () - } - - Server.Shared.FSharpInteractiveServer.StartServer(fsiServerName,server) - -//---------------------------------------------------------------------------- -// GUI runCodeOnMainThread -//---------------------------------------------------------------------------- - -let internal TrySetUnhandledExceptionMode() = - let i = ref 0 // stop inlining - try - Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException) - with _ -> - decr i;() - -// Mark the main thread as STAThread since it is a GUI thread -[] -[] -[] -let MainMain argv = - ignore argv - let argv = System.Environment.GetCommandLineArgs() - - let isShadowCopy x = (x = "/shadowcopyreferences" || x = "--shadowcopyreferences" || x = "/shadowcopyreferences+" || x = "--shadowcopyreferences+") - if AppDomain.CurrentDomain.IsDefaultAppDomain() && argv |> Array.exists isShadowCopy then - let setupInformation = AppDomain.CurrentDomain.SetupInformation - setupInformation.ShadowCopyFiles <- "true" - let helper = AppDomain.CreateDomain("FSI_Domain", null, setupInformation) - helper.ExecuteAssemblyByName(Assembly.GetExecutingAssembly().GetName()) - else - // When VFSI is running, set the input/output encoding to UTF8. - // Otherwise, unicode gets lost during redirection. - // It is required only under Net4.5 or above (with unicode console feature). - if argv |> Array.exists (fun x -> x.Contains "fsi-server") then - Console.InputEncoding <- System.Text.Encoding.UTF8 - Console.OutputEncoding <- System.Text.Encoding.UTF8 - - -#if DEBUG - if argv |> Array.exists (fun x -> x = "/pause" || x = "--pause") then - Console.WriteLine("Press any key to continue...") - Console.ReadKey() |> ignore -#endif - - try - let console = new FSharp.Compiler.Interactive.ReadLineConsole() - let getConsoleReadLine (probeToSeeIfConsoleWorks) = - let consoleIsOperational = - if probeToSeeIfConsoleWorks then - //if progress then fprintfn outWriter "probing to see if console works..." - try - // Probe to see if the console looks functional on this version of .NET - let _ = Console.KeyAvailable - let c1 = Console.ForegroundColor - let c2 = Console.BackgroundColor - let _ = Console.CursorLeft <- Console.CursorLeft - //if progress then fprintfn outWriter "probe succeeded, we might have a console, comparing foreground (%A) and background (%A) colors, if they are the same then we're running in emacs or VS on unix and we turn off readline by default..." c1 c2 - c1 <> c2 - with _ -> - //if progress then fprintfn outWriter "probe failed, we have no console..." - false - else true - if consoleIsOperational then - Some (fun () -> console.ReadLine()) - else - None - -#if USE_FSharp_Compiler_Interactive_Settings - let fsiConfig0 = FsiEvaluationSession.GetDefaultConfiguration(fsi) -#else - let fsiConfig0 = FsiEvaluationSession.GetDefaultConfiguration() -#endif - let rec fsiConfig = - { // Update the configuration to include 'StartServer' and 'OptionalConsoleReadLine' - new FsiEvaluationSessionHostConfig () with - member __.FormatProvider = fsiConfig0.FormatProvider - member __.FloatingPointFormat = fsiConfig0.FloatingPointFormat - member __.AddedPrinters = fsiConfig0.AddedPrinters - member __.ShowDeclarationValues = fsiConfig0.ShowDeclarationValues - member __.ShowIEnumerable = fsiConfig0.ShowIEnumerable - member __.ShowProperties = fsiConfig0.ShowProperties - member __.PrintSize = fsiConfig0.PrintSize - member __.PrintDepth = fsiConfig0.PrintDepth - member __.PrintWidth = fsiConfig0.PrintWidth - member __.PrintLength = fsiConfig0.PrintLength - member __.ReportUserCommandLineArgs args = fsiConfig0.ReportUserCommandLineArgs args - member __.EventLoopRun() = fsiConfig0.EventLoopRun() - member __.EventLoopInvoke(f) = fsiConfig0.EventLoopInvoke(f) - member __.EventLoopScheduleRestart() = fsiConfig0.EventLoopScheduleRestart() - member __.UseFsiAuxLib = fsiConfig0.UseFsiAuxLib - - member __.StartServer(fsiServerName) = StartServer fsiSession fsiServerName - - // Connect the configuration through to the 'fsi' Event loop - member __.GetOptionalConsoleReadLine(probe) = getConsoleReadLine(probe) } - - and fsiSession = FsiEvaluationSession.Create (fsiConfig, argv, Console.In, Console.Out, Console.Error) - - if fsiSession.IsGui then - try - Application.EnableVisualStyles() - with _ -> - () - - // Route GUI application exceptions to the exception handlers - Application.add_ThreadException(new ThreadExceptionEventHandler(fun _ args -> fsiSession.ReportUnhandledException args.Exception)); - - let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e-> false - if not runningOnMono then - try - TrySetUnhandledExceptionMode() - with _ -> - () - -#if USE_WINFORMS_EVENT_LOOP - try fsi.EventLoop <- WinFormsEventLoop(fsiSession.LCID) - with e -> - printfn "Your system doesn't seem to support WinForms correctly. You will" - printfn "need to set fsi.EventLoop use GUI windows from F# Interactive." - printfn "You can set different event loops for MonoMac, Gtk#, WinForms and other" - printfn "UI toolkits. Drop the --gui argument if no event loop is required." -#endif - - - console.SetCompletionFunction(fun (s1,s2) -> fsiSession.GetCompletions (match s1 with | Some s -> s + "." + s2 | None -> s2)) - - fsiSession.Run() - with e -> printf "Exception by fsi.exe:\n%+A\n" e - - 0 - - - - diff --git a/fcs/samples/FsiExe/fsiserver.fs b/fcs/samples/FsiExe/fsiserver.fs deleted file mode 100644 index 838c2593046..00000000000 --- a/fcs/samples/FsiExe/fsiserver.fs +++ /dev/null @@ -1,56 +0,0 @@ -// Warning: -// Code taken verbatim from the open source version of FSharp.Compiler.Server.Shared -// Do *not* change namespace or server class implementation as this will most likely -// break compatibility with Visual Studio. -// - -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -//[] // avoid calling the type "Shared" which is keyword in some languages -namespace FSharp.Compiler.Server.Shared - -// For FSI VS plugin, require FSI to provide services: -// e.g. -// - interrupt -// - intellisense completion -// -// This is done via remoting. -// Here we define the service class. -// This dll is required for both client (fsi-vs plugin) and server (spawned fsi). - -//[] -[] -[] -do() - -open System -open System.Diagnostics -open System.Runtime.Remoting.Channels -open System.Runtime.Remoting -open System.Runtime.Remoting.Lifetime - -[] -type internal FSharpInteractiveServer() = - inherit System.MarshalByRefObject() - abstract Interrupt : unit -> unit -#if FSI_SERVER_INTELLISENSE - abstract Completions : prefix:string -> string array - abstract GetDeclarations : text:string * names:string array -> (string * string * string * int) array -#endif - default x.Interrupt() = () - - [] - static member StartServer(channelName:string,server:FSharpInteractiveServer) = - let chan = new Ipc.IpcChannel(channelName) - LifetimeServices.LeaseTime <- TimeSpan(7,0,0,0); // days,hours,mins,secs - LifetimeServices.LeaseManagerPollTime <- TimeSpan(7,0,0,0); - LifetimeServices.RenewOnCallTime <- TimeSpan(7,0,0,0); - LifetimeServices.SponsorshipTimeout <- TimeSpan(7,0,0,0); - ChannelServices.RegisterChannel(chan,false); - let _ = RemotingServices.Marshal(server,"FSIServer") - () - - static member StartClient(channelName) = - let T = Activator.GetObject(typeof,"ipc://" + channelName + "/FSIServer") - let x = T :?> FSharpInteractiveServer - x diff --git a/fcs/samples/InteractiveService/App.config b/fcs/samples/InteractiveService/App.config deleted file mode 100644 index c485ef2b042..00000000000 --- a/fcs/samples/InteractiveService/App.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/fcs/samples/InteractiveService/InteractiveService.fsproj b/fcs/samples/InteractiveService/InteractiveService.fsproj index bd834961496..ff451281b45 100644 --- a/fcs/samples/InteractiveService/InteractiveService.fsproj +++ b/fcs/samples/InteractiveService/InteractiveService.fsproj @@ -1,21 +1,15 @@  - - $(FcsTargetNetFxFramework) + netcoreapp2.0 true Exe false - - - - - diff --git a/fcs/samples/Tokenizer/App.config b/fcs/samples/Tokenizer/App.config deleted file mode 100644 index c485ef2b042..00000000000 --- a/fcs/samples/Tokenizer/App.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/fcs/samples/Tokenizer/Tokenizer.fsproj b/fcs/samples/Tokenizer/Tokenizer.fsproj index bd834961496..ff451281b45 100644 --- a/fcs/samples/Tokenizer/Tokenizer.fsproj +++ b/fcs/samples/Tokenizer/Tokenizer.fsproj @@ -1,21 +1,15 @@  - - $(FcsTargetNetFxFramework) + netcoreapp2.0 true Exe false - - - - - diff --git a/fcs/samples/UntypedTree/App.config b/fcs/samples/UntypedTree/App.config deleted file mode 100644 index c485ef2b042..00000000000 --- a/fcs/samples/UntypedTree/App.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/fcs/samples/UntypedTree/UntypedTree.fsproj b/fcs/samples/UntypedTree/UntypedTree.fsproj index bd834961496..ff451281b45 100644 --- a/fcs/samples/UntypedTree/UntypedTree.fsproj +++ b/fcs/samples/UntypedTree/UntypedTree.fsproj @@ -1,21 +1,15 @@  - - $(FcsTargetNetFxFramework) + netcoreapp2.0 true Exe false - - - - -