haddock: Copy interface files to tmp dir
commita1e14a7d3a93fa8915a39c9474c2197920bc2b5c
authorRodrigo Mesquita <rodrigo.m.mesquita@gmail.com>
Fri, 17 May 2024 13:01:02 +0000 (17 14:01 +0100)
committerMikolaj <281893+Mikolaj@users.noreply.github.com>
Thu, 30 May 2024 19:49:55 +0000 (30 19:49 +0000)
treef63542a596cd6372b0d07275f4c796ebd6f8ba20
parent68fcd33d73af7e345e6ebd2af074cb77cd62c715
haddock: Copy interface files to tmp dir

In the last commits we started re-using GHC's interface files and
objects in haddock in order to avoid recompilation.

However, if haddock is run with different flags than GHC (say, for example,
`haddock-options: -DSomethingCustom`), it will recompile the interfaces
and objects.

This commit introduces a guardrail to the process of re-using GHC's
compilation files: instead of running haddock directly on the
directories where GHC placed its output, copy the directory contents to
a temporary directory and point haddock to the objects and interfaces
there. Even if recompilation is triggered by haddock, the objects
produced by GHC will be left untouched.
Cabal/src/Distribution/Simple/Haddock.hs
Cabal/src/Distribution/Types/LocalBuildInfo.hs