-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.fsx
76 lines (58 loc) · 2.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
#r "paket:
nuget Fake.Core.Target
nuget Fake.Core.ReleaseNotes
nuget Fake.IO.FileSystem
nuget Fake.IO.Zip
nuget Fake.Api.GitHub
nuget Fake.DotNet.MSBuild
nuget Fake.DotNet.Cli
nuget Fake.DotNet.Testing.XUnit2
nuget Octokit 0.48
//"
#load "build.imports.fsx"
#load "build.tools.fsx"
open Fake.IO
open Fake.IO.Globbing.Operators
open Fake.IO.FileSystemOperators
open Fake.Core
open Fake.Api
open Tools
let solutions = Proj.settings |> Config.keys "Build"
let packages = Proj.settings |> Config.keys "Pack"
let clean () = !! "**/bin/" ++ "**/obj/" |> Shell.deleteDirs
let build () = solutions |> Proj.buildMany
let restore () = solutions |> Proj.restoreMany
let test () = Proj.testAll ()
let release () = packages |> Proj.packMany
let publish apiKey = packages |> Seq.iter (Proj.publishNugetOrg apiKey)
Target.create "Refresh" (fun _ ->
// Proj.regenerateStrongName "K4os.Hash.xxHash.snk"
Proj.updateCommonTargets "Common.targets"
)
Target.create "Clean" (fun _ -> clean ())
Target.create "Restore" (fun _ -> restore ())
Target.create "Build" (fun _ -> build ())
Target.create "Rebuild" ignore
Target.create "Release" (fun _ -> release ())
Target.create "Test" (fun p ->
if p.Context.Arguments |> List.contains "notest"
then Log.warn "Ignoring tests"
else test ()
)
Target.create "Release:Nuget" (fun _ ->
Proj.settings |> Config.valueOrFail "nuget" "accessKey" |> publish
)
Target.create "Release:GitHub" (fun _ ->
let user = Proj.settings |> Config.valueOrFail "github" "user"
let token = Proj.settings |> Config.valueOrFail "github" "token"
let repository = Proj.settings |> Config.keys "Repository" |> Seq.exactlyOne
!! (Proj.outputFolder @@ (sprintf "*.%s.nupkg" Proj.productVersion))
|> Proj.publishGitHub repository user token
)
open Fake.Core.TargetOperators
"Refresh" ==> "Restore" ==> "Build" ==> "Rebuild" ==> "Test" ==> "Release"
// "Release" ==> "Release:GitHub" ==> "Release:Nuget"
"Clean" ==> "Rebuild"
"Clean" ?=> "Restore"
"Build" ?=> "Test"
Target.runOrDefaultWithArguments "Build"