Skip to content

Commit

Permalink
use FAKE for documentation generation, fixes #356
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Nov 21, 2015
1 parent 27cb665 commit 762b7d0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
37 changes: 33 additions & 4 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,42 @@ Target "NuGet" (fun _ ->
// --------------------------------------------------------------------------------------
// Generate the documentation

let fakePath = "packages" @@ "FAKE" @@ "tools" @@ "FAKE.exe"
let fakeStartInfo script workingDirectory args fsiargs environmentVars =
(fun (info: System.Diagnostics.ProcessStartInfo) ->
info.FileName <- System.IO.Path.GetFullPath fakePath
info.Arguments <- sprintf "%s --fsiargs -d:FAKE %s \"%s\"" args fsiargs script
info.WorkingDirectory <- workingDirectory
let setVar k v =
info.EnvironmentVariables.[k] <- v
for (k, v) in environmentVars do
setVar k v
setVar "MSBuild" msBuildExe
setVar "GIT" Git.CommandHelper.gitPath
setVar "FSI" fsiPath)

/// Run the given buildscript with FAKE.exe
let executeFAKEWithOutput workingDirectory script fsiargs envArgs =
let exitCode =
ExecProcessWithLambdas
(fakeStartInfo script workingDirectory "" fsiargs envArgs)
TimeSpan.MaxValue false ignore ignore
System.Threading.Thread.Sleep 1000
exitCode

// Documentation
let buildDocumentationTarget fsiargs target =
trace (sprintf "Building documentation (%s), this could take some time, please wait..." target)
let exit = executeFAKEWithOutput "docs/tools" "generate.fsx" fsiargs ["target", target]
if exit <> 0 then
failwith "generating reference documentation failed"
()

Target "GenerateDocs" (fun _ ->
if not <| executeFSIWithArgs "docs/tools" "generate.fsx" ["--define:RELEASE"; "--define:REFERENCE"; "--define:HELP"] [] then
failwith "generating reference documentation failed")
buildDocumentationTarget "--define:RELEASE --define:REFERENCE --define:HELP" "Default")

Target "WatchDocs" (fun _ ->
if not <| executeFSIWithArgs "docs/tools" "generate.fsx" ["--define:WATCH"] [] then
failwith "generating reference documentation failed")
buildDocumentationTarget "--define:WATCH" "Default")

// --------------------------------------------------------------------------------------
// Release Scripts
Expand Down
3 changes: 2 additions & 1 deletion docs/tools/generate.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ let bundledFiles =
|> List.map (fun f ->
__SOURCE_DIRECTORY__ @@ sprintf "../../bin/%s" f,
__SOURCE_DIRECTORY__ @@ sprintf "../../packages/FSharp.Formatting/lib/net40/%s" f)
for source, dest in bundledFiles do File.Copy(source, dest, true)
for source, dest in bundledFiles do try File.Copy(source, dest, true) with e -> printfn "Could not copy %s to %s" source dest

#load "../../packages/FSharp.Formatting/FSharp.Formatting.fsx"

open FSharp.Literate
Expand Down

0 comments on commit 762b7d0

Please sign in to comment.