-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
123 lines (104 loc) · 3.45 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
#I "tools/FAKE"
#r "FakeLib.dll"
open Fake
open Fake.Git
open System.Linq
open System.Text.RegularExpressions
(* properties *)
let authors = ["Steffen Forkmann"]
let projectName = "FSharp.Testing"
let description = "Some extensions which help to make F# code testable from C# test projects."
let copyright = "Copyright - FSharp.Testing 2011"
let version = if isLocalBuild then "0.0.0.1" else buildVersion
(* Directories *)
let buildDir = @".\Build\"
let docsDir = buildDir + @"Documentation\"
let testOutputDir = buildDir + @"Specs\"
let nugetDir = buildDir + @"NuGet\"
let testDir = buildDir
let deployDir = @".\Release\"
let nugetDocsDir = nugetDir + @"docs\"
let nugetLibDir = nugetDir + @"lib\"
(* files *)
let appReferences = !! @".\Source\**\*.csproj"
(* Targets *)
Target "Clean" (fun _ -> CleanDirs [buildDir; testDir; deployDir; docsDir; testOutputDir] )
Target "BuildApp" (fun _ ->
AssemblyInfo
(fun p ->
{p with
CodeLanguage = CSharp;
AssemblyVersion = version;
AssemblyTitle = projectName;
AssemblyDescription = description;
AssemblyCopyright = copyright;
Guid = "81DEA79A-B464-411C-B861-D2716DBD3B30";
OutputFileName = @".\Source\GlobalAssemblyInfo.cs"})
appReferences
|> MSBuildRelease buildDir "Build"
|> Log "AppBuild-Output: "
)
Target "Test" (fun _ ->
ActivateFinalTarget "DeployTestResults"
!+ (testDir + "/*.Specs.dll")
++ (testDir + "/*.Examples.dll")
|> Scan
|> MSpec (fun p ->
{p with
HtmlOutputDir = testOutputDir})
)
FinalTarget "DeployTestResults" (fun () ->
!+ (testOutputDir + "\**\*.*")
|> Scan
|> Zip testOutputDir (sprintf "%sMSpecResults.zip" deployDir)
)
Target "GenerateDocumentation" (fun _ ->
!+ (buildDir + "FSharp.Testing.dll")
|> Scan
|> Docu (fun p ->
{p with
ToolPath = "./tools/docu/docu.exe"
TemplatesPath = "./tools/docu/templates"
OutputPath = docsDir })
)
Target "ZipDocumentation" (fun _ ->
!! (docsDir + "/**/*.*")
|> Zip docsDir (deployDir + sprintf "Documentation-%s.zip" version)
)
Target "BuildZip" (fun _ ->
!+ (buildDir + "/**/*.*")
-- "*.zip"
-- "**/*.Specs.*"
|> Scan
|> Zip buildDir (deployDir + sprintf "%s-%s.zip" projectName version)
)
Target "BuildNuGet" (fun _ ->
CleanDirs [nugetDir; nugetLibDir; nugetDocsDir]
XCopy docsDir nugetDocsDir
[buildDir + "FSharp.Testing.dll"]
|> CopyTo nugetLibDir
NuGet (fun p ->
{p with
Authors = authors
Project = projectName
Version = version
OutputPath = nugetDir
Description = description
Dependencies = ["FSharp.Core","2.0.0.0"]
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" })
"fsharp.testing.nuspec"
[nugetDir + sprintf "FSharp.Testing.%s.nupkg" version]
|> CopyTo deployDir
)
Target "Default" DoNothing
Target "Deploy" DoNothing
// Dependencies
"BuildApp" <== ["Clean"]
"Test" <== ["BuildApp"]
"BuildZip" <== ["Test"]
"ZipDocumentation" <== ["GenerateDocumentation"]
"Deploy" <== ["BuildZip"; "ZipDocumentation"; "BuildNuGet"]
"Default" <== ["Deploy"]
// start build
Run <| getBuildParamOrDefault "target" "Default"