-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.fsx
104 lines (79 loc) · 3.12 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
#r "packages/build/Fake/tools/FakeLib.dll"
#r "System.Xml.Linq"
open System
open System.Xml.Linq
open Fake
open NuGetHelper
open Fake.Git
open Fake.Testing
let title = "FsUno.Prod"
let authors = [ "Jérémie Chassaing" ]
let githubLink = "https://github.com/thinkbeforecoding/FsUno.Prod/"
let projns = XNamespace.op_Implicit "http://schemas.microsoft.com/developer/msbuild/2003"
let xn = XName.op_Implicit
let journeyOutDir = "bin\Journey"
Target "CleanJourney" <| fun _ ->
CleanDir "bin\Journey"
Target "Journey" <| fun _ ->
let template = @"FsUno.Journey\Template\template-project.html"
let journeyProject = @"FsUno.Journey\FsUno.Journey.fsproj"
let index =
let project = loadProject journeyProject
project.Descendants(projns + "None").Attributes(xn "Include")
|> Seq.map (fun attr -> attr.Value)
|> Seq.filter (fun f -> ext f = ".fsx")
|> Seq.map (fun file ->
let name = fileNameWithoutExt file
let uri = Uri.EscapeUriString name + ".html"
name, uri)
|> Seq.skip 1
|> Seq.toList
let tableOfContent =
("The Journey", "index.html" ) :: index
|> List.map (fun (name, uri) -> sprintf """<li><a href="%s">%s</a></li>""" uri name )
|> separated "\n "
let projInfo =
[ "page-description", title
"page-author", separated ", " authors
"project-author", separated ", " authors
"github-link", githubLink
"project-github", "https://github.com/fsharp/fake"
"root", "http://thinkbeforecoding.github.io/FsUno.Prod"
"project-name", title
"table-of-content", tableOfContent]
FSharpFormatting.toolPath <- @"packages\FSharp.Formatting.CommandTool\tools\fsformatting.exe"
FSharpFormatting.CreateDocs "FsUno.Journey" journeyOutDir template projInfo
let sourceDir = directoryInfo @"packages\FSharp.Formatting.CommandTool\styles\"
let outDir = directoryInfo (journeyOutDir @@ "content")
copyRecursive sourceDir outDir true
|> ignore
Target "ReleaseJourney" <| fun _ ->
let pages = "bin/gh-pages"
CleanDir pages
cloneSingleBranch "" "[email protected]:thinkbeforecoding/FsUno.Prod.git" "gh-pages" pages
fullclean pages
CopyRecursive journeyOutDir pages true |> printfn "%A"
StageAll pages
Commit pages "Update generated documentation"
Branches.push pages
Target "CleanBuild" <| fun _ ->
CleanDir "bin\Release"
Target "Build" <| fun _ ->
!! "FSUno/*.fsproj"
++ "FSUno.Domain/*.fsproj"
++ "FsUno.Persistence.EventStore/*.fsproj"
|> MSBuildRelease @"bin\Release" "Rebuild"
|> Log "MsBuild"
Target "BuildTests" <| fun _ ->
!! "FSUno.Tests/*.fsproj"
|> MSBuildRelease @"bin\tests" "Rebuild"
|> Log "MsBuild"
Target "Tests" <| fun _ ->
!! "bin/tests/*.Tests.dll"
|> xUnit2 (fun p -> { p with ToolPath = "packages/test/xunit.runner.console/tools/xunit.console.exe" })
Target "All" DoNothing
"CleanBuild" ==> "Build" ==> "BuildTests" ==> "Tests"
"CleanJourney" ==> "Journey" ==> "ReleaseJourney"
"Tests" ==> "All"
"Journey" ==> "All"
RunTargetOrDefault "All"