-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildTools.fs
33 lines (28 loc) · 1.13 KB
/
BuildTools.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
module BuildTools
open Fake.Core
open Fake.DotNet
module Tools =
let private findTool tool winTool =
let tool = if Environment.isUnix then tool else winTool
match ProcessUtils.tryFindFileOnPath tool with
| Some t -> t
| _ ->
let errorMsg =
tool + " was not found in path. " +
"Please install it and make sure it's available from your path. "
failwith errorMsg
let private runTool (cmd:string) args workingDir =
let arguments = args |> String.split ' ' |> Arguments.OfArgs
Command.RawCommand (cmd, arguments)
|> CreateProcess.fromCommand
|> CreateProcess.withWorkingDirectory workingDir
|> CreateProcess.ensureExitCode
|> Proc.run
|> ignore
let dotnet 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 femto = runTool "femto"
let node = runTool (findTool "node" "node.exe")
let yarn = runTool (findTool "yarn" "yarn.cmd")