-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.fsx
137 lines (116 loc) · 3.86 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
#if BOOT
open Fake
module FB = Fake.Boot
FB.Prepare {
FB.Config.Default __SOURCE_DIRECTORY__ with
NuGetDependencies =
let (!!) x = FB.NuGetDependency.Create x
[
!!"FAKE"
!!"NuGet.Build"
!!"NuGet.Core"
!!"NUnit.Runners"
]
}
#endif
#load ".build/boot.fsx"
open System.IO
open Fake
open Fake.AssemblyInfoFile
open Fake.MSBuild
// properties
let projectName = "Fracture"
let version = if isLocalBuild then "0.9." + System.DateTime.UtcNow.ToString("yMMdd") else buildVersion
let projectSummary = "Fracture is an F# based socket implementation for high-speed, high-throughput applications."
let projectDescription = "Fracture 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/fractureio/fracture"
let license = "http://github.com/fractureio/fracture/raw/master/LICENSE.txt"
// directories
let buildDir = __SOURCE_DIRECTORY__ @@ "build"
let deployDir = __SOURCE_DIRECTORY__ @@ "deploy"
let packagesDir = __SOURCE_DIRECTORY__ @@ "packages"
let testDir = __SOURCE_DIRECTORY__ @@ "test"
let nugetDir = __SOURCE_DIRECTORY__ @@ "nuget"
let nugetLib = nugetDir @@ "lib/net40"
let template = __SOURCE_DIRECTORY__ @@ "template.html"
let sources = __SOURCE_DIRECTORY__ @@ "src"
let docsDir = __SOURCE_DIRECTORY__ @@ "docs"
let docRoot = getBuildParamOrDefault "docroot" homepage
// tools
let nugetPath = "./.nuget/nuget.exe"
let nunitPath = "./packages/NUnit.Runners.2.6.2/tools"
// files
let appReferences =
!! "src/**/*.fsproj"
let testReferences =
!! "tests/**/*.fsproj"
// targets
Target "Clean" (fun _ ->
CleanDirs [buildDir
docsDir
testDir
deployDir
nugetDir
nugetLib]
)
Target "BuildApp" (fun _ ->
if not isLocalBuild then
[ Attribute.Version(buildVersion)
Attribute.Title(projectName)
Attribute.Description(projectDescription)
Attribute.Guid("020697d7-24a3-4ce4-a326-d2c7c204ffde")
]
|> CreateFSharpAssemblyInfo "src/fracture/AssemblyInfo.fs"
MSBuildRelease buildDir "Build" appReferences
|> Log "AppBuild-Output: "
)
Target "BuildTest" (fun _ ->
MSBuildDebug testDir "Build" testReferences
|> Log "TestBuild-Output: "
)
Target "Test" (fun _ ->
let nunitOutput = testDir @@ "TestResults.xml"
!! (testDir @@ "*.Tests.dll")
|> NUnit (fun p ->
{p with
ToolPath = nunitPath
DisableShadowCopy = true
OutputFile = nunitOutput })
)
Target "CopyLicense" (fun _ ->
[ "LICENSE.txt" ] |> CopyTo buildDir
)
Target "CreateNuGet" (fun _ ->
[ buildDir @@ "Fracture.dll"
buildDir @@ "Fracture.pdb" ]
|> CopyTo nugetLib
NuGet (fun p ->
{p with
Authors = authors
Project = projectName
Description = projectDescription
Version = version
OutputPath = nugetDir
ToolPath = nugetPath
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetKey" })
"fracture.nuspec"
!! (nugetDir @@ sprintf "Fracture.%s.nupkg" version)
|> CopyTo deployDir
)
FinalTarget "CloseTestRunner" (fun _ ->
ProcessHelper.killProcess "nunit-agent.exe"
)
Target "Deploy" DoNothing
Target "Default" DoNothing
// Build order
"Clean"
==> "BuildApp" <=> "BuildTest" <=> "CopyLicense"
==> "Test"
==> "CreateNuGet"
==> "Deploy"
"Default" <== ["Deploy"]
// Start build
RunTargetOrDefault "Default"