-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
80 lines (64 loc) · 2.48 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
// --------------------------------------------------------------------------------------
// FAKE build script
// --------------------------------------------------------------------------------------
#r @"packages/FAKE.4.27.0/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 = "deploy.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";
"Tests/bin/Release";
"Tests/bin/Debug";
"Tests/bin/Debug"
]
)
Target "build" (fun _ ->
!! solutionFile
|> MSBuildReleaseExt "" [("Platform", "Any CPU")] "Rebuild"
|> ignore
)
Target "test" (fun _ ->
!! testAssemblies
|> NUnit (fun p ->
{ p with
DisableShadowCopy = true
TimeOut = TimeSpan.FromMinutes 20.
OutputFile = "TestResults.xml" })
)
// --------------------------------------------------------------------------------------
// Run all targets by default. Invoke 'build <Target>' to override
Target "all" DoNothing
"clean"
==> "build"
==> "CopyBinaries"
==> "test"
==> "all"
RunTargetOrDefault "test"