forked from fslaborg/RProvider
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to new version of F# formatting tools
- Loading branch information
Showing
8 changed files
with
121 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,86 @@ | ||
// -------------------------------------------------------------------------------------- | ||
// Builds the documentation from FSX files in the 'samples' directory | ||
// (the documentation is stored in the 'docs' directory) | ||
// Builds the documentation from `.fsx` and `.md` files in the 'docs/content' directory | ||
// (the generated documentation is stored in the 'docs/output' directory) | ||
// -------------------------------------------------------------------------------------- | ||
|
||
#I "../../packages/FSharp.Formatting.2.0.1/lib/net40" | ||
// Binaries that have XML documentation (in a corresponding generated XML file) | ||
let referenceBinaries = [ ] | ||
// Web site location for the generated documentation | ||
let website = "http://bluemountaincapital.github.io/FSharpRProvider" | ||
|
||
// Specify more information about your project | ||
let info = | ||
[ "project-name", "R Type Provider" | ||
"project-author", "BlueMountain Capital" | ||
"project-summary", "An F# Type Provider providing strongly typed access to the R statistical package" | ||
"project-github", "http://github.com/BlueMountainCapital/FSharpRProvider" | ||
"project-nuget", "https://nuget.org/packages/RProvider" ] | ||
|
||
// -------------------------------------------------------------------------------------- | ||
// For typical project, no changes are needed below | ||
// -------------------------------------------------------------------------------------- | ||
|
||
#I "../../packages/FSharp.Formatting.2.2.1/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" | ||
#r "../../packages/FAKE/tools/FakeLib.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") | ||
#endif | ||
|
||
// Paths with template/source/output locations | ||
let bin = __SOURCE_DIRECTORY__ @@ "../../bin" | ||
let content = __SOURCE_DIRECTORY__ @@ "../content" | ||
let output = __SOURCE_DIRECTORY__ @@ "../output" | ||
let files = __SOURCE_DIRECTORY__ @@ "../files" | ||
let templates = __SOURCE_DIRECTORY__ @@ "templates" | ||
let formatting = __SOURCE_DIRECTORY__ @@ "../../packages/FSharp.Formatting.2.2.1/" | ||
let docTemplate = formatting @@ "templates/docpage.cshtml" | ||
|
||
// Where to look for *.csproj templates (in this order) | ||
let layoutRoots = | ||
[ templates; 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 @@ "content") (output @@ "content") true | ||
|> Log "Copying styles and scripts: " | ||
|
||
// Build API reference from XML comments | ||
let buildReference () = | ||
CleanDir (output @@ "reference") | ||
for lib in referenceBinaries do | ||
MetadataFormat.Generate | ||
( bin @@ lib, output @@ "reference", layoutRoots, | ||
parameters = ("root", root)::info ) | ||
|
||
// Build documentation from `fsx` and `md` files in `docs/content` | ||
let buildDocumentation () = | ||
let subdirs = Directory.EnumerateDirectories(content, "*", SearchOption.AllDirectories) | ||
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, output @@ sub, replacements = ("root", root)::info, | ||
layoutRoots = layoutRoots ) | ||
|
||
let (++) a b = Path.Combine(a, b) | ||
let template = __SOURCE_DIRECTORY__ ++ "template.html" | ||
let sources = __SOURCE_DIRECTORY__ ++ "../content" | ||
let files = __SOURCE_DIRECTORY__ ++ "../files" | ||
let output = __SOURCE_DIRECTORY__ ++ "../output" | ||
|
||
// Root URL for the generated HTML | ||
let root = "http://bluemountaincapital.github.io/FSharpRProvider" | ||
// Root URL for local testing | ||
// let root = "file://C:\dev\FSharp.RProvider\generated" | ||
|
||
// Generate HTML from all FSX files in samples & subdirectories | ||
let build () = | ||
// Copy all sample data files to the "data" directory | ||
let copy = [ sources ++ "../../packages/FSharp.Formatting.2.0.1/literate/content", output ++ "content" | ||
files ++ "img", output ++ "img" | ||
files ++ "misc", output ++ "misc" ] | ||
for source, target in copy do | ||
if Directory.Exists target then Directory.Delete(target, true) | ||
Directory.CreateDirectory target |> ignore | ||
for fileInfo in DirectoryInfo(source).EnumerateFiles() do | ||
fileInfo.CopyTo(target ++ fileInfo.Name) |> ignore | ||
|
||
Literate.ProcessDirectory | ||
( sources, template, output, | ||
replacements = [ "root", root ] ) | ||
|
||
build() | ||
// Generate | ||
copyFiles() | ||
buildDocumentation() | ||
buildReference() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="FSharp.Data" version="1.1.10" targetFramework="net45" /> | ||
<package id="FSharp.Formatting" version="2.0.1" targetFramework="net45" /> | ||
<package id="FSharp.Formatting" version="2.2.1" targetFramework="net45" /> | ||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" /> | ||
<package id="RazorEngine" version="3.3.0" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters