This repository has been archived by the owner on May 6, 2020. It is now read-only.
forked from IrcDotNet/IrcDotNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildConfig.fsx
144 lines (117 loc) · 5.12 KB
/
buildConfig.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
132
133
134
135
136
137
138
139
140
141
142
143
144
// ----------------------------------------------------------------------------
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
// ----------------------------------------------------------------------------
(*
This file handles the complete build process of RazorEngine
The first step is handled in build.sh and build.cmd by bootstrapping a NuGet.exe and
executing NuGet to resolve all build dependencies (dependencies required for the build to work, for example FAKE)
The secound step is executing this file which resolves all dependencies, builds the solution and executes all unit tests
*)
// Supended until FAKE supports custom mono parameters
#I @".nuget/Build/FAKE/tools/" // FAKE
#r @"FakeLib.dll" //FAKE
open System.Collections.Generic
open System.IO
open Fake
open Fake.Git
open Fake.FSharpFormatting
open AssemblyInfoFile
// properties
let projectName = "IRC.NET"
let copyrightNotice = "IRC.NET is copyright © 2011-2015 Alex Regueiro"
let projectSummary = "A complete IRC (Internet Relay Chat) client library for the .NET Framework"
let projectDescription = "IRC.NET aims to provide a complete and efficient implementation of the protocol as described in RFCs 1459 and 2812, as well as de-facto modern features of the protocol."
let authors = ["Alex Regueiro"]
let page_author = "Matthias Dittrich"
let mail = "alex@noldorin.com"
let version = "0.5.0"
let version_nuget = "0.5.0"
let commitHash = Information.getCurrentSHA1(".")
//let buildTargets = environVarOrDefault "BUILDTARGETS" ""
//let buildPlatform = environVarOrDefault "BUILDPLATFORM" "MONO"
let buildDir = "./build/"
let releaseDir = "./release/"
let outLibDir = "./release/lib/"
let outDocDir = "./release/documentation/"
let docTemplatesDir = "./doc/templates/"
let testDir = "./test/"
let nugetDir = "./.nuget/"
let packageDir = "./.nuget/packages"
let github_user = "alexreg"
let github_project = "IrcDotNet"
let nuget_url = "https://www.nuget.org/packages/IrcDotNet/"
let tags = "communication networking irc ctcp"
let buildMode = "Release" // if isMono then "Release" else "Debug"
// Where to look for *.cshtml templates (in this order)
let layoutRoots =
[ docTemplatesDir;
docTemplatesDir @@ "reference" ]
if isMono then
monoArguments <- "--runtime=v4.0 --debug"
//monoArguments <- "--runtime=v4.0"
let github_url = sprintf "https://github.com/%s/%s" github_user github_project
// Ensure the ./src/.nuget/NuGet.exe file exists (required by xbuild)
let nuget = findToolInSubPath "NuGet.exe" "./.nuget/Build/NuGet.CommandLine/tools/NuGet.exe"
System.IO.File.Copy(nuget, "./src/.nuget/NuGet.exe", true)
// Read release notes document
let release = ReleaseNotesHelper.parseReleaseNotes (File.ReadLines "doc/ReleaseNotes.md")
let MyTarget name body =
Target name body
Target (sprintf "%s_single" name) body
type BuildParams =
{
CustomBuildName : string
}
let buildApp (buildParams:BuildParams) =
let buildDir = buildDir @@ buildParams.CustomBuildName
CleanDirs [ buildDir ]
// build app
let files = !! "src/source/**/*.csproj"
files
|> MSBuild buildDir "Build"
[ "Configuration", buildMode
"CustomBuildName", buildParams.CustomBuildName ]
|> Log "AppBuild-Output: "
let buildTests (buildParams:BuildParams) =
let testDir = testDir @@ buildParams.CustomBuildName
CleanDirs [ testDir ]
// build tests
let files = !! "src/test/**/Test.*.csproj"
files
|> MSBuild testDir "Build"
[ "Configuration", buildMode
"CustomBuildName", buildParams.CustomBuildName ]
|> Log "TestBuild-Output: "
let runTests (buildParams:BuildParams) =
let testDir = testDir @@ buildParams.CustomBuildName
let logs = System.IO.Path.Combine(testDir, "logs")
System.IO.Directory.CreateDirectory(logs) |> ignore
let files =
!! (testDir + "/Test.*.dll")
files
|> NUnit (fun p ->
{p with
//NUnitParams.WorkingDir = working
//ExcludeCategory = if isMono then "VBNET" else ""
ProcessModel =
// Because the default nunit-console.exe.config doesn't use .net 4...
if isMono then NUnitProcessModel.SingleProcessModel else NUnitProcessModel.DefaultProcessModel
WorkingDir = testDir
StopOnError = true
TimeOut = System.TimeSpan.FromMinutes 30.0
Framework = "4.0"
DisableShadowCopy = true;
OutputFile = "logs/TestResults.xml" })
let net40Params = { CustomBuildName = "net40" }
let net45Params = { CustomBuildName = "net45" }
let sl40Params = { CustomBuildName = "sl40" }
// Documentation
let buildDocumentationTarget target =
trace (sprintf "Building documentation (%s), this could take some time, please wait..." target)
let b, s = executeFSI "." "generateDocs.fsx" ["target", target]
for l in s do
(if l.IsError then traceError else trace) (sprintf "DOCS: %s" l.Message)
if not b then
failwith "documentation failed"
()