Stop the F# wrapper hardcoding its documentation path - #889
Merged
Conversation
`dotnet build -c release` -- lowercase -- could not build AngouriMath.FSharp from clean
on a case-sensitive filesystem:
FSC : error FS0193: Could not find a part of the path
'.../AngouriMath.FSharp/bin/Release/netstandard2.0/AngouriMath.FSharp.XML'
The fsproj set DocumentationFile to a literal bin\Release\... under a condition on
'$(Configuration)|$(Platform)'=='Release|AnyCPU'. MSBuild compares that
case-insensitively, so with -c release the condition matched and the doc file was
directed at bin/Release/ while $(OutputPath) resolved to bin/release/ -- a directory
that does not exist on Linux or macOS, and the compiler cannot create the file in it.
GenerateDocumentationFile puts the XML beside the assembly whichever way the
configuration is spelled, and needs no path at all. AngouriMath.Terminal.Lib already
does it this way; the main library uses $(Configuration) in its path, so neither was
affected.
Why it went unnoticed: -c Release works, and so does -c release once a capitalised build
has created the directory, so it only fails on a clean checkout that never used the
capitalised spelling.
Verified both spellings from a clean bin and obj: 130 F# tests pass under -c release, and
under -c Release the build still produces AngouriMath.FSharp.xml and the .nupkg.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dotnet build -c release— lowercase — cannot buildAngouriMath.FSharpfrom a clean checkout onLinux or macOS:
Cause
The fsproj set the documentation path literally:
MSBuild compares strings in a
Conditioncase-insensitively, so with-c releasethe conditionmatches and
DocumentationFilepoints atbin/Release/…. But$(OutputPath)is built from theconfiguration as spelled, so the directory that actually gets created is
bin/release/. On acase-sensitive filesystem those are two different paths, the second does not exist, and the F#
compiler cannot create the file in it.
Fix
<GenerateDocumentationFile>true</GenerateDocumentationFile>, which puts the XML beside theassembly whichever way the configuration is spelled and needs no path.
AngouriMath.Terminal.Libalready does exactly this, so it is the in-repo precedent rather than a new idea. The main library
was never affected — it uses
bin/$(Configuration)/$(TargetFramework)/…, which follows the spelling.AngouriMath.FSharpwas the only project with a literal.Verified from a clean
binandobj, both spellingsdotnet test -c releasedotnet build -c ReleaseAngouriMath.FSharp.xmlandAngouriMath.FSharp.2.0.0.nupkgSo packaging is unchanged; the only difference is that the file is now
.xmlrather than.XML,which is what every other project here already emits.
Why nobody hit it
-c Releaseworks, and-c releasealso works once a capitalised build has created thedirectory. It fails only on a clean checkout that has never been built with the capitalised
spelling — which is what CI would do if it ever used the lowercase form, and what I did while
measuring #888. It cost a measurement I had to redo: the first run reported the F# suite as having
been exercised when the build had in fact failed, which is the trap in
dotnet testreusing whatever assembly is already there.