Open mpilgrem opened 4 months ago
@mikolaj has suggested as reading: https://github.com/haskell/cabal/pulls?q=is%3Apr+author%3Acoot authored by @coot.
If I am correct about the -this-unit-id
difference, it has it origins in Distribution.Simple.Haddock.componentGhcOptions
and Distribution.Simple.GHC.Internal.componentGhcOptions
.
The master
branch of Cabal
has (extract):
componentGhcOptions verbosity lbi bi clbi odir =
let implInfo = getImplInfo $ compiler lbi
in mempty
{ -- Respect -v0, but don't crank up verbosity on GHC if
-- Cabal verbosity is requested. For that, use --ghc-option=-v instead!
ghcOptVerbosity = toFlag (min verbosity normal)
, ghcOptCabal = toFlag True
, ghcOptThisUnitId = case clbi of
LibComponentLocalBuildInfo{componentCompatPackageKey = pk} ->
toFlag pk
_ | not (unitIdForExes implInfo) -> mempty
ExeComponentLocalBuildInfo{componentUnitId = uid} ->
toFlag (unUnitId uid)
...
but unitIdForExes
is not in any released version (up to Cabal-3.10.2.1
- GHC 9.8.2 comes with Cabal-3.10.2.0
.). It was added in https://github.com/haskell/cabal/commit/8d402c7b2900ebeb2c320e40cf4c16338232eb43
Version 2.16.0, Git revision 1817292f22987cc764a72146cf707f028c575bf5 (10654 commits) PRE-RELEASE x86_64 has
--haddock-executables
(built on top of Cabal (the library)'shaddock --executables
), but there are problems with the index.Consider a two-package project (
packageA
,packageB
) each with two executable components (egpackageA-exe1
,packageA-exe2
). The index generated for project packages has four links toMain
but all of them are to theMain
ofpackageB-exe1
.Using
haddock --show-interface
reveals that all four*.haddock
files commence:That can be contrasted with the two
*.haddock
files for the main library:and
--cabal-verbosity 3
reveals that, with the main library, Cabal (the library) invokes Haddock with options that include:There is no equivalent for when Cabal invokes Haddock for the executable components.