-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.fsx
109 lines (85 loc) · 3.05 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
104
105
106
107
108
109
#I @"tools/FAKE/tools"
#r "FakeLib.dll"
open System
open System.IO
open System.Text
open Fake
open Fake.DotNetCli
open Fake.DocFxHelper
// Variables
let configuration = "Release"
// Directories
let output = __SOURCE_DIRECTORY__ @@ "build"
let outputTests = output @@ "tests"
let outputBinaries = output @@ "binaries"
let outputNuGet = output @@ "nuget"
Target "Clean" (fun _ ->
CleanDir output
CleanDir outputTests
CleanDir outputBinaries
CleanDir outputNuGet
CleanDirs !! "./**/bin"
CleanDirs !! "./**/obj"
)
Target "RestorePackages" (fun _ ->
DotNetCli.Restore
(fun p ->
{ p with
Project = "./Akka.Serialization.MessagePack.sln"
NoCache = false })
)
Target "Build" (fun _ ->
DotNetCli.Build
(fun p ->
{ p with
Project = "./Akka.Serialization.MessagePack.sln"
Configuration = configuration })
)
//--------------------------------------------------------------------------------
// Tests targets
//--------------------------------------------------------------------------------
Target "RunTests" (fun _ ->
let projects = !! "./**/*.Tests.csproj"
let runSingleProject project =
DotNetCli.RunCommand
(fun p ->
{ p with
WorkingDir = (Directory.GetParent project).FullName
TimeOut = TimeSpan.FromMinutes 10. })
(sprintf "xunit -parallel none -teamcity -xml %s_xunit.xml" (outputTests @@ fileNameWithoutExt project))
projects |> Seq.iter (runSingleProject)
)
//--------------------------------------------------------------------------------
// Nuget targets
//--------------------------------------------------------------------------------
Target "CreateNuget" (fun _ ->
let envBuildNumber = environVarOrDefault "APPVEYOR_BUILD_NUMBER" "0"
let branch = environVarOrDefault "APPVEYOR_REPO_BRANCH" ""
let versionSuffix = if branch.Equals("dev") then (sprintf "beta-%s" envBuildNumber) else ""
let projects = !! "./**/Akka.Serialization.MessagePack.csproj"
let runSingleProject project =
DotNetCli.Pack
(fun p ->
{ p with
Project = project
Configuration = configuration
AdditionalArgs = ["--include-symbols"]
VersionSuffix = versionSuffix
OutputPath = outputNuGet })
projects |> Seq.iter (runSingleProject)
)
//--------------------------------------------------------------------------------
// Target dependencies
//--------------------------------------------------------------------------------
Target "BuildRelease" DoNothing
Target "All" DoNothing
Target "Nuget" DoNothing
// build dependencies
"Clean" ==> "RestorePackages" ==> "Build" ==> "BuildRelease"
// tests dependencies
"Clean" ==> "RestorePackages" ==> "RunTests"
// nuget dependencies
"Clean" ==> "RestorePackages" ==> "Build" ==> "CreateNuget"
// all
"BuildRelease" ==> "All"
RunTargetOrDefault "Help"