-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.fsx
90 lines (77 loc) · 2.74 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
open Fake.Core
open Fake.DotNet
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Core.TargetOperators
open Fake.DotNet.NuGet
open System.Reflection
let configuration = "Release"
Target.create "Clean" (fun _ ->
!! "src/**/bin"
++ "src/**/obj"
|> Shell.cleanDirs
)
let release = Fake.Core.ReleaseNotes.load "RELEASE_NOTES.md"
let project = "fss"
let summary = "F# server and db wrapper"
Target.create "AssemblyInfo" (fun _ ->
AssemblyInfoFile.createFSharpWithConfig "src/Common/AssemblyInfo.fs"
[ AssemblyInfo.Title project
AssemblyInfo.Product project
AssemblyInfo.Description summary
AssemblyInfo.Version release.AssemblyVersion
AssemblyInfo.FileVersion release.AssemblyVersion]
(AssemblyInfoFileConfig(true,false,"Fss.AssemblyInfo"))
)
Target.create "Pack" (fun _ ->
!! "src/**/*.*proj"
|> Seq.iter (fun proj ->
let folder = System.IO.Path.GetDirectoryName proj
printfn "Packing %s" proj
Fake.DotNet.Paket.pack (fun p ->
{ p with
ToolPath = ".tool/paket.exe"
WorkingDir = folder
BuildConfig = configuration
Version = release.NugetVersion
ReleaseNotes = System.String.Join("\n",release.Notes) // Fake.Core.String release.Notes
OutputPath = "."
})
) // end iteration over projects
) // end pack target
Target.create "Build" (fun _ ->
!! "src/**/*.*proj"
|> Seq.iter (DotNet.build id)
)
// Copies binaries from default VS location to expected bin folder
// But keeps a subdirectory structure for each project in the
// src folder to support multiple project outputs
Target.create "CopyBinaries" (fun _ ->
!! "src/**/*.??proj"
-- "src/**/*.shproj"
|> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f) </> "bin" </> configuration, "bin" </> (System.IO.Path.GetFileNameWithoutExtension f)))
|> Seq.iter (fun (fromDir, toDir) -> Fake.IO.Shell.copyDir toDir fromDir (fun _ -> true))
)
Target.create "RunTests" (fun _ ->
let testFolders = !! "tests/*/" |> Array.ofSeq
printfn "Found test folders : %A" testFolders
for test in testFolders do
DotNet.test
(fun p ->
{p with
Configuration=DotNet.BuildConfiguration.Release
Common = { DotNet.Options.Create() with WorkingDirectory = test}
}
)
test
)
Target.create "All" ignore
"Clean"
==> "AssemblyInfo"
==> "Build"
==> "RunTests"
==> "Pack"
==> "CopyBinaries"
==> "All"
Target.runOrDefault "All"