-
Notifications
You must be signed in to change notification settings - Fork 102
/
build.fsx
94 lines (80 loc) · 2.54 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
/// FAKE Build script
#r "packages/build/FAKE/tools/FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open Fake.Git
open Fake.ReleaseNotesHelper
open Fake.Testing.NUnit3
open System.IO
// Version info
let projectName = "LumenWorks.Framework.IO"
let authors = ["Sébastien Lorion"; "Paul Hatcher"]
let copyright = "Copyright © 2005 Sébastien Lorion, 2014 Paul Hatcher"
let release = LoadReleaseNotes "RELEASE_NOTES.md"
// Properties
let buildDir = "./build"
let toolsDir = getBuildParamOrDefault "tools" "packages/build"
let solutionFile = "CsvReader.sln"
let nunitPath = toolsDir @@ "/NUnit.ConsoleRunner/tools/nunit3-console.exe"
// Targets
Target "Clean" (fun _ ->
CleanDirs [buildDir;]
)
Target "PackageRestore" (fun _ ->
!! solutionFile
|> MSBuildRelease "" "Restore"
|> Log "AppBuild-Output: "
)
Target "SetVersion" (fun _ ->
let commitHash =
try
Information.getCurrentHash()
with
| ex -> printfn "Exception! (%s)" (ex.Message); ""
let infoVersion = String.concat " " [release.AssemblyVersion; commitHash]
CreateCSharpAssemblyInfo "./code/SolutionInfo.cs"
[Attribute.Product projectName
Attribute.Copyright copyright
Attribute.Version release.AssemblyVersion
Attribute.FileVersion release.AssemblyVersion
Attribute.InformationalVersion infoVersion]
)
Target "Build" (fun _ ->
!! solutionFile
|> MSBuild "" "Build"
[
"Configuration", "Release"
"Platform", "Any CPU"
"Authors", authors |> String.concat ", "
"PackageVersion", release.AssemblyVersion
"PackageReleaseNotes", release.Notes |> toLines
"IncludeSymbols", "true"
]
|> Log "AppBuild-Output: "
)
Target "Test" (fun _ ->
Directory.GetFiles(buildDir, "*.Tests.Unit.dll", SearchOption.AllDirectories)
// Filter out the NET Core versions as the NUnit runner can't execute them
|> Array.filter (fun x -> x.Contains("netcoreapp") = false)
|> NUnit3 (fun p ->
{p with
ToolPath = nunitPath
// Oddity as this creates a build directory in the build directory
//WorkingDir = buildDir
ShadowCopy = false})
)
Target "Release" (fun _ ->
let tag = String.concat "" ["v"; release.AssemblyVersion]
Branches.tag "" tag
Branches.pushTag "" "origin" tag
)
Target "Default" DoNothing
// Dependencies
"Clean"
==> "SetVersion"
==> "PackageRestore"
==> "Build"
==> "Test"
==> "Default"
==> "Release"
RunTargetOrDefault "Default"