-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathHelpers.fs
34 lines (26 loc) · 918 Bytes
/
Helpers.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Helpers
open BlackFox.Fake
open Fake.Core
open Fake.DotNet
let initializeContext () =
let execContext =
Context.FakeExecutionContext.Create false "build.fsx" []
Context.setExecutionContext (Context.RuntimeContext.Fake execContext)
/// Executes a dotnet command in the given working directory
let runDotNet cmd workingDir =
let result =
DotNet.exec (DotNet.Options.withWorkingDirectory workingDir) cmd ""
if result.ExitCode <> 0 then
failwithf "'dotnet %s' failed in %s" cmd workingDir
let runOrDefault defaultTarget args =
Trace.trace (sprintf "%A" args)
try
match args with
| [| target |] -> Target.runOrDefault target
| arr when args.Length > 1 -> Target.run 0 (Array.head arr) (Array.tail arr |> List.ofArray)
| _ -> BuildTask.runOrDefault defaultTarget
0
with
| e ->
printfn "%A" e
1