-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
103 lines (81 loc) · 2.85 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// --------------------------------------------------------------------------------------
// FAKE build script
// --------------------------------------------------------------------------------------
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.Git
open Fake.AssemblyInfoFile
open Fake.ReleaseNotesHelper
open Fake.UserInputHelper
open System
open System.IO
// File system information
let solutionFile = "Pollock.sln"
// Pattern specifying assemblies to be tested using NUnit
let testAssemblies = "**/bin/Release/*Tests.dll"
// --------------------------------------------------------------------------------------
// END TODO: The rest of the file includes standard build steps
// --------------------------------------------------------------------------------------
// Helper active pattern for project types
let (|Fsproj|Csproj|Vbproj|) (projFileName:string) =
match projFileName with
| f when f.EndsWith("fsproj") -> Fsproj
| f when f.EndsWith("csproj") -> Csproj
| f when f.EndsWith("vbproj") -> Vbproj
| _ -> failwith (sprintf "Project file %s not supported. Unknown project type." projFileName)
// Copies binaries from default VS location to expected bin folder
// But keeps a subdirectory structure for each project in the
// src folder to support multiple project outputs
Target "CopyBinaries" (fun _ ->
!! "src/**/*.??proj"
|> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f) @@ "bin/Release", "bin" @@ (System.IO.Path.GetFileNameWithoutExtension f)))
|> Seq.iter (fun (fromDir, toDir) -> CopyDir toDir fromDir (fun _ -> true))
)
// --------------------------------------------------------------------------------------
// Clean build results
Target "clean" (fun _ ->
CleanDirs ["bin"; "temp";
"CSharp.Tests/bin/Release";
"CSharp.Tests/bin/Release";
"Tests/bin/Debug";
"Tests/bin/Debug"
]
)
Target "build" (fun _ ->
!! solutionFile
|> MSBuildRelease "" "Rebuild"
|> ignore
)
let isMono = Type.GetType ("Mono.Runtime") <> null
Target "test" (fun _ ->
!! testAssemblies
|> NUnit (fun p ->
{ p with
DisableShadowCopy = true
ExcludeCategory = if isMono then "not_mono" else ""
TimeOut = TimeSpan.FromMinutes 20.
OutputFile = "TestResults.xml" })
)
Target "pack" (fun _ ->
Paket.Pack(fun p ->
{ p with
OutputPath = "bin"})
)
Target "push" (fun _ ->
Paket.Push(fun p ->
{ p with
WorkingDir = "bin" })
)
// --------------------------------------------------------------------------------------
// Run all targets by default. Invoke 'build <Target>' to override
Target "all" DoNothing
"clean"
==> "pack"
"clean"
==> "build"
==> "CopyBinaries"
==> "test"
==> "all"
"pack"
==> "push"
RunTargetOrDefault "test"