Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General FAKE improvements #1088

Merged
merged 15 commits into from
Jan 20, 2016
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ release.cmd
Samples/typescript/out/
help/RELEASE_NOTES.md
paket.exe
paket-files/

# Ignore the Vagrant local directories
.vagrant/*
Expand Down
52 changes: 51 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down Expand Up @@ -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
Expand All @@ -296,6 +345,7 @@ Target "Default" DoNothing
==> "BuildSolution"
//==> "ILRepack"
==> "Test"
==> "Bootstrap"
==> "Default"
==> "CopyLicense"
=?> ("GenerateDocs", isLocalBuild && not isLinux)
Expand Down
2 changes: 2 additions & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/app/FAKE/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @>
Expand Down Expand Up @@ -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
Loading