forked from fsprojects/FSharp.Control.AsyncSeq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.fsx
More file actions
145 lines (113 loc) · 4.11 KB
/
build.fsx
File metadata and controls
145 lines (113 loc) · 4.11 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
// --------------------------------------------------------------------------------------
// FAKE build script
// --------------------------------------------------------------------------------------
// This is a FAKE 5.0 script, run using
// dotnet fake build
#r "paket: groupref fake //"
#if !FAKE
#load ".fake/build.fsx/intellisense.fsx"
#r "netstandard"
#endif
open Fake.Core
open Fake.Core.TargetOperators
open Fake.IO.Globbing.Operators
open Fake.IO.FileSystemOperators
open Fake.DotNet
open Fake.IO
open Fake.Tools
//open Fake.ReleaseNotesHelper
//open Fake.AssemblyInfoFile
open System
open System.IO
// The name of the project
// (used by attributes in AssemblyInfo, name of a NuGet package and directory in 'src')
let project = "src/FSharp.Control.AsyncSeq"
// File system information
let solutionFile = "FSharp.Control.AsyncSeq.sln"
let summary = "Asynchronous sequences for F#"
let license = "Apache 2.0 License"
// Git configuration (used for publishing documentation in gh-pages branch)
// The profile where the project is posted
let projectRepo = "https://github.com/fsprojects/FSharp.Control.AsyncSeq"
let configuration = DotNet.BuildConfiguration.fromEnvironVarOrDefault "configuration" DotNet.BuildConfiguration.Release
// Folder to deposit deploy bin
let binDir = __SOURCE_DIRECTORY__ @@ "bin"
// Read additional information from the release notes document
let release = ReleaseNotes.load "RELEASE_NOTES.md"
let versionPropsTemplate = $"\
<Project>
<PropertyGroup>
<Version>%s{release.NugetVersion}</Version>
</PropertyGroup>
</Project>"
// --------------------------------------------------------------------------------------
// Clean build results
Target.create "Clean" (fun _ ->
DotNet.exec id "clean" "" |> ignore
Shell.cleanDirs ["bin"; "temp"]
)
// Generate assembly info files with the right version & up-to-date information
Target.create "AssemblyInfo" (fun _ ->
let info = [
AssemblyInfo.Product project
AssemblyInfo.Description summary
AssemblyInfo.Version release.AssemblyVersion
AssemblyInfo.FileVersion release.AssemblyVersion
AssemblyInfo.InformationalVersion release.NugetVersion
AssemblyInfo.Copyright license
]
AssemblyInfoFile.createFSharp "src/Common/AssemblyInfo.fs" info
AssemblyInfoFile.createCSharp "src/Common/AssemblyInfo.cs" info
File.WriteAllText("version.props", sprintf """<Project>
<PropertyGroup>
<Version>%s</Version>
</PropertyGroup>
</Project>""" release.NugetVersion)
)
// --------------------------------------------------------------------------------------
// Build library & test project
Target.create "Build" (fun _ ->
solutionFile
|> DotNet.build (fun opts -> { opts with Configuration = configuration } ))
// --------------------------------------------------------------------------------------
// Run the unit tests using test runner
Target.create "Test" (fun _ ->
solutionFile
|> DotNet.test (fun opts ->
{ opts with
Blame = true
NoBuild = true
Configuration = configuration
ResultsDirectory = Some "TestResults"
Logger = Some "trx"
})
)
// --------------------------------------------------------------------------------------
// Build a NuGet package
Target.create "Pack" (fun _ ->
File.WriteAllText("version.props",versionPropsTemplate)
DotNet.pack (fun pack ->
{ pack with
OutputPath = Some binDir
Configuration = configuration
}) solutionFile
)
// --------------------------------------------------------------------------------------
// Generate the documentation
Target.create "GenerateDocs" (fun _ ->
Shell.cleanDir ".fsdocs"
DotNet.exec id "fsdocs" "build --clean --properties Configuration=Release --eval" |> ignore
)
// --------------------------------------------------------------------------------------
// Run all targets by default. Invoke 'build <Target>' to override
Target.create "All" ignore
"Clean"
==> "Build"
==> "Test"
==> "Pack"
==> "All"
"Clean"
==> "Build"
==> "GenerateDocs"
==> "All"
Target.runOrDefault "All"