1
-
2
1
#r @" paket:
3
2
nuget Fake.Core.Target
4
3
nuget Fake.Core.Process
@@ -25,75 +24,11 @@ open System.IO
25
24
open Fake.Core
26
25
open Fake.Core .TargetOperators
27
26
open Fake.DotNet
28
- open Fake.IO .Globbing
29
- open Fake.DotNet .NuGet
30
- open Fake.DotNet .Testing
31
27
open Fake.IO
32
28
open Fake.IO .FileSystemOperators
33
29
open Fake.IO .Globbing .Operators
34
30
open Fake.Tools
35
31
36
- [<AutoOpen>]
37
- module TemporaryDocumentationHelpers =
38
-
39
- type LiterateArguments =
40
- { ToolPath : string
41
- Source : string
42
- OutputDirectory : string
43
- Template : string
44
- ProjectParameters : ( string * string ) list
45
- LayoutRoots : string list
46
- FsiEval : bool }
47
-
48
- let private run toolPath arguments =
49
- Command.RawCommand
50
- (
51
- toolPath,
52
- arguments
53
- )
54
- |> CreateProcess.fromCommand
55
- |> CreateProcess.withFramework
56
- |> CreateProcess.ensureExitCode
57
- |> Proc.run
58
- |> ignore
59
-
60
-
61
- let createDocs p =
62
- let toolPath =
63
- match ProcessUtils.tryFindLocalTool " " " fsformatting.exe" [( Directory.GetCurrentDirectory() @@ " /lib" )] with
64
- | Some tool -> tool
65
- | _ -> failwith " FSFormatting executable not found"
66
- //let toolPath = Tools.findToolInSubPath "fsformatting.exe" (Directory.GetCurrentDirectory() @@ "lib/Formatting")
67
-
68
- let defaultLiterateArguments =
69
- { ToolPath = toolPath
70
- Source = " "
71
- OutputDirectory = " "
72
- Template = " "
73
- ProjectParameters = []
74
- LayoutRoots = []
75
- FsiEval = false }
76
-
77
- let arguments = ( p: LiterateArguments-> LiterateArguments) defaultLiterateArguments
78
- let layoutroots =
79
- if arguments.LayoutRoots.IsEmpty then []
80
- else [ " --layoutRoots" ] @ arguments.LayoutRoots
81
- let source = arguments.Source
82
- let template = arguments.Template
83
- let outputDir = arguments.OutputDirectory
84
- let fsiEval = if arguments.FsiEval then [ " --fsieval" ] else []
85
-
86
- let command =
87
- arguments.ProjectParameters
88
- |> Seq.map ( fun ( k , v ) -> [ k; v ])
89
- |> Seq.concat
90
- |> Seq.append
91
- ([ " literate" ; " --processdirectory" ] @ layoutroots @ [ " --inputdirectory" ; source; " --templatefile" ; template;
92
- " --outputDirectory" ; outputDir] @ fsiEval @ [ " --replacements" ])
93
- |> Arguments.OfArgs
94
- run arguments.ToolPath command
95
- printfn " Successfully generated docs for %s " source
96
-
97
32
let project = " FSharp.Plotly"
98
33
99
34
let summary = " A F# interactive charting library using plotly.js"
@@ -117,6 +52,29 @@ let pkgDir = "pkg"
117
52
118
53
let release = ReleaseNotes.load " RELEASE_NOTES.md"
119
54
55
+ let mutable prereleaseTag = " "
56
+ let mutable isPrerelease = false
57
+
58
+ [<AutoOpen>]
59
+ module MessagePrompts =
60
+
61
+ let prompt ( msg : string ) =
62
+ System.Console.Write( msg)
63
+ System.Console.ReadLine() .Trim()
64
+ |> function | " " -> None | s -> Some s
65
+ |> Option.map ( fun s -> s.Replace ( " \" " , " \\\" " ))
66
+
67
+ let rec promptYesNo msg =
68
+ match prompt ( sprintf " %s [Yn]: " msg) with
69
+ | Some " Y" | Some " y" -> true
70
+ | Some " N" | Some " n" -> false
71
+ | _ -> System.Console.WriteLine( " Sorry, invalid answer" ); promptYesNo msg
72
+
73
+ let releaseMsg = """ This will stage all uncommitted changes, push them to the origin and bump the release version to the latest number in the RELEASE_NOTES.md file.
74
+ Do you want to continue?"""
75
+
76
+ let releaseDocsMsg = """ This will push the docs to gh-pages. Remember building the docs prior to this. Do you want to continue?"""
77
+
120
78
// Generate assembly info files with the right version & up-to-date information
121
79
Target.create " AssemblyInfo" ( fun _ ->
122
80
let getAssemblyInfoAttributes projectName =
@@ -209,26 +167,33 @@ Target.create "RunTests" (fun _ ->
209
167
// --------------------------------------------------------------------------------------
210
168
// Build and publish NuGet package
211
169
212
- Target.create " BuildPreReleasePackages" ( fun _ ->
213
- printfn " Please enter pre-release package suffix"
214
- let suffix = Console.ReadLine()
215
- Paket.pack( fun p ->
216
- { p with
217
- ToolType = ToolType.CreateLocalTool()
218
- OutputPath = pkgDir
219
- Version = sprintf " %s -%s " release.NugetVersion suffix
220
- ReleaseNotes = release.Notes |> String.toLines })
221
- )
170
+ Target.create " buildPrereleasePackages" ( fun _ ->
171
+ printfn " Please enter pre-release package suffix"
172
+ let suffix = System.Console.ReadLine()
173
+ isPrerelease <- true
174
+ prereleaseTag <- ( sprintf " %s -%s " release.NugetVersion suffix)
175
+ if promptYesNo ( sprintf " package tag will be %s OK?" prereleaseTag )
176
+ then
177
+ Paket.pack( fun p ->
178
+ { p with
179
+
180
+ ToolType = ToolType.CreateLocalTool()
181
+ OutputPath = pkgDir
182
+ Version = prereleaseTag
183
+ ReleaseNotes = release.Notes |> String.toLines })
184
+ else
185
+ failwith " aborted"
186
+ )
222
187
223
188
Target.create " BuildReleasePackages" ( fun _ ->
224
- Paket.pack ( fun p ->
225
- { p with
226
- ToolType = ToolType.CreateLocalTool ()
227
- OutputPath = pkgDir
228
- Version = release.NugetVersion
229
- ReleaseNotes = release.Notes |> String.toLines })
230
- )
231
-
189
+ isPrerelease <- false
190
+ Paket.pack ( fun p ->
191
+ { p with
192
+ ToolType = ToolType.CreateLocalTool ()
193
+ OutputPath = pkgDir
194
+ Version = release.NugetVersion
195
+ ReleaseNotes = release.Notes |> String.toLines } )
196
+ )
232
197
Target.create " BuildCIPackages" ( fun _ ->
233
198
Paket.pack( fun p ->
234
199
{ p with
@@ -246,6 +211,13 @@ Target.create "PublishNuget" (fun _ ->
246
211
ApiKey = Environment.environVarOrDefault " NuGet-key" " " })
247
212
)
248
213
214
+ Target.create " publishPrereleaseNugetPackages" ( fun _ ->
215
+ Paket.push( fun p ->
216
+ { p with
217
+ WorkingDir = pkgDir
218
+ ToolType = ToolType.CreateLocalTool()
219
+ ApiKey = Environment.environVarOrDefault " NuGet-key" " " })
220
+ )
249
221
250
222
// --------------------------------------------------------------------------------------
251
223
// Generate the documentation
@@ -368,6 +340,6 @@ Target.create "DotnetCoreBuild" ignore
368
340
==> " CopyBinaries"
369
341
==> " RunTests"
370
342
==> " BuildPreReleasePackages"
371
- ==> " GitReleaseNuget "
343
+ ==> " publishPrereleaseNugetPackages "
372
344
373
345
Target.runOrDefaultWithArguments " All"
0 commit comments