-
Notifications
You must be signed in to change notification settings - Fork 12
/
Build.fsx
84 lines (71 loc) · 2.67 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
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open Fake.Git
let srcDir = "./src"
let versionMajorMinor = "1.2"
let commitHash = Information.getCurrentSHA1("")
let versionBuild =
match buildServer with
| AppVeyor -> ( appVeyorBuildVersion.Replace("1.2.", ""))
| _ -> "0"
let buildVersion = versionMajorMinor + "." + versionBuild
Target "Version" (fun _ ->
CreateCSharpAssemblyInfo (srcDir @@ "VersionInfo.cs")
[Attribute.Metadata("githash", commitHash)]
)
Target "Clean" (fun _ ->
CleanDirs []
DeleteDir "bin"
CreateDir "bin"
)
Target "Build" (fun _ ->
DotNetCli.Build (fun p ->
{ p with
WorkingDir = srcDir
Configuration = "Release"
AdditionalArgs = ["/p:Version=" + buildVersion
"/p:FileVersion=" + buildVersion
"/p:InformationalVersion=" + versionMajorMinor
"/p:Product=HealthNet"
"/p:Company=HealthNet"
"/p:Copyright=\"Copyright HealthNet " + System.DateTime.Now.Year.ToString() + "\""] })
)
Target "Test" (fun _ ->
DotNetCli.Test (fun p ->
{ p with
Configuration = "Release"
Project = "src\\Tests\\HealthNet.Tests"
AdditionalArgs = [ "--no-build"
"--no-restore" ]})
)
Target "CreatePackage" (fun _ ->
// Copy all the package files into a package folder
for projFile in !! (srcDir @@ "/*/*.csproj") do
let projectName = (System.IO.FileInfo projFile).Directory.Name
DotNetCli.Pack(fun p ->
{ p with
Configuration = "Release"
Project = projFile
OutputPath = "../../bin"
//VersionSuffix = "dotnet-core-beta"
AdditionalArgs = [ "--no-build"
"--no-restore"
"/p:Authors=bronumski"
"/p:PackageIconUrl=https://raw.githubusercontent.com/bronumski/HealthNet/release/" + buildVersion + "/src/" + projectName + "/icon.png"
"/p:PackageProjectUrl=https://github.com/bronumski/HealthNet"
"/p:PackageLicenseUrl=https://raw.githubusercontent.com/bronumski/HealthNet/release/" + buildVersion + "/LICENSE"
"/p:RepositoryUrl=git@github.com:bronumski/HealthNet.git"
"/p:Description=HealthNet"
"/p:Copyright=\"Copyright HealthNet " + System.DateTime.Now.Year.ToString() + "\""
"/p:VersionPrefix=" + buildVersion ] })
)
Target "Default" (fun _ ->
trace "Build Complete"
)
"Clean"
==> "Build"
==> "Test"
==> "CreatePackage"
==> "Default"
RunTargetOrDefault "Default"