Skip to content

Commit

Permalink
use FAKE for documentation generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Nov 20, 2015
1 parent a18db08 commit b32fdbb
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions build.template
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,52 @@ Target "PublishNuget" (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 <- 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 "GenerateReferenceDocs" (fun _ ->
if not <| executeFSIWithArgs "docs/tools" "generate.fsx" ["--define:RELEASE"; "--define:REFERENCE"] [] then
failwith "generating reference documentation failed"
buildDocumentationTarget "-d:RELEASE" -d:REFERENCE" "Default"
)

let generateHelp' fail debug =
let args =
if debug then ["--define:HELP"]
else ["--define:RELEASE"; "--define:HELP"]
if executeFSIWithArgs "docs/tools" "generate.fsx" args [] then
if debug then "--define:HELP"
else "--define:RELEASE --define:HELP"
try
buildDocumentationTarget args "Default"
traceImportant "Help generated"
else
if fail then
failwith "generating help documentation failed"
else
traceImportant "generating help documentation failed"
with
| e when not fail ->
traceImportant "generating help documentation failed"

let generateHelp fail =
generateHelp' fail false
Expand Down

0 comments on commit b32fdbb

Please sign in to comment.