-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.fsx
109 lines (89 loc) · 2.82 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
100
101
102
103
104
105
106
107
108
109
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open Fake.AssemblyInfoHelper
open Fake.Git
open Fake.DotCover
let binDir = "./bin"
let srcDir = "./src"
let testDlls = srcDir + "/**/bin/Release/*Tests.dll"
let solutionFile = srcDir + "/CrossCutting.sln"
let packageDir = "packages"
let versionMajorMinor = "0.2"
let version = versionMajorMinor + ".0"
let commitHash = Information.getCurrentSHA1("")
let versionMacroBuild =
match buildServer with
| AppVeyor -> (appVeyorBuildVersion.Replace("0.2.", ""))
| _ -> "0"
let buildVersion = versionMajorMinor + "." + versionMacroBuild
Target "Clean" (fun _ ->
CleanDirs []
DeleteDir binDir
CreateDir binDir
)
Target "Version" (fun _ ->
CreateCSharpAssemblyInfo (srcDir + "/VersionInfo.cs")
[Attribute.Version version
Attribute.FileVersion buildVersion
Attribute.Metadata("githash", commitHash)]
match buildServer with
| _ -> ()
)
Target "RestorePackages" (fun _ ->
solutionFile
|> RestoreMSSolutionPackages (fun p ->
{ p with
OutputPath = packageDir
ToolPath = "tools/Nuget/nuget.exe"
Retries = 4 }))
Target "Build" (fun _ ->
!! solutionFile
|> MSBuildReleaseExt "" [("Configuration", "Release")] "Build"
|> Log "AppBuild-Output: "
)
Target "Test" (fun _ ->
!! (testDlls)
|> DotCoverNUnit
(fun dotCoverOptions ->
{ dotCoverOptions with
ErrorLevel = DontFailBuild
Filters = "+:module=CrossCutting.*;class=*;function=*;-:module=*Test*;"
Output = binDir + "/DotCover.snapshot" })
(fun nUnitOptions ->
{ nUnitOptions with
ErrorLevel = DontFailBuild
OutputFile = binDir + "/TestResult.xml"
DisableShadowCopy = true })
DotCoverReport
(fun p ->
{ p with
Source = binDir + "/DotCover.snapshot"
Output = binDir + "/DotCoverReport.html"
ReportType = DotCoverReportType.Html }) false
)
Target "CreatePackage" (fun _ ->
// Copy all the package files into a package folder
for nuspec in !! "src/**/*.nuspec" do
let projFileName = nuspec.Replace(".nuspec", ".csproj")
NuGetPack (fun p ->
{p with
OutputPath = binDir
WorkingDir = binDir
Version = buildVersion
IncludeReferencedProjects = true
Properties = [ ("configuration", "release") ]
})
projFileName
)
Target "Default" (fun _ ->
trace "Build Complete"
)
"Clean"
==> "Version"
==> "RestorePackages"
==> "Build"
==> "Test"
==> "CreatePackage"
==> "Default"
RunTargetOrDefault "Default"