-
Notifications
You must be signed in to change notification settings - Fork 326
Expand file tree
/
Copy pathCore.fs
More file actions
71 lines (61 loc) · 2.05 KB
/
Copy pathCore.fs
File metadata and controls
71 lines (61 loc) · 2.05 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
module Build.Quicktest.Core
open Build.FableLibrary
open SimpleExec
open BlackFox.CommandLine
open Build.Utils
type RunMode =
| RunScript
| RunCommand of string
| NoRun
type QuicktestConfig =
{
Language: string
FableLibBuilder: BuildFableLibrary
ProjectDir: string
Extension: string
RunMode: RunMode
}
let genericQuicktest (config: QuicktestConfig) (args: string list) =
let forceFableLibrary = args |> List.contains "--force-fable-library"
let isWatch = args |> List.contains "--watch"
config.FableLibBuilder.Run(forceFableLibrary)
let appendRunMode (cmdLine: CmdLine) =
match config.RunMode with
| RunScript -> cmdLine |> CmdLine.appendRaw "--runScript"
| RunCommand command ->
cmdLine
// Use appendRaw to avoid quoting the command
|> CmdLine.appendRaw "--run"
|> CmdLine.appendRaw command
| NoRun -> cmdLine
let projectDir = Path.Resolve config.ProjectDir
Command.Fable(
CmdLine.empty
|> CmdLine.appendRaw "clean"
|> CmdLine.appendRaw projectDir
|> CmdLine.appendPrefix "--lang" config.Language
|> CmdLine.appendPrefix "--extension" config.Extension
|> CmdLine.appendRaw "--yes",
workingDirectory = projectDir
)
let fableArgs =
CmdLine.empty
|> CmdLine.appendRaw projectDir
|> CmdLine.appendPrefix "--lang" config.Language
|> CmdLine.appendPrefix "--extension" config.Extension
|> CmdLine.appendPrefix "--exclude" "Fable.Core"
|> CmdLine.appendRaw "--noCache"
|> (fun cmdLine ->
if isWatch then
cmdLine |> CmdLine.appendRaw "--watch"
else
cmdLine
)
|> CmdLine.appendRaw "--verbose"
|> appendRunMode
if isWatch then
Command.WatchFableAsync(fableArgs, workingDirectory = projectDir)
|> Async.AwaitTask
|> Async.RunSynchronously
else
Command.Fable(fableArgs, workingDirectory = projectDir)