Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ let testStage =
$"dotnet test {solutionFile} --configuration {configuration} --no-build --blame --logger trx --results-directory TestResults -tl"
}

let nugetStage =
stage "NuGet" { run $"dotnet pack {solutionFile} --output \"{artifactsDir}\" --configuration {configuration} -tl" }

let installToolStage =
stage "InstallFsDocsTool" {
noStdRedirectForStep

run
$"dotnet tool install --no-cache --version %A{releaseNugetVersion} --add-source \"%s{artifactsDir}\" --tool-path \"%s{artifactsDir}\" fsdocs-tool"

echo $"The development version of fsdocs can be invoked from:{System.Environment.NewLine}%s{fsdocTool}"
}

let uninstallToolStage =
stage "UninstallFsDocsTool" { run $"dotnet tool uninstall fsdocs-tool --tool-path \"%s{artifactsDir}\"" }

pipeline "CI" {
lintStage

Expand All @@ -65,7 +81,7 @@ pipeline "CI" {
run $"dotnet build {solutionFile} --configuration {configuration} -tl"
}

stage "NuGet" { run $"dotnet pack {solutionFile} --output \"{artifactsDir}\" --configuration {configuration} -tl" }
nugetStage

testStage

Expand All @@ -75,11 +91,9 @@ pipeline "CI" {
Shell.cleanDir ".packages")
// Τhe tool has been uninstalled when the
// artifacts folder was removed in the Clean stage.
run
$"dotnet tool install --no-cache --version %A{releaseNugetVersion} --add-source \"%s{artifactsDir}\" --tool-path \"%s{artifactsDir}\" fsdocs-tool"

installToolStage
run $"\"{fsdocTool}\" build --strict --clean --properties Configuration=Release"
run $"dotnet tool uninstall fsdocs-tool --tool-path \"%s{artifactsDir}\""
uninstallToolStage
run (fun _ -> Shell.cleanDir ".packages")
}

Expand All @@ -93,4 +107,15 @@ pipeline "Verify" {
runIfOnlySpecified true
}

pipeline "InstallTool" {
nugetStage
installToolStage
runIfOnlySpecified true
}

pipeline "UninstallTool" {
uninstallToolStage
runIfOnlySpecified true
}

tryPrintPipelineCommandHelp ()
24 changes: 4 additions & 20 deletions src/fsdocs-tool/BuildCommand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1403,26 +1403,10 @@ type CoreBuildOptions(watch) =

let userParametersDict = readOnlyDict userParameters

// Adjust the user substitutions for 'watch' mode root
let userRoot, userParameters =
if watch then
let userRoot = sprintf "http://localhost:%d/" this.port_option

if userParametersDict.ContainsKey(ParamKeys.root) then
printfn "ignoring user-specified root since in watch mode, root = %s" userRoot

let userParameters =
[ ParamKeys.root, userRoot ]
@ (userParameters |> List.filter (fun (a, _) -> a <> ParamKeys.root))

Some userRoot, userParameters
else
let r =
match userParametersDict.TryGetValue(ParamKeys.root) with
| true, v -> Some v
| _ -> None

r, userParameters
let userRoot =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will clash later on with

let root =
let projectUrl = projectInfoForDocs.PackageProjectUrl |> Option.map ensureTrailingSlash
defaultArg userRoot (defaultArg projectUrl ("/" + collectionName) |> ensureTrailingSlash)

Just following the instructions in the readme (dotnet build and src\fsdocs-tool\bin\Debug\net6.0\fsdocs.exe watch) will launch everything pointing to https://fsprojects.github.io/FSharp.Formatting and not localhost.

match userParametersDict.TryGetValue(ParamKeys.root) with
| true, v -> Some v
| _ -> None

let userCollectionName =
match (dict userParameters).TryGetValue(ParamKeys.``fsdocs-collection-name``) with
Expand Down