forked from AutoFixture/AutoFixture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.fsx
164 lines (131 loc) · 7 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#r @"packages/FAKE.4.19.0/tools/FakeLib.dll"
open Fake
open Fake.Testing
open System
let releaseFolder = "Release"
let nunitToolsFolder = "Packages/NUnit.Runners.2.6.2/tools"
let nuGetOutputFolder = "NuGetPackages"
let solutionsToBuild = !! "Src/*.sln"
let processorArchitecture = environVar "PROCESSOR_ARCHITECTURE"
let build target configuration =
let keyFile =
match getBuildParam "signkey" with
| "" -> []
| x -> [ "AssemblyOriginatorKeyFile", FullName x ]
let properties = [ "Configuration", configuration ] @ keyFile
solutionsToBuild
|> MSBuild "" target properties
|> ignore
let clean = build "Clean"
let rebuild = build "Rebuild"
Target "CleanAll" (fun _ -> ())
Target "CleanVerify" (fun _ -> clean "Verify")
Target "CleanRelease" (fun _ -> clean "Release")
Target "CleanReleaseFolder" (fun _ -> CleanDir releaseFolder)
Target "Verify" (fun _ -> rebuild "Verify")
Target "BuildOnly" (fun _ -> rebuild "Release")
Target "TestOnly" (fun _ ->
let configuration = getBuildParamOrDefault "Configuration" "Release"
let parallelizeTests = getBuildParamOrDefault "ParallelizeTests" "False" |> Convert.ToBoolean
let maxParallelThreads = getBuildParamOrDefault "MaxParallelThreads" "0" |> Convert.ToInt32
let parallelMode = if parallelizeTests then ParallelMode.All else ParallelMode.NoParallelization
let maxThreads = if maxParallelThreads = 0 then CollectionConcurrencyMode.Default else CollectionConcurrencyMode.MaxThreads(maxParallelThreads)
let testAssemblies = !! (sprintf "Src/*Test/bin/%s/*Test.dll" configuration)
-- (sprintf "Src/AutoFixture.NUnit*.*Test/bin/%s/*Test.dll" configuration)
testAssemblies
|> xUnit2 (fun p -> { p with Parallel = parallelMode
MaxThreads = maxThreads })
let nunit2TestAssemblies = !! (sprintf "Src/AutoFixture.NUnit2.*Test/bin/%s/*Test.dll" configuration)
nunit2TestAssemblies
|> NUnit (fun p -> { p with StopOnError = false
OutputFile = "NUnit2TestResult.xml" })
let nunit3TestAssemblies = !! (sprintf "Src/AutoFixture.NUnit3.UnitTest/bin/%s/Ploeh.AutoFixture.NUnit3.UnitTest.dll" configuration)
nunit3TestAssemblies
|> NUnit3 (fun p -> { p with StopOnError = false
ResultSpecs = ["NUnit3TestResult.xml;format=nunit2"] })
)
Target "BuildAndTestOnly" (fun _ -> ())
Target "Build" (fun _ -> ())
Target "Test" (fun _ -> ())
Target "CopyToReleaseFolder" (fun _ ->
let buildOutput = [
"Src/AutoFixture/bin/Release/Ploeh.AutoFixture.dll";
"Src/AutoFixture/bin/Release/Ploeh.AutoFixture.pdb";
"Src/AutoFixture/bin/Release/Ploeh.AutoFixture.XML";
"Src/SemanticComparison/bin/Release/Ploeh.SemanticComparison.dll";
"Src/SemanticComparison/bin/Release/Ploeh.SemanticComparison.pdb";
"Src/SemanticComparison/bin/Release/Ploeh.SemanticComparison.XML";
"Src/AutoMoq/bin/Release/Ploeh.AutoFixture.AutoMoq.dll";
"Src/AutoMoq/bin/Release/Ploeh.AutoFixture.AutoMoq.pdb";
"Src/AutoMoq/bin/Release/Ploeh.AutoFixture.AutoMoq.XML";
"Src/AutoRhinoMock/bin/Release/Ploeh.AutoFixture.AutoRhinoMock.dll";
"Src/AutoRhinoMock/bin/Release/Ploeh.AutoFixture.AutoRhinoMock.pdb";
"Src/AutoRhinoMock/bin/Release/Ploeh.AutoFixture.AutoRhinoMock.XML";
"Src/AutoFakeItEasy/bin/Release/Ploeh.AutoFixture.AutoFakeItEasy.dll";
"Src/AutoFakeItEasy/bin/Release/Ploeh.AutoFixture.AutoFakeItEasy.pdb";
"Src/AutoFakeItEasy/bin/Release/Ploeh.AutoFixture.AutoFakeItEasy.XML";
"Src/AutoNSubstitute/bin/Release/Ploeh.AutoFixture.AutoNSubstitute.dll";
"Src/AutoNSubstitute/bin/Release/Ploeh.AutoFixture.AutoNSubstitute.pdb";
"Src/AutoNSubstitute/bin/Release/Ploeh.AutoFixture.AutoNSubstitute.XML";
"Src/AutoFoq/bin/Release/Ploeh.AutoFixture.AutoFoq.dll";
"Src/AutoFoq/bin/Release/Ploeh.AutoFixture.AutoFoq.pdb";
"Src/AutoFoq/bin/Release/Ploeh.AutoFixture.AutoFoq.XML";
"Src/AutoFixture.xUnit.net/bin/Release/Ploeh.AutoFixture.Xunit.dll";
"Src/AutoFixture.xUnit.net/bin/Release/Ploeh.AutoFixture.Xunit.pdb";
"Src/AutoFixture.xUnit.net/bin/Release/Ploeh.AutoFixture.Xunit.XML";
"Src/AutoFixture.xUnit.net2/bin/Release/Ploeh.AutoFixture.Xunit2.dll";
"Src/AutoFixture.xUnit.net2/bin/Release/Ploeh.AutoFixture.Xunit2.pdb";
"Src/AutoFixture.xUnit.net2/bin/Release/Ploeh.AutoFixture.Xunit2.XML";
"Src/AutoFixture.NUnit2/bin/Release/Ploeh.AutoFixture.NUnit2.dll";
"Src/AutoFixture.NUnit2/bin/Release/Ploeh.AutoFixture.NUnit2.pdb";
"Src/AutoFixture.NUnit2/bin/Release/Ploeh.AutoFixture.NUnit2.XML";
"Src/AutoFixture.NUnit2/bin/Release/Ploeh.AutoFixture.NUnit2.Addins.dll";
"Src/AutoFixture.NUnit2/bin/Release/Ploeh.AutoFixture.NUnit2.Addins.pdb";
"Src/AutoFixture.NUnit2/bin/Release/Ploeh.AutoFixture.NUnit2.Addins.XML";
"Src/AutoFixture.NUnit3/bin/Release/Ploeh.AutoFixture.NUnit3.dll";
"Src/AutoFixture.NUnit3/bin/Release/Ploeh.AutoFixture.NUnit3.pdb";
"Src/AutoFixture.NUnit3/bin/Release/Ploeh.AutoFixture.NUnit3.XML";
"Src/Idioms/bin/Release/Ploeh.AutoFixture.Idioms.dll";
"Src/Idioms/bin/Release/Ploeh.AutoFixture.Idioms.pdb";
"Src/Idioms/bin/Release/Ploeh.AutoFixture.Idioms.XML";
"Src/Idioms.FsCheck/bin/Release/Ploeh.AutoFixture.Idioms.FsCheck.dll";
"Src/Idioms.FsCheck/bin/Release/Ploeh.AutoFixture.Idioms.FsCheck.pdb";
"Src/Idioms.FsCheck/bin/Release/Ploeh.AutoFixture.Idioms.FsCheck.XML";
nunitToolsFolder @@ "lib/nunit.core.interfaces.dll"
]
let nuGetPackageScripts = !! "NuGet/*.ps1" ++ "NuGet/*.txt" ++ "NuGet/*.pp" |> List.ofSeq
let releaseFiles = buildOutput @ nuGetPackageScripts
releaseFiles
|> CopyFiles releaseFolder
)
Target "CleanNuGetPackages" (fun _ ->
CleanDir nuGetOutputFolder
)
Target "NuGetPack" (fun _ ->
let version = "Src/AutoFixture/bin/Release/Ploeh.AutoFixture.dll"
|> GetAssemblyVersion
|> (fun v -> sprintf "%i.%i.%i" v.Major v.Minor v.Build)
let nuSpecFiles = !! "NuGet/*.nuspec"
nuSpecFiles
|> Seq.iter (fun f -> NuGet (fun p -> { p with Version = version
WorkingDir = releaseFolder
OutputPath = nuGetOutputFolder
SymbolPackage = NugetSymbolPackage.Nuspec }) f)
)
Target "CompleteBuild" (fun _ -> ())
"CleanVerify" ==> "CleanAll"
"CleanRelease" ==> "CleanAll"
"CleanReleaseFolder" ==> "Verify"
"CleanAll" ==> "Verify"
"Verify" ==> "Build"
"BuildOnly" ==> "Build"
"Build" ==> "Test"
"TestOnly" ==> "Test"
"BuildOnly" ==> "TestOnly"
"BuildOnly" ==> "BuildAndTestOnly"
"TestOnly" ==> "BuildAndTestOnly"
"Test" ==> "CopyToReleaseFolder"
"CleanNuGetPackages" ==> "NuGetPack"
"CopyToReleaseFolder" ==> "NuGetPack"
"NuGetPack" ==> "CompleteBuild"
RunTargetOrDefault "CompleteBuild"