forked from fsprojects/FSharp.Control.Reactive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
161 lines (131 loc) · 4.33 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#I "./packages/FAKE.1.64.6/tools"
#r "FakeLib.dll"
open Fake
(* properties *)
let projectName = "FSharp.Reactive"
let version = if isLocalBuild then "2.0." + System.DateTime.UtcNow.ToString("yMMdd") else buildVersion
let projectSummary = "A F#-friendly wrapper for the Reactive Extensions."
let projectDescription = "A F#-friendly wrapper for the Reactive Extensions."
let authors = ["Ryan Riley"; "Steffen Forkmann"]
let mail = "[email protected]"
let homepage = "https://github.com/panesofglass/FSharp.Reactive"
(* Directories *)
let buildDir = "./build/"
let packagesDir = "./packages/"
let docsDir = "./docs/"
let deployDir = "./deploy/"
let testDir = "./test/"
let targetPlatformDir = getTargetPlatformDir "4.0.30319"
let nugetDir = "./nuget/"
let nugetLibDir = nugetDir @@ "lib/net40"
let nugetDocsDir = nugetDir @@ "docs"
let rxVersion = GetPackageVersion packagesDir "Rx-Main"
(* Params *)
let target = getBuildParamOrDefault "target" "All"
(* Tools *)
let fakePath = "./packages/FAKE.1.64.6/tools"
let nugetPath = "./.nuget/nuget.exe"
let nunitPath = "./packages/NUnit.Runners.2.6.0.12051/tools"
(* files *)
let appReferences =
!+ "src/**/*.fsproj"
|> Scan
let testReferences =
!+ "tests/**/*.fsproj"
|> Scan
let filesToZip =
!+ (buildDir + "/**/*.*")
-- "*.zip"
|> Scan
(* Targets *)
Target "Clean" (fun _ ->
CleanDirs [buildDir; testDir; deployDir; docsDir]
)
Target "BuildApp" (fun _ ->
if isLocalBuild then
Git.Submodule.init "" ""
AssemblyInfo (fun p ->
{p with
CodeLanguage = FSharp
AssemblyVersion = version
AssemblyTitle = projectName
AssemblyDescription = projectDescription
Guid = "ED23F688-C0D0-4102-93D5-0D832633F66D"
OutputFileName = "./src/AssemblyInfo.fs"})
MSBuildRelease buildDir "Build" appReferences
|> Log "AppBuild-Output: "
)
Target "BuildTest" (fun _ ->
MSBuildDebug testDir "Build" testReferences
|> Log "TestBuild-Output: "
)
Target "Test" (fun _ ->
!+ (testDir + "/*.Tests.dll")
|> Scan
|> NUnit (fun p ->
{p with
ToolPath = nunitPath;
DisableShadowCopy = true;
OutputFile = testDir + "TestResults.xml" })
)
Target "GenerateDocumentation" (fun _ ->
!+ (buildDir + "FSharp.Reactive.dll")
|> Scan
|> Docu (fun p ->
{p with
ToolPath = fakePath + "/docu.exe"
TemplatesPath = "./lib/templates"
OutputPath = docsDir })
)
Target "CopyLicense" (fun _ ->
[ "LICENSE.txt" ] |> CopyTo buildDir
)
Target "ZipDocumentation" (fun _ ->
!+ (docsDir + "/**/*.*")
|> Scan
|> Zip docsDir (deployDir + sprintf "Documentation-%s.zip" version)
)
Target "BuildNuGet" (fun _ ->
CleanDirs [nugetDir; nugetLibDir; nugetDocsDir]
XCopy (docsDir |> FullName) nugetDocsDir
[ buildDir + "FSharp.Reactive.dll"
buildDir + "FSharp.Reactive.pdb"
buildDir + "System.Reactive.Core.dll"
buildDir + "System.Reactive.Interfaces.dll"
buildDir + "System.Reactive.Linq.dll" ]
|> CopyTo nugetLibDir
NuGet (fun p ->
{p with
Authors = authors
Project = projectName
Description = projectDescription
Version = version
OutputPath = nugetDir
Dependencies = ["Rx-Linq", RequireExactly rxVersion]
AccessKey = getBuildParamOrDefault "nugetkey" ""
ToolPath = nugetPath
Publish = hasBuildParam "nugetkey" })
"FSharp.Reactive.nuspec"
[nugetDir + sprintf "FSharp.Reactive.%s.nupkg" version]
|> CopyTo deployDir
)
Target "DeployZip" (fun _ ->
!! (buildDir + "/**/*.*")
|> Zip buildDir (deployDir + sprintf "%s-%s.zip" projectName version)
)
FinalTarget "CloseTestRunner" (fun _ ->
ProcessHelper.killProcess "nunit-agent.exe"
)
Target "Deploy" DoNothing
Target "All" DoNothing
(* Build Order *)
"Clean"
==> "BuildApp" <=> "BuildTest" <=> "CopyLicense"
==> "Test" <=> "GenerateDocumentation"
==> "ZipDocumentation"
==> "BuildNuGet"
==> "DeployZip"
==> "Deploy"
"All" <== ["Deploy"]
// start build
Run target