forked from joaomatossilva/DateTimeExtensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.fsx
126 lines (103 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
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
// include Fake lib
#r @".tools\FAKE\tools\FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
RestorePackages()
let authors = ["kappy"]
// project name and description
let projectName = "DateTimeExtensions"
let projectDescription = "Merge of extensions for System.DateTime like localized working days with holidays calculations and natural time date difference"
let projectSummary = projectDescription // TODO: write a summary
// Directories
let buildDir = @".\.build\"
let testDir = @".\.test\"
let deployDir = @".\.deploy\"
// tools
//let nunitVersion = GetPackageVersion packagesDir "NUnit.Runners"
let nunitPath = @".tools\NUnit.Runners\"
let fxCopRoot = @".\Tools\FxCop\FxCopCmd.exe"
let buildMode = getBuildParamOrDefault "buildMode" "Release"
// version info
let buildNumber =
match buildServer with
| TeamCity -> buildVersion
| _ -> "0"
let version = "3.6.0." + buildNumber
// Targets
Target "Clean" (fun _ ->
CleanDirs [buildDir; testDir; deployDir;]
)
Target "WriteAssemblyInfo" (fun _ ->
CreateCSharpAssemblyInfo "./DateTimeExtensions/Properties/AssemblyInfo.cs"
[Attribute.Title projectName
Attribute.Description projectDescription
Attribute.Product projectName
Attribute.Version version
Attribute.FileVersion version]
)
Target "CompileApp" (fun _ ->
!! @"DateTimeExtensions\**\*.csproj"
|> MSBuildRelease buildDir "Build"
|> Log "AppBuild-Output: "
)
Target "CompileTest" (fun _ ->
!! @"DateTimeExtensions.Tests\**\*.csproj"
|> MSBuildDebug testDir "Build"
|> Log "TestBuild-Output: "
)
Target "NUnitTest" (fun _ ->
!! (testDir + @"\**\*Tests.dll")
|> NUnit (fun p ->
{p with
ToolPath = nunitPath;
DisableShadowCopy = false;
WorkingDir = testDir;
OutputFile = @"TestResults.xml"})
)
Target "FxCop" (fun _ ->
!! (buildDir + @"\**\*.dll")
++ (buildDir + @"\**\*.exe")
|> Scan
|> FxCop (fun p ->
{p with
ReportFileName = testDir + "FXCopResults.xml";
ToolPath = fxCopRoot})
)
Target "Zip" (fun _ ->
!! (buildDir + "\**\*.*")
-- "*.zip"
|> Scan
|> Zip buildDir (deployDir + "Calculator." + version + ".zip")
)
Target "CreatePackage" (fun _ ->
//CopyDir deployDir buildDir allFiles
NuGet (fun p ->
{p with
Authors = authors
Project = projectName
Description = projectDescription
OutputPath = deployDir
Summary = projectSummary
WorkingDir = buildDir
Version = version
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" }) "./DateTimeExtensions\DateTimeExtensions.nuspec"
)
Target "Default" (fun _ ->
trace "Built!"
)
Target "Release" (fun _ ->
trace "Release Target! You've nailed it"
)
// Dependencies
"Clean"
==> "WriteAssemblyInfo"
==> "CompileApp"
==> "CompileTest"
//==> "FxCop"
==> "NUnitTest"
==> "Default"
==> "CreatePackage"
==> "Release"
// start build
RunTargetOrDefault "Default"