-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
71 lines (55 loc) · 1.6 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
#r "packages/FAKE/tools/FakeLib.dll"
open Fake
let version = "0.1.0"
let srcDir = "."
let outDir = "../build"
let revision = getBuildParamOrDefault "buildrevision" "0"
let buildVersion = sprintf "%s.%s" version revision
type DeployType = ProGet | Octopus
type HostInfo = {
name : string
buildProject : string
}
let hosts =
[
{ name = "ProjectA"
buildProject = "ProjectA"
}
{ name = "ProjectB"
buildProject = "Paynova.Billing.Vouchers.Api.Client"
}
]
let getHost name = hosts |> List.tryFind (fun h -> h.name = name)
let targetHostParam = getBuildParamOrDefault "targetHost" ""
let buildTargetHost =
match getHost targetHostParam with
| None -> failwithf "Could not find matching host to build. TargetHostParam: '%s'" targetHostParam
| Some(hostInfo) -> hostInfo
printfn "BuildVersion: %s" buildVersion
Target "Restore" (fun _ ->
Paket.Restore id
)
Target "InitOutDir" (fun _ ->
outDir |> directoryInfo |> ensureDirExists
CleanDir outDir
)
Target "Build" (fun _ ->
MSBuildRelease "" "Rebuild" [ sprintf "%s/%s/%s.csproj" srcDir buildTargetHost.buildProject buildTargetHost.buildProject ]
|> Log "Project build Output: "
)
Target "ProGetPack" (fun _ ->
Paket.Pack (fun p ->
{ p with
Version = buildVersion
OutputPath = outDir
TemplateFile = sprintf "%s/%s/paket.template" srcDir buildTargetHost.buildProject
})
)
Target "Default" DoNothing
Target "CI" DoNothing
"Restore"
==> "InitOutDir"
==> "Build"
==> "ProGetPack"
==> "Default"
RunTargetOrDefault "Default"