-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
81 lines (64 loc) · 2.46 KB
/
build.fsx
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
72
73
74
75
76
77
78
79
80
81
// --------------------------------------------------------------------------------------
// FAKE build script
// --------------------------------------------------------------------------------------
#r "./packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.Testing.Expecto
// --------------------------------------------------------------------------------------
// Build variables
// --------------------------------------------------------------------------------------
let buildDir = "./build/"
let appReferences = !! "/**/*.fsproj"
let testsReferences = "/**/bin/**/*ests.exe"
// --------------------------------------------------------------------------------------
// Helpers
// --------------------------------------------------------------------------------------
let paketRestore mbGroup =
let parameters = Paket.PaketRestoreDefaults()
use __ = traceStartTaskUsing "PaketRestore" parameters.WorkingDir
let restoreGroupArg =
match mbGroup with
| Some group -> sprintf "restore --group %s" group
| None -> "restore"
let restoreResult =
ExecProcess (fun info ->
info.FileName <- parameters.ToolPath
info.WorkingDirectory <- parameters.WorkingDir
info.Arguments <- restoreGroupArg ) parameters.TimeOut
if restoreResult <> 0 then failwithf "Error during restore %s." parameters.WorkingDir
let targetBuild _ =
MSBuildRelease "" "Build" appReferences
|> Log "AppBuild-Output: "
let targetTests _ =
!! testsReferences
|> Expecto (fun p ->
{ p with
Debug = false
Parallel = true
ListTests = false
Summary = false
FailOnFocusedTests = false
})
// --------------------------------------------------------------------------------------
// Targets
// --------------------------------------------------------------------------------------
Target "Clean" (fun _ ->
CleanDirs [buildDir]
)
Target "Restore" (fun _ ->
paketRestore None
)
Target "BuildWithoutRestore" targetBuild
Target "Build" targetBuild
Target "Tests" targetTests
Target "TestsWithoutRestore" targetTests
// --------------------------------------------------------------------------------------
// Build order
// --------------------------------------------------------------------------------------
"Clean"
==> "Restore"
==> "Build"
==> "Tests"
"BuildWithoutRestore"
==> "TestsWithoutRestore"
RunTargetOrDefault "TestsWithoutRestore"