/
build.fsx
95 lines (80 loc) · 2.54 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
#I @"packages/Build/FAKE/tools/"
#r @"FakeLib.dll"
#r "System.Xml.Linq"
open System
open Fake
open Fake.AssemblyInfoFile
let version = "1.0.3.0"
let assemblyVersion = "1.0.0.0"
type Package = {
Name: string
Author: string
Description: string
Sign: bool
}
let vsProjProps = [
("VersionSuffix", "")
("VersionPrefix", version)
]
module Pkg=
let build (pkg:Package) =
MSBuildReleaseExt null vsProjProps "pack" ["./"+pkg.Name]
|> Log "Package-Output: "
let packages =
[
{ Package.Name = "Fuchu"
Author = "Mauricio Scheffer"
Description = "Functional test library"
Sign = true}
{ Package.Name = "Fuchu.MbUnit"
Author = "Mauricio Scheffer"
Description = "Converts Fuchu tests to MbUnit tests"
Sign = true}
{ Package.Name = "Fuchu.FsCheck"
Author = "Mauricio Scheffer"
Description = "Integrates Fuchu with FsCheck"
Sign = false}
{ Package.Name = "Fuchu.PerfUtil"
Author = "Henrik Feldt"
Description = "Integrates Fuchu with PerfUtil"
Sign = false}
]
Target "BuildSolution" (fun _ ->
MSBuildRelease null "Rebuild" ["./Fuchu.sln"]
|> Log "AppBuild-Output: "
)
Target "NuGet" <| fun _ ->
List.iter Pkg.build packages
Target "AssemblyInfo" <| fun _ ->
let asmInfo (p: Package) =
let attributes = [
Attribute.Version assemblyVersion
Attribute.FileVersion version
Attribute.Title p.Name
Attribute.Product p.Name
Attribute.Description p.Description
Attribute.Copyright (sprintf "Copyright %s %d" p.Author DateTime.Now.Year)
]
let attributes =
if p.Sign
then (Attribute.KeyFile "../Fuchu.snk")::attributes
else attributes
CreateFSharpAssemblyInfo (p.Name @@ "AssemblyInfo.fs") attributes
List.iter asmInfo packages
Target "Test" <| fun _ ->
let errorCode =
[
"Fuchu.Tests"
"Fuchu.CSharpTests"
]
|> Seq.map (fun t -> t @@ "bin" @@ "Release" @@ (t + ".exe"))
|> Seq.map (fun p -> if not isMono then p,null else "mono",p)
|> Seq.map (fun (p,a) -> asyncShellExec { defaultParams with Program = p; CommandLine = a })
|> Async.Parallel
|> Async.RunSynchronously
|> Array.sum
if errorCode <> 0 then failwith "Error in tests"
"BuildSolution" <== ["AssemblyInfo"]
"Test" <== ["BuildSolution"]
"NuGet" <== ["Test"]
RunTargetOrDefault "NuGet"