-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.fsx
154 lines (125 loc) · 4.1 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
#I "./packages/FAKE.1.64.6/tools"
#r "FakeLib.dll"
open Fake
open System.IO
// properties
let projectName = "Frack"
let version = if isLocalBuild then "0.1." + System.DateTime.UtcNow.ToString("yMMdd") else buildVersion
let projectSummary = "Frack is a F# based socket implementation for high-speed, high-throughput applications."
let projectDescription = "Frack is an F# based socket implementation for high-speed, high-throughput applications. It is built on top of SocketAsyncEventArgs, which minimises the memory fragmentation common in the IAsyncResult pattern."
let authors = ["Dave Thomas";"Ryan Riley"]
let mail = "[email protected]"
let homepage = "http://github.com/panesofglass/frack"
let license = "http://github.com/panesofglass/frack/raw/master/LICENSE.txt"
// directories
let buildDir = "./build/"
let packagesDir = "./packages/"
let testDir = "./test/"
let deployDir = "./deploy/"
let docsDir = "./docs/"
let targetPlatformDir = getTargetPlatformDir "4.0.30319"
let nugetDir = "./nuget/"
let nugetLibDir = nugetDir @@ "lib/net40"
let nugetDocsDir = nugetDir @@ "docs"
let fsharpxVersion = GetPackageVersion packagesDir "FSharpx.Core"
// 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 _ ->
AssemblyInfo (fun p ->
{p with
CodeLanguage = FSharp
AssemblyVersion = version
AssemblyTitle = projectSummary
AssemblyDescription = projectDescription
Guid = "020697d7-24a3-4ce4-a326-d2c7c204ffde"
OutputFileName = "./src/Frack/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 + "*.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 + "Frack.dll"
buildDir + "Frack.pdb" ]
|> CopyTo nugetLibDir
NuGet (fun p ->
{p with
Authors = authors
Project = projectName
Description = projectDescription
Version = version
OutputPath = nugetDir
Dependencies = ["FSharpx.Core",RequireExactly fsharpxVersion]
AccessKey = getBuildParamOrDefault "nugetkey" ""
ToolPath = nugetPath
Publish = hasBuildParam "nugetKey" })
"frack.nuspec"
[nugetDir + sprintf "Frack.%s.nupkg" version]
|> CopyTo deployDir
)
Target "Deploy" (fun _ ->
!+ (buildDir + "/**/*.*")
-- "*.zip"
|> Scan
|> Zip buildDir (deployDir + sprintf "%s-%s.zip" projectName version)
)
Target "All" DoNothing
// Build order
"Clean"
==> "BuildApp" <=> "CopyLicense"
// ==> "GenerateDocumentation"
// ==> "ZipDocumentation"
==> "BuildNuGet"
==> "Deploy"
"All" <== ["Deploy"]
// Start build
Run target