1
- // --------------------------------------------------------------------------------------
1
+ // --------------------------------------------------------------------------------------
2
2
// Builds the documentation from `.fsx` and `.md` files in the 'docs/content' directory
3
3
// (the generated documentation is stored in the 'docs/output' directory)
4
4
// --------------------------------------------------------------------------------------
@@ -22,22 +22,23 @@ let info =
22
22
// For typical project, no changes are needed below
23
23
// --------------------------------------------------------------------------------------
24
24
25
- #load " ../../packages/FSharp.Formatting/FSharp.Formatting.fsx"
26
- #r " ../../packages/FAKE/tools/NuGet.Core.dll"
27
- #r " ../../packages/FAKE/tools/FakeLib.dll"
25
+ #load " ../../packages/Build/ FSharp.Formatting/FSharp.Formatting.fsx"
26
+ #r " ../../packages/Build/ FAKE/tools/NuGet.Core.dll"
27
+ #r " ../../packages/Build/ FAKE/tools/FakeLib.dll"
28
28
open Fake
29
29
open System.IO
30
30
open Fake.FileHelper
31
31
open FSharp.Literate
32
32
open FSharp.MetadataFormat
33
+ open FSharp.Formatting .Razor
33
34
34
35
// Paths with template/source/output locations
35
36
let bin = __ SOURCE_ DIRECTORY__ @@ " ../../bin/net451"
36
37
let content = __ SOURCE_ DIRECTORY__ @@ " ../content"
37
38
let output = __ SOURCE_ DIRECTORY__ @@ " ../output"
38
39
let files = __ SOURCE_ DIRECTORY__ @@ " ../files"
39
40
let templates = __ SOURCE_ DIRECTORY__ @@ " templates"
40
- let formatting = __ SOURCE_ DIRECTORY__ @@ " ../../packages/FSharp.Formatting/"
41
+ let formatting = __ SOURCE_ DIRECTORY__ @@ " ../../packages/build/ FSharp.Formatting/"
41
42
let docTemplate = formatting @@ " templates/docpage.cshtml"
42
43
43
44
// Where to look for *.csproj templates (in this order)
@@ -53,25 +54,33 @@ subDirectories (directoryInfo templates)
53
54
formatting @@ " templates"
54
55
formatting @@ " templates/reference" ]))
55
56
57
+ let rec copyFilesRecursively ( source : DirectoryInfo ) ( target : DirectoryInfo ) ( overwrite : bool ) =
58
+ source.GetDirectories()
59
+ |> Seq.iter ( fun dir -> copyFilesRecursively dir ( target.CreateSubdirectory dir.Name) overwrite)
60
+ source.GetFiles()
61
+ |> Seq.map ( fun file ->
62
+ file.CopyTo( target.FullName @@ file.Name, overwrite) |> ignore
63
+ file.Name)
64
+ |> Log " Copying file: "
65
+
56
66
// Copy static files and CSS + JS from F# Formatting
57
67
let copyFiles () =
58
- CopyRecursive files output true |> Log " Copying file: "
68
+ copyFilesRecursively ( DirectoryInfo files) ( DirectoryInfo output) true
59
69
ensureDirectory ( output @@ " content" )
60
- CopyRecursive ( formatting @@ " styles" ) ( output @@ " content" ) true
61
- |> Log " Copying styles and scripts: "
70
+ copyFilesRecursively ( DirectoryInfo ( formatting @@ " styles" )) ( DirectoryInfo( output @@ " content" )) true
62
71
63
72
// Build API reference from XML comments
64
73
let buildReference () =
65
74
CleanDir ( output @@ " reference" )
66
75
let binaries =
67
76
referenceBinaries
68
77
|> List.map ( fun lib -> bin @@ lib)
69
- MetadataFormat .Generate
70
- ( binaries, output @@ " reference" , layoutRootsAll.[ " en" ],
71
- parameters = ( " root" , " ../" ):: info,
72
- sourceRepo = githubLink @@ " tree/master" ,
73
- sourceFolder = __ SOURCE_ DIRECTORY__ @@ " .." @@ " .." ,
74
- publicOnly = true , libDirs = [ bin] )
78
+ RazorMetadataFormat .Generate
79
+ ( binaries, output @@ " reference" , layoutRootsAll.[ " en" ],
80
+ parameters = ( " root" , " ../" ):: info,
81
+ sourceRepo = githubLink @@ " tree/master" ,
82
+ sourceFolder = __ SOURCE_ DIRECTORY__ @@ " .." @@ " .." ,
83
+ publicOnly = true , libDirs = [ bin] )
75
84
76
85
// Build documentation from `fsx` and `md` files in `docs/content`
77
86
let buildDocumentation () =
@@ -95,7 +104,8 @@ let buildDocumentation () =
95
104
match key with
96
105
| Some lang -> layoutRootsAll.[ lang]
97
106
| None -> layoutRootsAll.[ " en" ] // "en" is the default language
98
- Literate.ProcessDirectory
107
+ printfn " Generating helps..."
108
+ RazorLiterate.ProcessDirectory
99
109
( dir, docTemplate, output @@ sub,
100
110
processRecursive = false ,
101
111
replacements = ( " root" , getRelativePath content dir dir):: info,
@@ -109,4 +119,4 @@ buildDocumentation()
109
119
#endif
110
120
#if REFERENCE
111
121
buildReference()
112
- #endif
122
+ #endif
0 commit comments