-
Notifications
You must be signed in to change notification settings - Fork 80
/
build.fsx
272 lines (213 loc) · 7.73 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open System
open System.IO
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
let mainBuildDir = "build/main/bin/"
let mainPackageDir = "build/main/deploy/"
let dataBuildDir = "build/data/bin/"
let dataPackageDir = "build/data/deploy/"
let typescriptBuildDir = "build/typescript/bin/"
let typescriptPackageDir = "build/typescript/deploy/"
let rxBuildDir = "build/rx/bin/"
let rxPackageDir = "build/rx/deploy/"
let testBuildDir = "build/tests/"
let dependenciesDir = "src/packages/"
let versionNumber =
match buildServer with
| TeamCity -> buildVersion
| _ -> "0.0.0"
Target "Clean-Main" (fun _ ->
CleanDirs [mainBuildDir; mainPackageDir]
)
Target "Clean-Data" (fun _ ->
CleanDirs [dataBuildDir; dataPackageDir]
)
Target "Clean-TypeScript" (fun _ ->
CleanDirs [typescriptBuildDir; typescriptPackageDir]
)
Target "Clean-Rx" (fun _ ->
CleanDirs [rxBuildDir; rxPackageDir]
)
Target "Clean-Test" (fun _ ->
CleanDirs [testBuildDir]
)
let baseAttributes = [
Attribute.Product "FunScript"
Attribute.Company "Type Inferred Ltd."
Attribute.Copyright "Copyright © 2012-2014 Type Inferred Ltd."
Attribute.Version versionNumber
Attribute.FileVersion versionNumber
]
Target "Build-Main" (fun _ ->
CreateFSharpAssemblyInfo "src/main/FunScript/AssemblyInfo.fs"
[
yield Attribute.Title "TypeInferred.FunScript"
yield Attribute.Description "An F# to JavaScript Compiler - FunScript"
yield Attribute.Guid "ABBDBFC5-F6F0-4BB7-89D8-9FE9D105C613"
yield! baseAttributes
]
CreateFSharpAssemblyInfo "src/main/FunScript.Interop/AssemblyInfo.fs"
[
yield Attribute.Title "TypeInferred.FunScript.Interop"
yield Attribute.Description "FFI Interop Attributes - FunScript"
yield Attribute.Guid "9A9600A3-CCCD-4DD1-A52A-EA66E0FC2A54"
yield! baseAttributes
]
let projectFiles = !! "src/main/**/*.fsproj"
Log "Build-Main-Projects: " projectFiles
MSBuildRelease mainBuildDir "Build" projectFiles
|> Log "Build-Main-Output: "
)
Target "Build-Data" (fun _ ->
// RestorePackages()
// CopyDir dependenciesDir "./packages/" (fun _ -> true)
CreateFSharpAssemblyInfo "src/data/FunScript.Data/AssemblyInfo.fs"
[
yield Attribute.Title "TypeInferred.FunScript.Data"
yield Attribute.Description "FSharp.Data Interop Library - FunScript"
yield Attribute.Guid "38933DD8-EF70-4861-A6CB-E2EA0C4CAE73"
yield! baseAttributes
]
let projectFiles = !! "src/data/**/*.fsproj"
Log "Build-Data-Projects: " projectFiles
MSBuildRelease dataBuildDir "Build" projectFiles
|> Log "Build-Data-Output: "
)
Target "Build-TypeScript" (fun _ ->
// RestorePackages()
// CopyDir dependenciesDir "./packages/" (fun _ -> true)
CreateFSharpAssemblyInfo "src/extra/FunScript.TypeScript/AssemblyInfo.fs"
[
yield Attribute.Title "TypeInferred.FunScript.TypeScript"
yield Attribute.Description "TypeScript Interop Library - FunScript"
yield Attribute.Guid "891C8111-4D9D-45CD-8A8D-77EB817FF8E1"
yield! baseAttributes
]
let projectFiles = !! "src/extra/FunScript.TypeScript/*.fsproj"
Log "Build-TypeScript-Projects: " projectFiles
MSBuildRelease typescriptBuildDir "Build" projectFiles
|> Log "Build-TypeScript-Output: "
)
Target "Build-Rx" (fun _ ->
// RestorePackages()
// CopyDir dependenciesDir "./packages/" (fun _ -> true)
CreateFSharpAssemblyInfo "src/extra/FunScript.Rx/AssemblyInfo.fs"
[
yield Attribute.Title "TypeInferred.FunScript.Rx"
yield Attribute.Description "Rx Interop Library - FunScript"
yield Attribute.Guid "891C8111-4D9D-45CD-8A8D-77EB817FF8E1"
yield! baseAttributes
]
let projectFiles = !! "src/extra/FunScript.Rx/*.fsproj"
Log "Build-Rx-Projects: " projectFiles
MSBuildRelease rxBuildDir "Build" projectFiles
|> Log "Build-Rx-Output: "
)
Target "Build-Test" (fun _ ->
let projectFiles = !! "tests/**/*.fsproj"
Log "Build-Test-Projects: " projectFiles
MSBuildDebug testBuildDir "Build" projectFiles
|> Log "Build-Test-Output: "
)
Target "Run-Test" (fun _ ->
let targetDlls = !! (testBuildDir + "*.Tests.dll")
//let projectFiles = !! "tests/**/*.fsproj"
Log "Run-Test-Dlls: " targetDlls
// Log "Run-Test-Dlls: " projectFiles
targetDlls |> NUnit (fun p ->
//projectFiles |> NUnit (fun p ->
{ p with
Framework = "4.5"
//DisableShadowCopy = true
// TimeOut = TimeSpan.FromMinutes 20.
OutputFile = "TestResult.xml"
})
)
Target "Create-Package-Main" (fun _ ->
let hasNugetKey = hasBuildParam "nuget_key"
tracefn "Publish-Package-Main: %b" hasNugetKey
NuGet(fun p ->
{p with
Authors = ["Zach Bray"; "Tomas Petricek"]
Project = "FunScript"
Summary = "An F# to JavaScript compiler."
Description = "An F# to JavaScript compiler."
Copyright = "Copyright © 2012-2014 Type Inferred Ltd."
WorkingDir = mainBuildDir
OutputPath = mainPackageDir
Version = versionNumber
AccessKey = getBuildParamOrDefault "nuget_key" ""
Publish = hasNugetKey
}) "build/template.nuspec"
)
Target "Create-Package-Data" (fun _ ->
let hasNugetKey = hasBuildParam "nuget_key"
tracefn "Publish-Package-Main: %b" hasNugetKey
NuGet(fun p ->
{p with
Authors = ["Tomas Petricek"]
Project = "FunScript.Data"
Summary = "FSharp.Data Type Providers Interop for FunScript."
Description = "FSharp.Data Type Providers Interop for FunScript."
Copyright = "Copyright © 2012-2014 Type Inferred Ltd."
WorkingDir = dataBuildDir
OutputPath = dataPackageDir
Version = versionNumber
AccessKey = getBuildParamOrDefault "nuget_key" ""
Publish = hasNugetKey
Dependencies =
[
"FunScript", sprintf "[%s]" versionNumber
"FSharp.Data", "[2.0.9]"
"ApiaryProvider", "[1.0.2]"
]
}) "build/data-template.nuspec"
)
Target "Create-Package-Rx" (fun _ ->
let hasNugetKey = hasBuildParam "nuget_key"
tracefn "Publish-Package-Rx: %b" hasNugetKey
NuGet(fun p ->
{p with
Authors = ["Zach Bray"]
Project = "FunScript.Rx"
Summary = "Rx interop. for FunScript."
Description = "Rx interop. for FunScript."
Copyright = "Copyright © 2012-2014 Type Inferred Ltd."
WorkingDir = rxBuildDir
OutputPath = rxPackageDir
Version = versionNumber
AccessKey = getBuildParamOrDefault "nuget_key" ""
Publish = hasNugetKey
Dependencies =
[
"FunScript", sprintf "[%s]" versionNumber
"FSharp.Control.Reactive", "[2.4.0]"
]
}) "build/rx-template.nuspec"
)
Target "Release" DoNothing
"Clean-Main"
==> "Build-Main"
==> "Create-Package-Main"
==> "Release"
"Build-Main"
==> "Build-Data"
==> "Build-TypeScript"
==> "Build-Rx"
==> "Build-Test"
"Clean-Data"
==> "Build-Data"
==> "Create-Package-Data"
==> "Release"
"Clean-Rx"
==> "Build-Rx"
==> "Create-Package-Rx"
==> "Release"
"Clean-Test"
==> "Build-Test"
==> "Run-Test"
"Run-Test"
==> "Create-Package-Main"
RunTargetOrDefault "Release"