-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.fsx
198 lines (170 loc) · 5.84 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#I "packages/FAKE/tools/"
#r "FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open System
let artifactsDir = "./artifacts/"
let testArtifactsDir = "./testartifacts/"
let packagingDir = "./packaging/"
let version = "0.4.1"
let testProjectFiles =
[ "./Hyperboliq.Tests/Hyperboliq.Tests.csproj"
"./Hyperboliq.Tests.FSharp/Hyperboliq.Tests.FSharp.fsproj"
"./Hyperboliq.Tests.Sqllite/Hyperboliq.Tests.Sqllite.csproj"
"./Hyperboliq.Tests.SqlServer/Hyperboliq.Tests.SqlServer.csproj"
]
let testAssemblies =
[ "Hyperboliq.Tests.dll"
"Hyperboliq.Tests.FSharp.dll"
] |> List.map (fun s -> testArtifactsDir + s)
let integrationTestAssemblies =
[
"Hyperboliq.Tests.Sqllite.dll"
"Hyperboliq.Tests.SqlServer.dll"
] |> List.map (fun s -> testArtifactsDir + s)
let createNugetPackage templateFile =
Paket.Pack (fun p ->
{ p with
TemplateFile = templateFile
Version = version
OutputPath = packagingDir
})
Target "clean" (fun _ ->
trace "Clean"
CleanDir artifactsDir
CleanDir packagingDir
)
Target "buildTests" (fun _ ->
testProjectFiles
|> MSBuildDebug testArtifactsDir "Build"
|> Log "TestBuild-Output: "
)
Target "runTests" (fun _ ->
trace "Run tests"
testAssemblies
|> NUnitSequential.NUnit (fun p ->
{ p with
StopOnError = true
ShowLabels = true
ToolPath = "./packages/NUnit.Runners.Net4/tools/"
})
environVarOrNone "BUILDENV"
|> function | Some("CI") -> None | x -> x
|> Option.iter (fun _ ->
integrationTestAssemblies
|> NUnitSequential.NUnit (fun p ->
{ p with
StopOnError = true
ShowLabels = true
ToolPath = "./packages/NUnit.Runners.Net4/tools/"
})
)
)
Target "buildSqlLite" (fun _ ->
trace "Building SqlLite adapter..."
CreateFSharpAssemblyInfo "./Hyperboliq.Sqllite/AssemblyInfo.fs"
[ Attribute.Title "Hyperboliq.SqlLite"
Attribute.Description "Hyperboliq.SqlLite- Hyperboliq adapter for SqlLite"
Attribute.Product "Hyperboliq.SqlLite"
Attribute.Copyright "Copyright 2015 Fredrik Forssen"
Attribute.Version version
Attribute.FileVersion version
]
MSBuildRelease "./Hyperboliq.SqlLite/bin/Release" "Build" [ "./Hyperboliq.SqlLite/Hyperboliq.SqlLite.fsproj" ]
|> Log "AppBuild-Output: "
)
Target "buildPostgres" (fun _ ->
trace "Building Postgres adapter..."
CreateFSharpAssemblyInfo "./Hyperboliq.Postgres/AssemblyInfo.fs"
[ Attribute.Title "Hyperboliq.PostgreSQL"
Attribute.Description "Hyperboliq.PostgreSQL - Hyperboliq adapter for PostgreSQL"
Attribute.Product "Hyperboliq.PostgreSQL"
Attribute.Copyright "Copyright 2015 Fredrik Forssen"
Attribute.Version version
Attribute.FileVersion version
]
MSBuildRelease "./Hyperboliq.Postgres/bin/Release" "Build" [ "./Hyperboliq.Postgres/Hyperboliq.Postgres.fsproj" ]
|> Log "AppBuild-Output: "
)
Target "buildSqlServer" (fun _ ->
trace "Building Sql Server adapter..."
CreateFSharpAssemblyInfo "./Hyperboliq.SqlServer/AssemblyInfo.fs"
[ Attribute.Title "Hyperboliq.SqlServer"
Attribute.Description "Hyperboliq.SqlServer - Hyperboliq adapter for SQL Server"
Attribute.Product "Hyperboliq.SqlServer"
Attribute.Copyright "Copyright 2015 Fredrik Forssen"
Attribute.Version version
Attribute.FileVersion version
]
MSBuildRelease "./Hyperboliq.SqlServer/bin/Release" "Build" [ "./Hyperboliq.SqlServer/Hyperboliq.SqlServer.fsproj" ]
|> Log "AppBuild-Output: "
)
Target "buildCore" (fun _ ->
trace "Build Release"
CreateFSharpAssemblyInfo "./Hyperboliq.Ansi/AssemblyInfo.fs"
[ Attribute.Title "Hyperboliq.Ansi"
Attribute.Description "Hyperboliq - Predictable SQL"
Attribute.Product "Hyperboliq"
Attribute.Copyright "Copyright 2015 Fredrik Forssen"
Attribute.Version version
Attribute.FileVersion version
]
CreateFSharpAssemblyInfo "./Hyperboliq/AssemblyInfo.fs"
[ Attribute.Title "Hyperboliq"
Attribute.Description "Hyperboliq - Predictable SQL"
Attribute.Product "Hyperboliq"
Attribute.Copyright "Copyright 2015 Fredrik Forssen"
Attribute.Version version
Attribute.FileVersion version
]
MSBuildRelease "./Hyperboliq/bin/Release" "Build" [ "./Hyperboliq/Hyperboliq.fsproj" ]
|> Log "AppBuild-Output: "
MSBuildRelease "./Hyperboliq.Ansi/bin/Release" "Build" [ "./Hyperboliq.Ansi/Hyperboliq.Ansi.fsproj" ]
|> Log "AppBuild-Output: "
)
Target "createSqlLitePackage" (fun _ ->
trace "Create SqlLite package..."
createNugetPackage "./Hyperboliq.Sqllite/paket.template"
)
Target "createPostgresPackage" (fun _ ->
trace "Create Postgres package..."
createNugetPackage "./Hyperboliq.Postgres/paket.template"
)
Target "createSqlServerPackage" (fun _ ->
trace "Create Sql Server package..."
createNugetPackage "./Hyperboliq.SqlServer/paket.template"
)
Target "createCorePackage" (fun _ ->
trace "Create Package"
createNugetPackage "./Hyperboliq.Ansi/paket.template"
)
Target "publishPackages" (fun _ ->
trace "Publish Package"
if hasBuildParam "publish" then
Paket.Push(fun p -> { p with WorkingDir = packagingDir })
else
trace "IMPORTANT!"
trace "To actually publish, add the build parameter \"publish\". Otherwise nothing will be published."
)
Target "createPackages" DoNothing
Target "default" DoNothing
"createCorePackage" ==> "createPackages"
"createSqlServerPackage" ==> "createPackages"
"createPostgresPackage" ==> "createPackages"
"createSqlLitePackage" ==> "createPackages"
"buildCore" ==> "createCorePackage"
"buildSqlServer" ==> "createSqlServerPackage"
"buildPostgres" ==> "createPostgresPackage"
"buildSqlLite" ==> "createSqlLitePackage"
"clean" ?=> "buildCore"
"clean" ?=> "buildSqlServer"
"clean" ?=> "buildPostgres"
"clean" ?=> "buildSqlLite"
"clean"
==> "buildTests"
==> "runTests"
==> "default"
"runTests"
==> "createPackages"
==> "publishPackages"
RunTargetOrDefault "default"