-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.fsx
131 lines (107 loc) · 3.75 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// include Fake libs
#I @"packages\FAKE\tools\"
#r @"packages\FAKE\tools\FakeLib.dll"
open Fake
open Fake.Testing.NUnit3
open System
open System.IO
open System.Text.RegularExpressions
open Fake.Paket
open Fake.Git
open Fake.OpenCoverHelper
open Fake.ReportGeneratorHelper
open Fake.FileHelper
//Project config
let projectName = "Xrm.Oss.XTL"
let projectDescription = "A domain specific language for templating inside Dynamics CRM"
let authors = ["Florian Kroenert"]
// Directories
let buildDir = @".\build\"
let pluginBuildDir = buildDir + @"plugin\"
let testDir = @".\test\"
let deployDir = @".\Publish\"
let pluginDeployDir = deployDir + @"plugin"
let nugetDir = @".\nuget\"
let packagesDir = @".\packages\"
let nUnitPath = "packages" @@ "nunit.consolerunner" @@ "tools" @@ "nunit3-console.exe"
let sha = Git.Information.getCurrentHash()
// version info
let major = "3"
let minor = "9"
let patch = "9"
// Follow SemVer scheme: http://semver.org/
let asmVersion = major + "." + minor + "." + patch
let asmFileVersion = asmVersion + "+" + sha
let pluginVersion = sprintf "1.0.%s" buildVersion
// Targets
Target "Clean" (fun _ ->
CleanDirs [buildDir; testDir; deployDir; nugetDir]
)
Target "AssemblyInfo" (fun _ ->
BulkReplaceAssemblyInfoVersions "src" (fun f ->
{f with
AssemblyVersion = pluginVersion
AssemblyInformationalVersion = pluginVersion
AssemblyFileVersion = pluginVersion
})
)
Target "BuildPlugin" (fun _ ->
!! @"src\plugin\Xrm.Oss.XTL.Templating\*.csproj"
|> MSBuildRelease pluginBuildDir "Build"
|> Log "Build-Output: "
)
Target "BuildTest" (fun _ ->
!! @"src\test\**\*.csproj"
|> MSBuildDebug testDir "Build"
|> Log "Build Log: "
)
Target "NUnit" (fun _ ->
let testFiles = !!(testDir @@ @"\**\*.Tests.dll")
if testFiles.Includes.Length <> 0 then
testFiles
|> NUnit3 (fun test ->
{test with
ShadowCopy = false;
ToolPath = nUnitPath;})
)
Target "Publish" (fun _ ->
CreateDir pluginDeployDir
!! (pluginBuildDir @@ @"*.*")
|> CopyTo pluginDeployDir
)
Target "CodeCoverage" (fun _ ->
OpenCover (fun p -> { p with
TestRunnerExePath = nUnitPath
ExePath ="packages" @@ "OpenCover" @@ "tools" @@ "OpenCover.Console.exe"
Register = RegisterType.RegisterUser
WorkingDir = (testDir)
Filter = "+[Xrm.Oss*]Xrm.Oss.XTL.* -[*.Tests*]*"
Output = "../coverage.xml"
}) "Xrm.Oss.XTL.Interpreter.Tests.dll Xrm.Oss.XTL.Templating.Tests.dll"
)
Target "ReportCodeCoverage" (fun _ ->
ReportGenerator (fun p -> { p with
ExePath = "packages" @@ "ReportGenerator" @@ "tools" @@ "net47" @@ "ReportGenerator.exe"
WorkingDir = (testDir)
TargetDir = "../reports"
ReportTypes = [ReportGeneratorReportType.Html; ReportGeneratorReportType.Badges ]
}) [ "..\coverage.xml" ]
)
Target "CreateNuget" (fun _ ->
Pack (fun p ->
{p with
Version = asmVersion
})
)
// Dependencies
"Clean"
=?> ("AssemblyInfo", not isLocalBuild )
==> "BuildPlugin"
==> "BuildTest"
==> "NUnit"
==> "CodeCoverage"
==> "ReportCodeCoverage"
==> "Publish"
==> "CreateNuget"
// start build
RunTargetOrDefault "Publish"