-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.fsx
123 lines (98 loc) · 3.02 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
#r @"packages/build/FAKE/tools/FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open Fake.Testing
let project = "InfluxDB.WriteOnly"
let summary = "Write-only client for InfluxDB"
let newVersion = getBuildParam "newVersion"
let testAssemblies = "tests/**/bin/Release/*Tests*.dll"
let isRelease = newVersion <> ""
let changeLogFile = "CHANGELOG.md"
Target "AssemblyInfo" (fun _ ->
let changeLog =
changeLogFile
|> ChangeLogHelper.LoadChangeLog
"src/InfluxDB.WriteOnly/InfluxDB.WriteOnly.csproj"
|> RegexReplaceInFileWithEncoding @"\<VersionPrefix\>.*\</VersionPrefix>"
(sprintf "<VersionPrefix>%O</VersionPrefix>" changeLog.LatestEntry.SemVer)
System.Text.Encoding.UTF8
)
Target "Clean" (fun _ ->
CleanDirs [ "bin" ]
)
Target "Restore" (fun _ ->
!! "src/**/*.??proj"
++ "tests/**/*.??proj"
|> Seq.iter (fun d ->
DotNetCli.Restore (fun p ->
{ p with
Project = d }))
)
Target "Build" (fun _ ->
DotNetCli.Build
(fun p ->
{ p with
Configuration = "Release"
AdditionalArgs = [ "--no-incremental" ] })
)
Target "CopyBinaries" (fun _ ->
!! "src/**/*.??proj"
|> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f) @@ "bin/Release", "bin" @@ (System.IO.Path.GetFileNameWithoutExtension f)))
|> Seq.iter (fun (fromDir, toDir) -> CopyDir toDir fromDir (fun _ -> true))
)
Target "Promote Unreleased to new version" (fun _ ->
if not isRelease then failwith "New version must be specified"
changeLogFile
|> ChangeLogHelper.LoadChangeLog
|> ChangeLogHelper.PromoteUnreleased newVersion
|> ChangeLogHelper.SaveChangeLog changeLogFile
|> ignore
)
Target "Help" (fun _ ->
listTargets()
)
Target "NuGet" (fun _ ->
DotNetCli.Pack
(fun p ->
{ p with
WorkingDir = "src/InfluxDB.WriteOnly";
OutputPath = "../../bin";
AdditionalArgs = [ "--include-symbols" ] })
)
Target "PublishNuGet" (fun _ ->
Paket.Push(fun p ->
{ p with
WorkingDir = "bin" })
)
Target "RunTests" (fun _ ->
DotNetCli.Test
(fun p ->
{ p with
WorkingDir = "tests/InfluxDB.WriteOnly.Tests" })
)
Target "UpdateAppVeyorVersion" (fun _ ->
let changeLog = changeLogFile |> ChangeLogHelper.LoadChangeLog
"appveyor.yml"
|> RegexReplaceInFileWithEncoding @"version: .*"
(sprintf "version: %O.{build}" changeLog.LatestEntry.SemVer)
System.Text.Encoding.UTF8
)
Target "Release" DoNothing
Target "All" DoNothing
Target "BuildPackage" DoNothing
"Clean"
=?> ("Promote Unreleased to new version", isRelease)
=?> ("AssemblyInfo", isRelease)
==> "Restore"
==> "Build"
==> "CopyBinaries"
==> "RunTests"
==> "All"
"All"
==> "NuGet"
==> "BuildPackage"
"BuildPackage"
==> "PublishNuGet"
==> "UpdateAppVeyorVersion"
==> "Release"
RunTargetOrDefault "All"