forked from Zaid-Ajaj/LiteDB.FSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
84 lines (69 loc) · 2.11 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
#r "paket:
nuget Fake.Core.Target
nuget Fake.DotNet.Cli
nuget Fake.DotNet.Paket
nuget Fake.IO.FileSystem
//"
#load ".fake/build.fsx/intellisense.fsx"
open System.IO
open Fake.Core
open Fake.Core.TargetOperators
open Fake.DotNet
open Fake.IO
open Fake.IO.FileSystemOperators
let cwd = __SOURCE_DIRECTORY__
let projectPath = cwd </> "LiteDB.FSharp"
let testsPath = cwd </> "LiteDB.FSharp.Tests"
Target.create "RunTests" <| fun _ ->
"LiteDB.FSharp.Tests.fsproj"
|> DotNet.exec (fun defaults -> { defaults with WorkingDirectory = testsPath}) "run"
|> ignore
Target.create "Clean" <| fun _ ->
[
cwd </> "bin"
projectPath </> "bin"
projectPath </> "obj"
testsPath </> "bin"
testsPath </> "obj"
]
|> Shell.cleanDirs
Target.create "Build" <| fun _ ->
let setParams (defaults: DotNet.BuildOptions) =
{
defaults with
Configuration = DotNet.BuildConfiguration.Release
}
DotNet.build setParams (projectPath </> "LiteDB.FSharp.fsproj")
Target.create "PackNuget" <| fun _ ->
Paket.pack (fun defaults ->
{
defaults with
TemplateFile = projectPath </> "paket.template"
BuildConfig = "Release"
MinimumFromLockFile = true
OutputPath = cwd </> "bin"
})
Target.create "PublishNuget" <| fun _ ->
let nugetKey =
match Environment.environVarOrNone "NUGET_KEY" with
| Some nugetKey -> nugetKey
| None -> failwith "The Nuget API key must be set in a NUGET_KEY environmental variable"
let nupkg = Directory.GetFiles(cwd </> "bin") |> Seq.head
let setParams (defaults: DotNet.NuGetPushOptions) =
{
defaults with
PushParams =
{
defaults.PushParams with
ApiKey = Some nugetKey
Source = Some "nuget.org"
}
}
DotNet.nugetPush setParams nupkg
"Clean"
==> "Build"
==> "PackNuget"
==> "PublishNuget"
"Clean"
==> "RunTests"
Target.runOrDefault "RunTests"