-
Notifications
You must be signed in to change notification settings - Fork 123
/
generate.ja.fsx
85 lines (75 loc) · 3.59 KB
/
generate.ja.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
// --------------------------------------------------------------------------------------
// Builds the documentation from `.fsx` and `.md` files in the 'docs/content' directory
// (the generated documentation is stored in the 'docs/output' directory)
// --------------------------------------------------------------------------------------
// Binaries that have XML documentation (in a corresponding generated XML file)
let referenceBinaries = [ "FSharp.Compiler.Service.dll" ]
// Web site location for the generated documentation
let website = "/FSharp.Compiler.Service/ja"
// Specify more information about your project
let info =
[ "project-name", "F# Compiler Services"
"project-author", "Microsoft Corporation, Dave Thomas, Anh-Dung Phan, Tomas Petricek"
"project-summary", "F# compiler services for creating IDE tools, language extensions and for F# embedding"
"project-github", "http://github.com/fsharp/FSharp.Compiler.Service"
"project-nuget", "http://nuget.com/packages/FSharp.Compiler.Service" ]
// --------------------------------------------------------------------------------------
// For typical project, no changes are needed below
// --------------------------------------------------------------------------------------
#I "../../packages/FSharp.Formatting.2.3.4-beta/lib/net40"
#I "../../packages/RazorEngine.3.3.0/lib/net40"
#r "../../packages/Microsoft.AspNet.Razor.2.0.30506.0/lib/net40/System.Web.Razor.dll"
#I "../../packages/FSharp.Compiler.Service.0.0.11-alpha/lib/net40"
#I "../../packages/FAKE/tools"
#r "../../packages/FAKE/tools/FakeLib.dll"
#r "FSharp.Compiler.Service.dll"
#r "RazorEngine.dll"
#r "FSharp.Literate.dll"
#r "FSharp.CodeFormat.dll"
#r "FSharp.MetadataFormat.dll"
open Fake
open System.IO
open Fake.FileHelper
open FSharp.Literate
open FSharp.MetadataFormat
// When called from 'build.fsx', use the public project URL as <root>
// otherwise, use the current 'output' directory.
#if RELEASE
let root = website
#else
let root = "file://" + (__SOURCE_DIRECTORY__ @@ "../output/ja")
#endif
// Paths with template/source/output locations
let bin = __SOURCE_DIRECTORY__ @@ "../../bin"
let content = __SOURCE_DIRECTORY__ @@ "../content/ja"
let output = __SOURCE_DIRECTORY__ @@ "../output"
let outputJa = __SOURCE_DIRECTORY__ @@ "../output/ja"
let files = __SOURCE_DIRECTORY__ @@ "../files"
let templates = __SOURCE_DIRECTORY__ @@ "templates/ja"
let reference = __SOURCE_DIRECTORY__ @@ "reference"
let formatting = __SOURCE_DIRECTORY__ @@ "../../packages/FSharp.Formatting.2.3.4-beta/"
let docTemplate = formatting @@ "templates/docpage.cshtml"
// Where to look for *.csproj templates (in this order)
let layoutRoots =
[ templates
reference
formatting @@ "templates"
formatting @@ "templates/reference" ]
// Copy static files and CSS + JS from F# Formatting
let copyFiles () =
CopyRecursive files output true |> Log "Copying file: "
ensureDirectory (output @@ "content")
CopyRecursive (formatting @@ "styles") (output @@ "content") true
|> Log "Copying styles and scripts: "
// Build documentation from `fsx` and `md` files in `docs/content`
let buildDocumentation () =
let subdirs = Directory.EnumerateDirectories(content, "*", SearchOption.AllDirectories)
|> Seq.filter (fun x -> x.Contains "ja")
for dir in Seq.append [content] subdirs do
let sub = if dir.Length > content.Length then dir.Substring(content.Length + 1) else "."
Literate.ProcessDirectory
( dir, docTemplate, outputJa @@ sub, replacements = ("root", root)::info,
layoutRoots = layoutRoots )
// Generate
copyFiles()
buildDocumentation()