-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.fsx
81 lines (62 loc) · 2.57 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
#r @"src/packages/FAKE/tools/FakeLib.dll"
open System.IO
open Fake
open Fake.AssemblyInfoFile
open Fake.Git.Information
open Fake.SemVerHelper
let buildArtifactPath = FullName "./build_artifacts"
let packagesPath = FullName "./src/packages"
let keyFile = FullName "./Machete.snk"
let assemblyVersion = "1.0.0.0"
let baseVersion = "1.0.0"
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/" } )
)
Target "Build" (fun _ ->
DotNetCli.Build (fun p-> { p with Project = @".\src\Machete.sln"
Configuration= "Release"
AdditionalArgs = versionArgs })
)
Target "Package" (fun _ ->
DotNetCli.Pack (fun p-> { p with
Project = @".\src\Machete.sln"
Configuration= "Release"
OutputPath= buildArtifactPath
AdditionalArgs = versionArgs @ [ @"--include-symbols"; @"--include-source" ] })
)
Target "Default" (fun _ ->
trace "Build starting..."
)
"Clean"
==> "RestorePackages"
==> "Build"
==> "Package"
==> "Default"
RunTargetOrDefault "Default"