forked from fsprojects/FSharpx.Extras
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.fsx
More file actions
168 lines (141 loc) · 5.58 KB
/
Copy pathbuild.fsx
File metadata and controls
168 lines (141 loc) · 5.58 KB
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
#r "./packages/FAKE.1.56.6/tools/FakeLib.dll"
open Fake
open System.IO
// properties
let currentDate = System.DateTime.UtcNow
let projectName = "FSharpx"
let version = "1.3." + currentDate.ToString("yMMdd")
let coreSummary = "FSharpx is a library for the .NET platform implementing general functional constructs on top of the F# core library."
let projectSummary = "FSharpx is a library for the .NET platform implementing general functional constructs on top of the F# core library."
let projectDescription = "FSharpx is a library for the .NET platform implementing general functional constructs on top of the F# core library. Its main target is F# but it aims to be compatible with all .NET languages wherever possible.\r\n\r\nIt currently implements:\r\n\r\n* Several standard monads: State, Reader, Writer, Either, Continuation, Distribution\r\n* Iteratee\r\n* Validation applicative functor\r\n* General functions like flip\r\n* Additional functions around collections\r\n* Functions to make C# - F# interop easier."
let authors = ["Steffen Forkmann"; "Tomas Petricek"; "Ryan Riley"; "Mauricio Scheffer" ]
let mail = "ryan.riley@panesofglass.org"
let homepage = "http://github.com/fsharp/fsharpx"
let nugetKey = if System.IO.File.Exists "./key.txt" then ReadFileAsString "./key.txt" else ""
// directories
let buildDir = "./build/"
let packagesDir = "./packages/"
let testDir = "./test/"
let deployDir = "./deploy/"
let docsDir = "./docs/"
let nugetDir = "./nuget/"
let targetPlatformDir = getTargetPlatformDir "4.0.30319"
let nugetLibDir = nugetDir @@ "lib"
let nugetDocsDir = nugetDir @@ "docs"
// params
let target = getBuildParamOrDefault "target" "All"
let frameworkVersion = getBuildParamOrDefault "frameworkVersion" "v4.0"
let frameworkParams =
let v = ("[^\\d]" >=> "") frameworkVersion
let v = v.Substring(0,2)
["TargetFrameworkVersion", frameworkVersion; "DefineConstants", "NET" + v]
// tools
let fakePath = "./packages/FAKE.1.56.6/tools"
let nugetPath = "./lib/Nuget/nuget.exe"
let nunitPath = "./packages/NUnit.2.5.10.11092/Tools"
// files
let appReferences =
!+ "./src/**/*.*proj"
|> Scan
let testReferences =
!+ "./tests/**/*.*proj"
|> Scan
let filesToZip =
!+ (buildDir + "/**/*.*")
-- "*.zip"
|> Scan
// targets
Target "Clean" (fun _ ->
CleanDirs [buildDir; testDir; deployDir; docsDir]
)
Target "BuildApp" (fun _ ->
AssemblyInfo (fun p ->
{p with
CodeLanguage = FSharp
AssemblyVersion = version
AssemblyTitle = projectName
AssemblyDescription = projectSummary
Guid = "1e95a279-c2a9-498b-bc72-6e7a0d6854ce"
OutputFileName = "./src/FSharpx.Core/AssemblyInfo.fs" })
AssemblyInfo (fun p ->
{p with
CodeLanguage = FSharp
AssemblyVersion = version
AssemblyTitle = "FSharp.AsyncExtensions"
AssemblyDescription = "This library implements various extensions for asynchronous programming using F# asynchronous workflows and F# agents."
Guid = "ede1812b-5a62-410a-9553-02499cf29317"
OutputFileName = "./src/FSharpx.AsyncExtensions/AssemblyInfo.fs" })
MSBuild buildDir "Build" (["Configuration","Release"] @ frameworkParams) appReferences
|> Log "AppBuild-Output: "
)
Target "BuildTest" (fun _ ->
MSBuild testDir "Build" (["Configuration","Debug"] @ frameworkParams) testReferences
|> Log "TestBuild-Output: "
)
Target "Test" (fun _ ->
!+ (testDir + "/*.Tests.dll")
|> Scan
|> NUnit (fun p ->
{p with
ToolPath = nunitPath
DisableShadowCopy = true
OutputFile = testDir + "TestResults.xml" })
)
Target "GenerateDocumentation" (fun _ ->
!+ (buildDir + "*.dll")
|> Scan
|> Docu (fun p ->
{p with
ToolPath = fakePath + "/docu.exe"
TemplatesPath = "./lib/templates"
OutputPath = docsDir })
)
Target "CopyLicense" (fun _ ->
[ "LICENSE.md" ] |> CopyTo buildDir
)
Target "ZipDocumentation" (fun _ ->
!+ (docsDir + "/**/*.*")
|> Scan
|> Zip docsDir (deployDir + sprintf "Documentation-%s.zip" version)
)
Target "BuildNuGet" (fun _ ->
CleanDirs [nugetDir; nugetLibDir; nugetDocsDir]
XCopy (docsDir |> FullName) nugetDocsDir
[ buildDir + "FSharpx.Core.dll"
buildDir + "FSharpx.Core.pdb"
buildDir + "FSharpx.Core.xml"
buildDir + "FSharp.AsyncExtensions.dll"
buildDir + "FSharp.AsyncExtensions.pdb"
buildDir + "FSharp.AsyncExtensions.xml" ]
|> CopyTo nugetLibDir
NuGet (fun p ->
{p with
Authors = authors
Project = projectName + ".Core"
Description = projectDescription
Version = version
OutputPath = nugetDir
AccessKey = nugetKey
ToolPath = nugetPath
Publish = nugetKey <> "" })
"FSharpx.Core.nuspec"
[nugetDir + sprintf "FSharpx.Core.%s.nupkg" version]
|> CopyTo deployDir
)
Target "Deploy" (fun _ ->
!+ (buildDir + "/**/*.*")
-- "*.zip"
|> Scan
|> Zip buildDir (deployDir + sprintf "%s-%s.zip" projectName version)
)
Target "All" DoNothing
// Build order
"Clean"
==> "BuildApp" <=> "BuildTest" <=> "CopyLicense"
==> "Test" <=> "GenerateDocumentation"
==> "ZipDocumentation"
==> "BuildNuGet"
==> "Deploy"
"All" <== ["Deploy"]
// Start build
Run target