Skip to content

Commit

Permalink
Revert "Merge pull request fsprojects#771 from matthid/simplify_fcs_i…
Browse files Browse the repository at this point in the history
…nteraction"

This reverts commit a3ab089, reversing
changes made to 5896e6d.
  • Loading branch information
forki committed Apr 27, 2015
1 parent 6cf0caf commit c77318d
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 32 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ release.cmd
Samples/typescript/out/
help/RELEASE_NOTES.md
paket.exe
paket-files/

# Ignore the Vagrant local directories
.vagrant/*
Expand Down
3 changes: 1 addition & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### 3.29.1 - 27.04.2015
#### 3.29.2 - 27.04.2015
* New file system change watcher - https://github.com/fsharp/FAKE/pull/766
* Paket push task runs in parallel - https://github.com/fsharp/FAKE/pull/768
* NuGet pack task treats non csproj files as nuspec files - https://github.com/fsharp/FAKE/pull/767
Expand All @@ -8,7 +8,6 @@
* Use Microsoft.AspNet.Razor 2.0.30506 for FAKE.Deploy - https://github.com/fsharp/FAKE/pull/756
* New build parameter functions
* Fix http://stackoverflow.com/questions/29572870/f-fake-unable-to-get-fake-to-merge-placeholder-arguments-in-nuspec-file
* Simplified FCS integration - https://github.com/fsharp/FAKE/pull/771
* New environment variable helpers

#### 3.28.0 - 09.04.2015
Expand Down
2 changes: 0 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,3 @@ nuget xunit.extensions
nuget Newtonsoft.Json
nuget Microsoft.AspNet.Razor 2.0.30506
nuget Microsoft.AspNet.WebPages 2.0.30506

github matthid/Yaaf.FSharp.Scripting src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs
4 changes: 0 additions & 4 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,3 @@ NUGET
xunit.extensions (1.9.2)
xunit (1.9.2)
xunit.runners (1.9.2)
GITHUB
remote: matthid/Yaaf.FSharp.Scripting
specs:
src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs (253b322f7da2922c01685a02db45b3f3923d627e)
56 changes: 38 additions & 18 deletions src/app/FakeLib/FSIHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ open System
open System.IO
open System.Diagnostics
open System.Threading
open Yaaf.FSharp.Scripting

let private FSIPath = @".\tools\FSharp\;.\lib\FSharp\;[ProgramFilesX86]\Microsoft SDKs\F#\3.1\Framework\v4.0;[ProgramFilesX86]\Microsoft SDKs\F#\3.0\Framework\v4.0;[ProgramFiles]\Microsoft F#\v4.0\;[ProgramFilesX86]\Microsoft F#\v4.0\;[ProgramFiles]\FSharp-2.0.0.0\bin\;[ProgramFilesX86]\FSharp-2.0.0.0\bin\;[ProgramFiles]\FSharp-1.9.9.9\bin\;[ProgramFilesX86]\FSharp-1.9.9.9\bin\"

Expand Down Expand Up @@ -86,6 +85,8 @@ let executeFSIWithScriptArgsAndReturnMessages script (scriptArgs: string[]) =
Thread.Sleep 1000
(result, messages)

open Microsoft.FSharp.Compiler.Interactive.Shell

/// Run the given FAKE script with fsi.exe at the given working directory. Provides full access to Fsi options and args. Redirect output and error messages.
let internal runFAKEScriptWithFsiArgsAndRedirectMessages printDetails (FsiArgs(fsiOptions, script, scriptArgs)) args onErrMsg onOutMsg =
if printDetails then traceFAKE "Running Buildscript: %s" script
Expand All @@ -97,24 +98,43 @@ let internal runFAKEScriptWithFsiArgsAndRedirectMessages printDetails (FsiArgs(f
// Create an env var that only contains the build script args part from the --fsiargs (or "").
Environment.SetEnvironmentVariable("fsiargs-buildscriptargs", String.Join(" ", scriptArgs))

let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration()

let commonOptions =
(FsiOptions.Default.AsArgs |> Array.toList) @ fsiOptions
|> FsiOptions.ofArgs

let session =
try ScriptHost.Create
(commonOptions, preventStdOut = true,
outWriter = ScriptHost.CreateForwardWriter onOutMsg,
errWriter = ScriptHost.CreateForwardWriter onErrMsg)
with :? FsiEvaluationException as e ->
traceError "FsiEvaluationSession could not be created."
traceError e.Result.Error.Merged
reraise ()

try session.EvalScript script
true
with :? FsiEvaluationException as eval ->
false
[ "fsi.exe"; "--noninteractive" ] @ fsiOptions
|> List.toArray

let sbOut = Text.StringBuilder()
let sbErr = Text.StringBuilder()
let handleMessages() =
let handleMessagesFrom (sb:Text.StringBuilder) onMsg =
let s = sb.ToString()
if not <| String.IsNullOrEmpty s
then onMsg s
handleMessagesFrom sbOut onOutMsg
handleMessagesFrom sbErr onErrMsg

use outStream = new StringWriter(sbOut)
use errStream = new StringWriter(sbErr)
use stdin = new StreamReader(Stream.Null)

try
let session = FsiEvaluationSession.Create(fsiConfig, commonOptions, stdin, outStream, errStream)

try
session.EvalScript script
// TODO: Reactivate when FCS don't show output any more
// handleMessages()
true
with
| _ ->
handleMessages()
false
with
| exn ->
traceError "FsiEvaluationSession could not be created."
traceError <| sbErr.ToString()
raise exn

/// Run the given buildscript with fsi.exe and allows for extra arguments to the script. Returns output.
let executeBuildScriptWithArgsAndReturnMessages script (scriptArgs: string[]) =
Expand Down
4 changes: 0 additions & 4 deletions src/app/FakeLib/FakeLib.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
<DocumentationFile>..\..\..\build\FakeLib.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\paket-files\matthid\Yaaf.FSharp.Scripting\src\source\Yaaf.FSharp.Scripting\YaafFSharpScripting.fs">
<Paket>True</Paket>
<Link>paket-files/YaafFSharpScripting.fs</Link>
</Compile>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="CSharpHelper.fs" />
<Compile Include="EnvironmentHelper.fs" />
Expand Down
1 change: 0 additions & 1 deletion src/app/FakeLib/paket.references
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
File: YaafFSharpScripting.fs
FSharp.Core
FSharp.Compiler.Service
Mono.Web.Xdt
Expand Down

0 comments on commit c77318d

Please sign in to comment.