forked from MassTransit/MassTransit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
99 lines (73 loc) · 3.2 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
93
94
95
96
97
98
99
#r @"src/packages/FAKE/tools/FakeLib.dll"
open System.IO
open Fake
open Fake.AssemblyInfoFile
open Fake.Git.Information
open Fake.SemVerHelper
open System
let buildArtifactPath = FullName "./build_artifacts"
let packagesPath = FullName "./src/packages"
let keyFile = FullName "./MassTransit.snk"
let assemblyVersion = "5.1.0.0"
let baseVersion = "5.1.5"
let envVersion = (environVarOrDefault "APPVEYOR_BUILD_VERSION" (baseVersion + ".0"))
let buildVersion = (envVersion.Substring(0, envVersion.LastIndexOf('.')))
let semVersion : SemVerInfo = (parse buildVersion)
let Version = semVersion.ToString()
let branch = (fun _ ->
(environVarOrDefault "APPVEYOR_REPO_BRANCH" (getBranchName "."))
)
let FileVersion = (environVarOrDefault "APPVEYOR_BUILD_VERSION" (Version + "." + "0"))
let informationalVersion = (fun _ ->
let branchName = (branch ".")
let label = if branchName="master" then "" else " (" + branchName + "/" + (getCurrentSHA1 ".").[0..7] + ")"
(FileVersion + label)
)
let nugetVersion = (fun _ ->
let branchName = (branch ".")
let label = if branchName="master" then "" else "-" + (if branchName="mt3" then "beta" else branchName)
let version = if branchName="master" then Version else FileVersion
(version + label)
)
let InfoVersion = informationalVersion()
let NuGetVersion = nugetVersion()
let versionArgs = [ @"/p:Version=""" + NuGetVersion + @""""; @"/p:PackageVersion=""" + NuGetVersion + @""""; @"/p:AssemblyVersion=""" + FileVersion + @""""; @"/p:FileVersion=""" + FileVersion + @""""; @"/p:InformationalVersion=""" + InfoVersion + @"""" ]
printfn "Using version: %s" Version
Target "Clean" (fun _ ->
ensureDirectory buildArtifactPath
CleanDir buildArtifactPath
)
Target "RestorePackages" (fun _ ->
DotNetCli.Restore (fun p -> { p with Project = "./src/"
AdditionalArgs = versionArgs })
)
Target "Build" (fun _ ->
DotNetCli.Build (fun p-> { p with Project = @".\src\MassTransit.sln"
Configuration= "Release"
AdditionalArgs = versionArgs })
)
let gitLink = (packagesPath @@ "gitlink" @@ "lib" @@ "net45" @@ "GitLink.exe")
Target "GitLink" (fun _ ->
if String.IsNullOrWhiteSpace(gitLink) then failwith "Couldn't find GitLink.exe in the packages folder"
let ok =
execProcess (fun info ->
info.FileName <- gitLink
info.Arguments <- (sprintf "%s -u https://github.com/MassTransit/MassTransit" __SOURCE_DIRECTORY__)) (TimeSpan.FromSeconds 30.0)
if not ok then failwith (sprintf "GitLink.exe %s' task failed" __SOURCE_DIRECTORY__)
)
Target "Package" (fun _ ->
DotNetCli.Pack (fun p-> { p with
Project = @".\src\MassTransit.sln"
Configuration= "Release"
OutputPath= buildArtifactPath
AdditionalArgs = versionArgs @ [ @"--include-symbols"; @"--include-source" ] })
)
Target "Default" (fun _ ->
trace "Build starting..."
)
"Clean"
==> "RestorePackages"
==> "Build"
==> "Package"
==> "Default"
RunTargetOrDefault "Default"