/
build.fsx
156 lines (129 loc) · 4.66 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
#r @"tools/FAKE/tools/FakeLib.dll"
open Fake
// 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 homepage = "http://github.com/forki/fake"
let buildDir = "./build"
let testDir = "./test"
let metricsDir = "./BuildMetrics"
let deployDir = "./Publish"
let docsDir = "./docs"
let nugetDir = "./nuget"
let reportDir = "./report"
let deployZip = deployDir @@ sprintf "%s-%s.zip" projectName buildVersion
let packagesDir = "./packages"
// Targets
Target "Clean" (fun _ -> CleanDirs [buildDir; testDir; deployDir; docsDir; metricsDir; 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 _ ->
CreateFSharpAssemblyInfo "./src/app/FAKE/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make Command line tool"
Attribute.Guid "fb2b540f-d97a-4660-972f-5eeff8120fba"
Attribute.Product "FAKE - F# Make"
Attribute.Version buildVersion
Attribute.FileVersion buildVersion]
CreateFSharpAssemblyInfo "./src/app/Fake.Deploy/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make Deploy tool"
Attribute.Guid "413E2050-BECC-4FA6-87AA-5A74ACE9B8E1"
Attribute.Product "FAKE - F# Make"
Attribute.Version buildVersion
Attribute.FileVersion buildVersion]
CreateFSharpAssemblyInfo "./src/app/FakeLib/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make Lib"
Attribute.Guid "d6dd5aec-636d-4354-88d6-d66e094dadb5"
Attribute.Product "FAKE - F# Make"
Attribute.Version buildVersion
Attribute.FileVersion buildVersion]
CreateFSharpAssemblyInfo "./src/app/Fake.SQL/AssemblyInfo.fs"
[Attribute.Title "FAKE - F# Make SQL Lib"
Attribute.Guid "A161EAAF-EFDA-4EF2-BD5A-4AD97439F1BE"
Attribute.Product "FAKE - F# Make"
Attribute.Version buildVersion
Attribute.FileVersion buildVersion]
)
Target "BuildSolution" (fun _ ->
MSBuildWithDefaults "Build" ["./FAKE.sln"]
|> Log "AppBuild-Output: "
)
Target "GenerateDocumentation" (fun _ ->
!! (buildDir @@ "Fake*.dll")
|> Docu (fun p ->
{p with
ToolPath = buildDir @@ "docu.exe"
TemplatesPath = @".\tools\Docu\templates\"
OutputPath = docsDir })
)
Target "CopyDocu" (fun _ ->
["./tools/Docu/docu.exe"
"./tools/Docu/DocuLicense.txt"]
|> CopyTo buildDir
)
Target "CopyLicense" (fun _ ->
["License.txt"
"readme.markdown"
"changelog.markdown"]
|> CopyTo buildDir
)
Target "BuildZip" (fun _ ->
!+ (buildDir @@ @"**/*.*")
-- "*.zip"
-- "**/*.pdb"
|> Scan
|> Zip buildDir deployZip
)
Target "Test" (fun _ ->
let MSpecVersion = GetPackageVersion packagesDir "Machine.Specifications"
let mspecTool = sprintf @"%s/Machine.Specifications.%s/tools/mspec-clr4.exe" packagesDir MSpecVersion
!! (testDir @@ "Test.*.dll")
|> MSpec (fun p ->
{p with
ToolPath = mspecTool
ExcludeTags = ["HTTP"]
HtmlOutputDir = reportDir})
)
Target "ZipDocumentation" (fun _ ->
!! (docsDir @@ @"**/*.*")
|> Zip docsDir (deployDir @@ sprintf "Documentation-%s.zip" buildVersion)
)
Target "CreateNuGet" (fun _ ->
let nugetDocsDir = nugetDir @@ "docs"
let nugetToolsDir = nugetDir @@ "tools"
CopyDir nugetDocsDir docsDir allFiles
CopyDir nugetToolsDir buildDir allFiles
CopyDir nugetToolsDir @"./lib/fsi" allFiles
DeleteFile (nugetToolsDir @@ "Gallio.dll")
NuGet (fun p ->
{p with
Authors = authors
Project = projectName
Description = projectDescription
OutputPath = nugetDir
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" }) "fake.nuspec"
)
Target "Default" DoNothing
// Dependencies
"Clean"
==> "RestorePackages"
==> "CopyFSharpFiles"
=?> ("SetAssemblyInfo",not isLocalBuild )
==> "BuildSolution"
==> "Test"
==> "CopyLicense" <=> "CopyDocu"
==> "BuildZip"
==> "GenerateDocumentation"
==> "ZipDocumentation"
==> "CreateNuGet"
==> "Default"
// start build
RunTargetOrDefault "Default"