Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/content/project.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ of `InteractiveChecker`:
*)
// Reference F# compiler API
#r "FSharp.Compiler.Service.dll"
#r "FSharp.Compiler.Service.ProjectCracker.dll"

open System
open System.Collections.Generic
Expand Down Expand Up @@ -316,7 +317,7 @@ for any project that builds cleanly using the command line tools 'xbuild' or 'ms

let projectFile = __SOURCE_DIRECTORY__ + @"/../../src/fsharp/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj"

checker.GetProjectOptionsFromProjectFile(projectFile)
ProjectCracker.GetProjectOptionsFromProjectFile(projectFile)


(**
Expand All @@ -325,7 +326,7 @@ You can also request RELEASE mode and set other build configuration parameters:

*)

checker.GetProjectOptionsFromProjectFile(projectFile, [("Configuration", "Release")])
ProjectCracker.GetProjectOptionsFromProjectFile(projectFile, [("Configuration", "Release")])

(**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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 false
let enableLogging = defaultArg enableLogging true
let logMap = ref Map.empty

let rec convert (opts: FSharp.Compiler.Service.ProjectCracker.Exe.ProjectOptions) : FSharpProjectOptions =
Expand Down Expand Up @@ -50,4 +50,8 @@ type ProjectCracker =
convert opts, !logMap

static member GetProjectOptionsFromProjectFile(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp) =
fst (ProjectCracker.GetProjectOptionsFromProjectFileLogged(projectFileName, ?properties=properties, ?loadedTimeStamp=loadedTimeStamp))
fst (ProjectCracker.GetProjectOptionsFromProjectFileLogged(
projectFileName,
?properties=properties,
?loadedTimeStamp=loadedTimeStamp,
enableLogging=false))
5 changes: 3 additions & 2 deletions tests/service/ExprTests.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#if INTERACTIVE
#r "../../bin/v4.5/FSharp.Compiler.Service.dll"
#r "../../bin/v4.5/FSharp.Compiler.Service.ProjectCracker.dll"
#r "../../packages/NUnit/lib/nunit.framework.dll"
#load "FsUnit.fs"
#load "Common.fs"
Expand Down Expand Up @@ -679,7 +680,7 @@ let ``Test expressions of declarations stress big expressions`` () =
let ``Test Declarations selfhost`` () =
let projectFile = __SOURCE_DIRECTORY__ + @"/FSharp.Compiler.Service.Tests.fsproj"
// Check with Configuration = Release
let options = checker.GetProjectOptionsFromProjectFile(projectFile, [("Configuration", "Debug")])
let options = ProjectCracker.GetProjectOptionsFromProjectFile(projectFile, [("Configuration", "Debug")])
let wholeProjectResults = checker.ParseAndCheckProject(options) |> Async.RunSynchronously

wholeProjectResults.Errors.Length |> shouldEqual 0
Expand Down Expand Up @@ -736,7 +737,7 @@ let ``Test Declarations selfhost FSharp.Core`` () =
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ + @"/../../../fsharp/src/fsharp/FSharp.Core"
let projectFile = __SOURCE_DIRECTORY__ + @"/../../../fsharp/src/fsharp/FSharp.Core/FSharp.Core.fsproj"

let options = checker.GetProjectOptionsFromProjectFile(projectFile, [("Configuration", "Debug")])
let options = ProjectCracker.GetProjectOptionsFromProjectFile(projectFile, [("Configuration", "Debug")])

let wholeProjectResults = checker.ParseAndCheckProject(options) |> Async.RunSynchronously

Expand Down
2 changes: 1 addition & 1 deletion tests/service/ProjectOptionsTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ let ``Project file parsing -- compile files 2``() =
[<Test>]
let ``Project file parsing -- bad project file``() =
let f = normalizePath (__SOURCE_DIRECTORY__ + @"/data/Malformed.fsproj")
let log = snd (ProjectCracker.GetProjectOptionsFromProjectFileLogged(f, enableLogging=true))
let log = snd (ProjectCracker.GetProjectOptionsFromProjectFileLogged(f))
log.[f] |> should contain "Microsoft.Build.Exceptions.InvalidProjectFileException"

[<Test>]
Expand Down