forked from fsprojects/FAKE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
212 lines (173 loc) · 7.29 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
#I @"tools/FAKE/tools/"
#r @"FakeLib.dll"
open Fake
open Fake.Git
open Fake.FSharpFormatting
// properties
let projectName = "FAKE"
let projectSummary = "FAKE - F# Make - Get rid of the noise in your build scripts."
let projectDescription = "FAKE - F# Make - is a build automation tool for .NET. Tasks and dependencies are specified in a DSL which is integrated in F#."
let authors = ["Steffen Forkmann"; "Mauricio Scheffer"; "Colin Bull"]
let mail = "forkmann@gmx.de"
let packages =
["FAKE.Core",projectDescription
"FAKE.Gallio",projectDescription + " Extensions for Gallio"
"FAKE.IIS",projectDescription + " Extensions for IIS"
"FAKE.SQL",projectDescription + " Extensions for SQL Server"
"FAKE.Experimental",projectDescription + " Experimental Extensions"
"FAKE.Deploy.Lib",projectDescription + " Extensions for FAKE Deploy"
projectName,projectDescription + " This package bundles all extensions."]
let buildVersion = if isLocalBuild then "0.0.1" else buildVersion
let buildDir = "./build"
let testDir = "./test"
let deployDir = "./Publish"
let docsDir = "./docs"
let apidocsDir = "./docs/apidocs/"
let nugetDir = "./nuget"
let reportDir = "./report"
let deployZip = deployDir @@ sprintf "%s-%s.zip" projectName buildVersion
let packagesDir = "./packages"
let additionalFiles = [
"License.txt"
"README.markdown"
"help/changelog.md"]
// Targets
Target "Clean" (fun _ -> CleanDirs [buildDir; testDir; deployDir; docsDir; apidocsDir; nugetDir; reportDir])
Target "RestorePackages" RestorePackages
Target "CopyFSharpFiles" (fun _ ->
["./tools/FSharp/FSharp.Core.optdata"
"./tools/FSharp/FSharp.Core.sigdata"]
|> CopyTo buildDir
)
open Fake.AssemblyInfoFile
Target "SetAssemblyInfo" (fun _ ->
let common = [
Attribute.Product "FAKE - F# Make"
Attribute.Version buildVersion
Attribute.InformationalVersion buildVersion
Attribute.FileVersion buildVersion]
[Attribute.Title "FAKE - F# Make Command line tool"
Attribute.Guid "fb2b540f-d97a-4660-972f-5eeff8120fba"] @ common
|> CreateFSharpAssemblyInfo "./src/app/FAKE/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make Deploy tool"
Attribute.Guid "413E2050-BECC-4FA6-87AA-5A74ACE9B8E1"] @ common
|> CreateFSharpAssemblyInfo "./src/app/Fake.Deploy/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make Deploy Web App"
Attribute.Guid "2B684E7B-572B-41C1-86C9-F6A11355570E"] @ common
|> CreateFSharpAssemblyInfo "./src/deploy.web/Fake.Deploy.Web.App/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make Deploy Web"
Attribute.Guid "27BA7705-3F57-47BE-B607-8A46B27AE876"] @ common
|> CreateCSharpAssemblyInfo "./src/deploy.web/Fake.Deploy.Web/AssemblyInfo.cs"
[Attribute.Title "FAKE - F# Make Deploy Lib"
Attribute.Guid "AA284C42-1396-42CB-BCAC-D27F18D14AC7"] @ common
|> CreateFSharpAssemblyInfo "./src/app/Fake.Deploy.Lib/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make Lib"
Attribute.InternalsVisibleTo "Test.FAKECore"
Attribute.Guid "d6dd5aec-636d-4354-88d6-d66e094dadb5"] @ common
|> CreateFSharpAssemblyInfo "./src/app/FakeLib/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make SQL Lib"
Attribute.Guid "A161EAAF-EFDA-4EF2-BD5A-4AD97439F1BE"] @ common
|> CreateFSharpAssemblyInfo "./src/app/Fake.SQL/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make Experimental Lib"
Attribute.Guid "5AA28AED-B9D8-4158-A594-32FE5ABC5713"] @ common
|> CreateFSharpAssemblyInfo "./src/app/Fake.Experimental/AssemblyInfo.fs"
)
Target "BuildSolution" (fun _ ->
MSBuildWithDefaults "Build" ["./FAKE.sln"]
|> Log "AppBuild-Output: "
)
Target "GenerateDocs" (fun _ ->
let source = "./help"
let template = "./help/templates/template-project.html"
let templatesDir = "./help/templates/reference/"
let projInfo =
[ "page-description", "FAKE - F# Make"
"page-author", separated ", " authors
"project-author", separated ", " authors
"github-link", "http://github.com/fsharp/fake"
"project-github", "http://github.com/fsharp/fake"
"project-nuget", "https://www.nuget.org/packages/FAKE"
"root", "http://fsharp.github.io/FAKE"
"project-name", "FAKE - F# Make" ]
CreateDocs source docsDir template projInfo
let dllFiles =
!! "./build/**/Fake.*.dll"
++ "./build/FakeLib.dll"
-- "./build/**/Fake.Experimental.dll"
CreateDocsForDlls apidocsDir templatesDir projInfo dllFiles
WriteStringToFile false "./docs/.nojekyll" ""
CopyDir (docsDir @@ "content") "help/content" allFiles
CopyDir (docsDir @@ "pics") "help/pics" allFiles
)
Target "CopyLicense" (fun _ ->
CopyTo buildDir additionalFiles
)
Target "Test" (fun _ ->
!! (testDir @@ "Test.*.dll")
|> MSpec (fun p ->
{p with
ExcludeTags = ["HTTP"]
HtmlOutputDir = reportDir})
)
Target "CreateNuGet" (fun _ ->
for package,description in packages do
let nugetDocsDir = nugetDir @@ "docs"
let nugetToolsDir = nugetDir @@ "tools"
CleanDir nugetDocsDir
CleanDir nugetToolsDir
DeleteFile "./build/FAKE.Gallio/Gallio.dll"
match package with
| p when p = projectName ->
!! (buildDir @@ "**/*.*") |> Copy nugetToolsDir
CopyDir nugetToolsDir @"./lib/fsi" allFiles
CopyDir nugetDocsDir docsDir allFiles
| p when p = "FAKE.Core" ->
!! (buildDir @@ "*.*") |> Copy nugetToolsDir
CopyDir nugetToolsDir @"./lib/fsi" allFiles
CopyDir nugetDocsDir docsDir allFiles
| _ ->
CopyDir nugetToolsDir (buildDir @@ package) allFiles
CopyTo nugetToolsDir additionalFiles
!! (nugetToolsDir @@ "*.pdb") |> DeleteFiles
(SemVerHelper.parse buildVersion).Patch.ToString()
|> WriteStringToFile false (nugetToolsDir @@ "PatchVersion.txt")
NuGet (fun p ->
{p with
Authors = authors
Project = package
Description = description
OutputPath = nugetDir
Summary = projectSummary
Dependencies =
if package <> "FAKE.Core" && package <> projectName then
["FAKE.Core", RequireExactly (NormalizeVersion buildVersion)]
else p.Dependencies
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey"
ToolPath = "./tools/NuGet/nuget.exe" }) "fake.nuspec"
)
Target "ReleaseDocs" (fun _ ->
CleanDir "gh-pages"
cloneSingleBranch "" "git@github.com:fsharp/FAKE.git" "gh-pages" "gh-pages"
fullclean "gh-pages"
CopyRecursive "docs" "gh-pages" true |> printfn "%A"
CopyFile "gh-pages" "./Samples/FAKE-Calculator.zip"
StageAll "gh-pages"
Commit "gh-pages" (sprintf "Update generated documentation %s" buildVersion)
Branches.push "gh-pages"
)
Target "Default" DoNothing
// Dependencies
"Clean"
==> "RestorePackages"
==> "CopyFSharpFiles"
=?> ("SetAssemblyInfo",not isLocalBuild )
==> "BuildSolution"
==> "Test"
==> "CopyLicense"
=?> ("GenerateDocs", isLocalBuild && not isLinux )
=?> ("CreateNuGet", not isLinux )
==> "Default"
==> "ReleaseDocs"
// start build
RunTargetOrDefault "Default"