Skip to content
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Build Status

Head (branch ``master``), Mono 3.x, OSX + unit tests (Travis) [![Build Status](https://travis-ci.org/fsharp/FSharp.Compiler.Service.png?branch=master)](https://travis-ci.org/fsharp/FSharp.Compiler.Service/branches)

Head (branch ``master``), Windows Server 2012 R2 + unit tests (AppVeyor) [![Build status](https://ci.appveyor.com/api/projects/status/3yllu2qh19brk61d)](https://ci.appveyor.com/project/fsgit/fsharp-compiler-service)
Head (branch ``master``), Windows Server 2012 R2 + unit tests (AppVeyor) [![Build status](https://ci.appveyor.com/api/projects/status/3yllu2qh19brk61d?svg=true)](https://ci.appveyor.com/project/fsgit/fsharp-compiler-service)

NuGet Feed [![NuGet Badge](https://buildstats.info/nuget/FSharp.Compiler.Service)](https://www.nuget.org/packages/FSharp.Compiler.Service)

Expand Down
17 changes: 15 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
os: Windows Server 2012 R2
os: Visual Studio 2015

init:
- git config --global core.autocrlf input

environment:
matrix:
- BUILD_TARGET: DotnetCliTests
- BUILD_TARGET: NuGet

matrix:
allow_failures:
- BUILD_TARGET: DotnetCliTests

build_script:
- cmd: build.cmd NuGet
- ps: dotnet --info
- cmd: build.cmd %BUILD_TARGET%

test: off
version: '{build}'
artifacts:
Expand Down
45 changes: 30 additions & 15 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,32 @@ Target "DotnetCliBuild" (fun _ ->
let open1 = @" --open Microsoft.FSharp.Compiler.AbstractIL"
let open2 = @" --open Microsoft.FSharp.Compiler"
let open3 = @" --open Microsoft.FSharp.Compiler"
let options = " --configuration Release"

// FSharp.Compiler.Service
let workDir = @"src/fsharp/FSharp.Compiler.Service.netcore/"
Shell.Exec("dotnet", "restore -v Minimal", workDir) |> assertExitCodeZero

Shell.Exec("dotnet", "fssrgen ../FSComp.txt ./FSComp.fs ./FSComp.resx", workDir) |> assertExitCodeZero
Shell.Exec("dotnet", "fssrgen ../fsi/FSIstrings.txt ./FSIstrings.fs ./FSIstrings.resx", workDir) |> assertExitCodeZero
Shell.Exec(fsLex, @"../lex.fsl --unicode" + lexArgs + " -o lex.fs", workDir) |> assertExitCodeZero
Shell.Exec(fsLex, @"../pplex.fsl --unicode" + lexArgs + " -o pplex.fs", workDir) |> assertExitCodeZero
Shell.Exec(fsLex, @"../../absil/illex.fsl --unicode" + lexArgs + " -o illex.fs", workDir) |> assertExitCodeZero
Shell.Exec(fsYacc, @"../../absil/ilpars.fsy" + lexArgs + yaccArgs + module1 + open1 + " -o ilpars.fs", workDir) |> assertExitCodeZero
Shell.Exec(fsYacc, @"../pars.fsy" + lexArgs + yaccArgs + module2 + open2 + " -o pars.fs", workDir) |> assertExitCodeZero
Shell.Exec(fsYacc, @"../pppars.fsy" + lexArgs + yaccArgs + module3 + open3 + " -o pppars.fs", workDir) |> assertExitCodeZero

Shell.Exec("dotnet", "pack -c Release -o ../../../" + buildDir, workDir) |> assertExitCodeZero

let outPath = @"src/fsharp/FSharp.Compiler.Service.netcore/"
Shell.Exec("dotnet", "restore", outPath) |> ignore //assertExitCodeZero

Shell.Exec("dotnet", "fssrgen ../FSComp.txt ./FSComp.fs ./FSComp.resx", outPath) |> assertExitCodeZero
Shell.Exec("dotnet", "fssrgen ../fsi/FSIstrings.txt ./FSIstrings.fs ./FSIstrings.resx", outPath) |> assertExitCodeZero
Shell.Exec(fsLex, @"../lex.fsl --unicode" + lexArgs + " -o lex.fs", outPath) |> assertExitCodeZero
Shell.Exec(fsLex, @"../pplex.fsl --unicode" + lexArgs + " -o pplex.fs", outPath) |> assertExitCodeZero
Shell.Exec(fsLex, @"../../absil/illex.fsl --unicode" + lexArgs + " -o illex.fs", outPath) |> assertExitCodeZero
Shell.Exec(fsYacc, @"../../absil/ilpars.fsy" + lexArgs + yaccArgs + module1 + open1 + " -o ilpars.fs", outPath) |> assertExitCodeZero
Shell.Exec(fsYacc, @"../pars.fsy" + lexArgs + yaccArgs + module2 + open2 + " -o pars.fs", outPath) |> assertExitCodeZero
Shell.Exec(fsYacc, @"../pppars.fsy" + lexArgs + yaccArgs + module3 + open3 + " -o pppars.fs", outPath) |> assertExitCodeZero

Shell.Exec("dotnet", "--verbose pack" + options, outPath) |> assertExitCodeZero
// FSharp.Compiler.Service.ProjectCracker
let workDir = @"src/fsharp/FSharp.Compiler.Service.ProjectCracker.netcore/"
Shell.Exec("dotnet", "restore -v Minimal", workDir) |> assertExitCodeZero
Shell.Exec("dotnet", "pack -c Release -o ../../../" + buildDir, workDir) |> assertExitCodeZero
)

Target "DotnetCliTests" (fun _ ->
let workDir = @"tests/FSharp.Compiler.Service.Tests.netcore/"
Shell.Exec("dotnet", "restore -v Minimal", workDir) |> assertExitCodeZero
Shell.Exec("dotnet", "run", workDir) |> assertExitCodeZero
)

// --------------------------------------------------------------------------------------
Expand All @@ -254,13 +265,17 @@ Target "Prepare" DoNothing
Target "PrepareRelease" DoNothing
Target "All" DoNothing
Target "Release" DoNothing
Target "AllDotnetCli" DoNothing

"AllDotnetCli"
=?> ("DotnetCliBuild", isDotnetCliInstalled)
=?> ("DotnetCliTests", isDotnetCliInstalled)

"Clean"
=?> ("BuildVersion", isAppVeyorBuild)
==> "AssemblyInfo"
==> "GenerateFSIStrings"
==> "Prepare"
=?> ("DotnetCliBuild", isDotnetCliInstalled)
==> "Build"
==> "RunTests"
==> "All"
Expand Down
12 changes: 8 additions & 4 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,6 @@ let OutputErrorOrWarningContext prefix fileLineFn os err =

let GetFSharpCoreLibraryName () = "FSharp.Core"

type internal TypeInThisAssembly = class end
let GetFSharpCoreReferenceUsedByCompiler(useMonoResolution) =
// On Mono, there is no good reference resolution
if useMonoResolution then
Expand All @@ -1555,10 +1554,10 @@ let GetFSharpCoreReferenceUsedByCompiler(useMonoResolution) =
// So use the fsharp.core.dll from alongside the fsc compiler.
// This can also be used for the out of gac work on DEV15
let fscCoreLocation =
let fscLocation = typeof<TypeInThisAssembly>.Assembly.Location
let fscLocation = typeof<Microsoft.FSharp.Core.MeasureAttribute>.Assembly.Location
Path.Combine(Path.GetDirectoryName(fscLocation), fsCoreName + ".dll")
if File.Exists(fscCoreLocation) then fsCoreName + ".dll"
else failwithf "Internal error: Could not find %s" fsCoreName
else failwithf "Internal error: Could not find %s" fscCoreLocation
#else
// check if FSharp.Core can be found from the hosting environment
let foundReference =
Expand Down Expand Up @@ -2119,7 +2118,12 @@ type TcConfigBuilder =
System.Diagnostics.Debug.Assert(FileSystem.IsPathRootedShim(implicitIncludeDir), sprintf "implicitIncludeDir should be absolute: '%s'" implicitIncludeDir)
if (String.IsNullOrEmpty(defaultFSharpBinariesDir)) then
failwith "Expected a valid defaultFSharpBinariesDir"
{ primaryAssembly = PrimaryAssembly.Mscorlib; // defaut value, can be overridden using the command line switch
{
#if TODO_REWORK_ASSEMBLY_LOAD
primaryAssembly = PrimaryAssembly.DotNetCore; // defaut value, can be overridden using the command line switch
#else
primaryAssembly = PrimaryAssembly.Mscorlib; // defaut value, can be overridden using the command line switch
#endif
light = None;
noFeedback=false;
stackReserveSize=None;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="fsharp-daily" value="https://www.myget.org/F/fsharp-daily/api/v3/index.json" />
<add key="dotnet-buildtools" value="https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="dotnet-cli" value="https://dotnet.myget.org/F/dotnet-cli/api/v3/index.json" />
<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool

open System
open System.IO
open System.Runtime.Serialization.Json

module Program =

[<EntryPoint>]
let main argv =
let text = Array.exists (fun (s: string) -> s = "--text") argv
let argv = Array.filter (fun (s: string) -> s <> "--text") argv

let ret, opts = ProjectCrackerTool.crackOpen argv

if text then
printfn "%A" opts
else
let ser = new DataContractJsonSerializer(typeof<ProjectOptions>)
ser.WriteObject(Console.OpenStandardOutput(), opts)
ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
namespace Microsoft.FSharp.Compiler.SourceCodeServices

open System
open System.IO
open System.Text
open Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool


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
let logMap = ref Map.empty

let rec convert (opts: ProjectOptions) : FSharpProjectOptions =
let referencedProjects = Array.map (fun (a, b) -> a, convert b) opts.ReferencedProjectOptions
logMap := Map.add opts.ProjectFile opts.LogOutput !logMap
{
ProjectFileName = opts.ProjectFile
ProjectFileNames = [| |]
OtherOptions = opts.Options
ReferencedProjects = referencedProjects
IsIncompleteTypeCheckEnvironment = false
UseScriptResolutionRules = false
LoadTime = loadedTimeStamp
UnresolvedReferences = None
}

let arguments = [|
yield projectFileName
yield enableLogging.ToString()
for k, v in properties do
yield k
yield v
|]

let ret, opts = ProjectCrackerTool.crackOpen arguments
ignore ret
convert opts, !logMap

static member GetProjectOptionsFromProjectFile(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp) =
fst (ProjectCracker.GetProjectOptionsFromProjectFileLogged(
projectFileName,
?properties=properties,
?loadedTimeStamp=loadedTimeStamp,
enableLogging=false))
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool

[<CLIMutable>]
type ProjectOptions =
{
ProjectFile: string
Options: string[]
ReferencedProjectOptions: (string * ProjectOptions)[]
LogOutput: string
}
Loading