forked from WebApiContrib/WebAPIContrib.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
64 lines (56 loc) · 1.63 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
#r "paket: groupref FakeBuild //"
#load "./.fake/build.fsx/intellisense.fsx"
#if !FAKE
#r "Facades/netstandard"
#r "netstandard"
#endif
open System.IO
open BlackFox.Fake
open Fake.BuildServer
open Fake.Core
open Fake.DotNet
open Fake.IO
open Fake.IO.Globbing.Operators
let cleanTask =
BuildTask.create "Clean" [] {
!! "artifacts" ++ "src/*/bin" ++ "test/*/bin"
|> Shell.deleteDirs
}
let buildTask =
BuildTask.create "Build" [cleanTask] {
!! "**/*.csproj"
|> Seq.iter
(DotNet.build
(fun p -> p))
}
let testTask =
BuildTask.create "Test" [] {
let isAppVeyorBuild = AppVeyor.detect()
!! "tests/**/*.csproj"
|> Seq.iter
(DotNet.test
(fun p ->
{ p with
Configuration = DotNet.BuildConfiguration.Release
TestAdapterPath = if isAppVeyorBuild then Some "." else None
Logger = if isAppVeyorBuild then Some "AppVeyor" else None }))
}
let packTask =
BuildTask.create "Pack" [buildTask; testTask] {
let artifactsDir = Path.Combine(__SOURCE_DIRECTORY__, "artifacts")
!! "src/**/*.csproj"
|> Seq.iter
(DotNet.pack
(fun p ->
{ p with
NoBuild = true
Configuration = DotNet.BuildConfiguration.Release
OutputPath = Some artifactsDir }))
}
BuildTask.create "Help" [] {
Trace.logfn "Usage: fake [--target <target>] [<options>]"
BuildTask.listAvailable()
}
let defaultTask =
BuildTask.createEmpty "All" [packTask]
BuildTask.runOrDefault defaultTask