Skip to content

Commit

Permalink
Merge pull request #807 from nhirschey/eval
Browse files Browse the repository at this point in the history
One fsiEvaluator per docs file
  • Loading branch information
nojaf authored Mar 9, 2023
2 parents 1f3dab5 + 5be31ca commit 55253a4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<MSBuild Projects="$(PaketToolsPath)paket.bootstrapper.proj" Targets="Restore" />
</Target>

<!-- Official workaround for https://learn.microsoft.com/en-us/visualstudio/msbuild/getfilehash-task?view=vs-2019 -->
<!-- Official workaround for https://docs.microsoft.com/en-us/visualstudio/msbuild/getfilehash-task?view=vs-2019 -->
<UsingTask TaskName="Microsoft.Build.Tasks.GetFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(MSBuildSupportsHashing)' == 'true' And '$(DetectedMSBuildVersion)' &lt; '16.0.360' " />
<UsingTask TaskName="Microsoft.Build.Tasks.VerifyFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(MSBuildSupportsHashing)' == 'true' And '$(DetectedMSBuildVersion)' &lt; '16.0.360' " />
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" DependsOnTargets="SetPaketCommand;PaketBootstrapping">
Expand Down
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 17.4.0

* One FSI evaluator per docs file [#737](https://github.com/fsprojects/FSharp.Formatting/issues/737)

## 17.3.0

* Better test project detection [#800](https://github.com/fsprojects/FSharp.Formatting/issues/800)
Expand Down
16 changes: 8 additions & 8 deletions src/fsdocs-tool/BuildCommand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type internal DocContent
rootOutputFolderAsGiven,
previous: Map<_, _>,
lineNumbers,
fsiEvaluator,
evaluate,
substitutions,
saveImages,
watch,
Expand Down Expand Up @@ -252,6 +252,12 @@ type internal DocContent
if isFsx then
printfn " generating model for %s --> %s" inputFileFullPath outputFileRelativeToRoot

let fsiEvaluator =
(if evaluate then
Some(FsiEvaluator(onError = onError) :> IFsiEvaluator)
else
None)

let model =
Literate.ParseAndTransformScriptFile(
inputFileFullPath,
Expand Down Expand Up @@ -1579,18 +1585,12 @@ type CoreBuildOptions(watch) =
| "all" -> Some true
| _ -> None)

let fsiEvaluator =
(if this.eval then
Some(FsiEvaluator(onError = onError) :> IFsiEvaluator)
else
None)

let docContent =
DocContent(
rootOutputFolderAsGiven,
latestDocContentResults,
Some this.linenumbers,
fsiEvaluator,
this.eval,
docsSubstitutions,
saveImages,
watch,
Expand Down
4 changes: 2 additions & 2 deletions tests/FSharp.Literate.Tests/DocContentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let ``Can build doc content`` () =
rootOutputFolderAsGiven,
Map.empty,
lineNumbers = None,
fsiEvaluator = None,
evaluate = false,
substitutions = [],
saveImages = None,
watch = false,
Expand Down Expand Up @@ -115,7 +115,7 @@ let ``Can build doc content using relative input path`` () =
rootOutputFolderAsGiven,
Map.empty,
lineNumbers = None,
fsiEvaluator = None,
evaluate = false,
substitutions = [],
saveImages = None,
watch = false,
Expand Down

0 comments on commit 55253a4

Please sign in to comment.