Hadrian: 'need' extra-source-files when building an object file
Previously (see #16486), if someone ran a build to completion, then
modified any file listed under the 'extra-source-files' field of a
package's .cabal file, nothing would get rebuilt. This is because those
files were never need
ed by any rule that fires when building the package.
This patches instead reflects the extra-source-files
field in the PackageData
data type and uses that content to need
those files right before trying
to build any object file (from Haskell or non-Haskell source code, e.g C). The
consequence is that with this patch, if a file mentionned in a package's
extra-source-files
is modified, all the object files for that package are
rebuilt.
A simple heuristic got implemented to handle wildcards in extra-source-files
,
like foo/bar/baz/*.s
. We use getDirectoryFilesIO
to get all the files that
match the given pattern and "splice that in", effectively expanding the
wildcard.
This fixes #16486.
I checked that this works with the extra source file from the ticket: I ran hadrian/build.sh --flavour=quick -j4
to completion, I then modified libraries/base/include/ieee-flpt.h
and ran hadrian/build.sh --flavour=quick -j4
again, and hadrian starts rebuilding base with the stage 1 compiler, as expected.