diff --git a/.gitignore b/.gitignore index 5faae9b128d..e8b537fc9ca 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ release.cmd Samples/typescript/out/ help/RELEASE_NOTES.md paket.exe +paket-files/ # Ignore the Vagrant local directories .vagrant/* diff --git a/build.fsx b/build.fsx index bf35c08ce0b..c3d7af27253 100644 --- a/build.fsx +++ b/build.fsx @@ -149,6 +149,44 @@ Target "Test" (fun _ -> |> xUnit id ) +Target "Bootstrap" (fun _ -> + let buildScript = "build.fsx" + let testScript = "testbuild.fsx" + // Check if we can build ourself with the new binaries. + let test clearCache script = + let clear () = + // Will make sure the test call actually compiles the script. + // Note: We cannot just clean .fake here as it might be locked by the currently executing code :) + if Directory.Exists ".fake" then + Directory.EnumerateFiles(".fake") + |> Seq.filter (fun s -> (Path.GetFileName s).StartsWith script) + |> Seq.iter File.Delete + let executeTarget target = + if clearCache then clear () + ExecProcess (fun info -> + info.FileName <- "build/FAKE.exe" + info.WorkingDirectory <- "." + info.Arguments <- sprintf "%s %s -pd" script target) (System.TimeSpan.FromMinutes 3.0) + + let result = executeTarget "PrintColors" + if result <> 0 then failwith "Bootstrapping failed" + + let result = executeTarget "FailFast" + if result = 0 then failwith "Bootstrapping failed" + + // Replace the include line to use the newly build FakeLib, otherwise things will be weird. + File.ReadAllText buildScript + |> fun s -> s.Replace("#I @\"packages/build/FAKE/tools/\"", "#I @\"build/\"") + |> fun text -> File.WriteAllText(testScript, text) + + try + // Will compile the script. + test true testScript + // Will use the compiled/cached version. + test false testScript + finally File.Delete(testScript) +) + Target "SourceLink" (fun _ -> !! "src/app/**/*.fsproj" |> Seq.iter (fun f -> @@ -287,7 +325,18 @@ Target "Release" (fun _ -> Branches.tag "" release.NugetVersion Branches.pushTag "" "origin" release.NugetVersion ) - +open System +Target "PrintColors" (fun s -> + let color (color: ConsoleColor) (code : unit -> _) = + let before = Console.ForegroundColor + try + Console.ForegroundColor <- color + code () + finally + Console.ForegroundColor <- before + color ConsoleColor.Magenta (fun _ -> printfn "TestMagenta") +) +Target "FailFast" (fun _ -> failwith "fail fast") Target "Default" DoNothing // Dependencies @@ -296,6 +345,7 @@ Target "Default" DoNothing ==> "BuildSolution" //==> "ILRepack" ==> "Test" + ==> "Bootstrap" ==> "Default" ==> "CopyLicense" =?> ("GenerateDocs", isLocalBuild && not isLinux) diff --git a/paket.dependencies b/paket.dependencies index c4220e83584..497d4b52e1d 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -38,6 +38,8 @@ nuget FluentMigrator.Runner nuget HashLib nuget FSharp.Compiler.Service +github matthid/Yaaf.FSharp.Scripting src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs + group Build content: none source http://nuget.org/api/v2 diff --git a/paket.lock b/paket.lock index 430dbf72bcb..34c0289a47f 100644 --- a/paket.lock +++ b/paket.lock @@ -81,7 +81,10 @@ 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 (48789eeb63382a6934966472e270e87880cb49ed) GROUP Build CONTENT: NONE NUGET diff --git a/src/app/FAKE/Program.fs b/src/app/FAKE/Program.fs index e93d1262128..1c5550d16f3 100644 --- a/src/app/FAKE/Program.fs +++ b/src/app/FAKE/Program.fs @@ -55,7 +55,9 @@ try | Choice1Of2(fakeArgs) -> //Break to allow a debugger to be attached here - if fakeArgs.Contains <@ Cli.Break @> then Diagnostics.Debugger.Break() + if fakeArgs.Contains <@ Cli.Break @> then + Diagnostics.Debugger.Launch() |> ignore + Diagnostics.Debugger.Break() |> ignore //Boot and version force us to ignore other args, so check for them and handle. let isBoot, bootArgs = fakeArgs.Contains <@ Cli.Boot @>, fakeArgs.GetResults <@ Cli.Boot @> @@ -162,3 +164,5 @@ try finally traceEndBuild() + if !TargetHelper.ExitCode.exitCode <> 0 then exit !TargetHelper.ExitCode.exitCode + if Environment.ExitCode <> 0 then exit Environment.ExitCode \ No newline at end of file diff --git a/src/app/FakeLib/FSIHelper.fs b/src/app/FakeLib/FSIHelper.fs index 9886f532f3a..507a044f5b3 100644 --- a/src/app/FakeLib/FSIHelper.fs +++ b/src/app/FakeLib/FSIHelper.fs @@ -9,6 +9,7 @@ open System.Diagnostics open System.Threading open System.Text.RegularExpressions open System.Xml.Linq +open Yaaf.FSharp.Scripting let private FSIPath = @".\tools\FSharp\;.\lib\FSharp\;[ProgramFilesX86]\Microsoft SDKs\F#\4.0\Framework\v4.0;[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\" @@ -203,59 +204,34 @@ type private AssemblySource = | Disk let hashRegex = Text.RegularExpressions.Regex("(?