forked from lawrencetaylor/Myxomatosis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
92 lines (81 loc) · 3.05 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
85
86
87
88
89
90
91
92
#r "./tools/Fake/tools/FakeLib.dll"
open Fake
let buildVersion =
if System.String.IsNullOrWhiteSpace Fake.AppVeyor.AppVeyorEnvironment.BuildVersion then "1.0.0" else Fake.AppVeyor.AppVeyorEnvironment.BuildVersion
let accessKey = getBuildParamOrDefault "PRIVATEKEY" "NOKEY"
let sourceDir = __SOURCE_DIRECTORY__
let buildDir = sourceDir @@ "bin"
printfn "API KEY is %s" accessKey
Target "Clean" (fun _ -> CleanDir buildDir)
Target "Build" (fun _ ->
!! ( "./src/Myxomatosis_*/*.csproj")
|> Seq.iter(
fun proj ->
let fileI = fileInfo proj
let fileName (fi : System.IO.FileInfo) = System.IO.Path.GetFileNameWithoutExtension fi.Name
let name = (fileName fileI).Replace("Myxomatosis_", "").ToLower()
build
(fun defaults ->
{ defaults with
Verbosity = Some Quiet
Targets = ["Build"]
Properties =
[
"Optimize", "True"
"DebugSymbols", "True"
"Configuration", "Release"
"OutputPath", buildDir @@ "lib" @@ name
]
}) proj))
Target "Pack" (fun _ ->
Fake.NuGetHelper.NuGetPack (
fun p ->
{ p with
Authors = [ "Travel Republic "]
Project = "Myxomatosis"
Description = "Rabbit MQ Client leverating reactive extensions"
ToolPath = sourceDir @@ ".nuget/nuget.exe"
WorkingDir = buildDir
OutputPath = buildDir
Version = buildVersion
Dependencies = [ "Newtonsoft.Json", "[7.0.1, )"
"System.Reactive.Linq", "[3.0.0, )" ]
DependenciesByFramework =
[
{ FrameworkVersion = "net45"
Dependencies = [
"RabbitMQ.Client", "[3.2.0, 3.4.0)" ]
}
{ FrameworkVersion = "net452"
Dependencies = [
"RabbitMQ.Client", "[4.0.0, )" ]
}
{ FrameworkVersion = "net46"
Dependencies = [
"RabbitMQ.Client", "[4.0.0, )" ]
}
]
Files = [ "**/Myxomatosis.*", None, None ]
}
) (sourceDir @@ ".nuget/template")
())
Target "Publish" (fun _ ->
!! (buildDir @@ "**/*.nupkg")
|> Seq.iter(fun a ->
let directory = a |> directory |> directoryInfo
let workingDir = directory.FullName
traceImportant (sprintf "Nuget package file: %s" a)
traceImportant (sprintf "push \"%s\" %s" a accessKey)
let exitCode =
ExecProcess(fun info ->
info.FileName <- sourceDir @@ ".nuget/nuget.exe"
info.Arguments <- sprintf "push \"%s\" %s -Source https://www.nuget.org/api/v2/package" a accessKey) (System.TimeSpan.FromSeconds 30.0)
if exitCode = 0 then ()
else failwith "Error during Nuget push"
)
)
"Clean"
==> "Build"
==> "Pack"
==> "Publish"
RunTargetOrDefault "Publish"