Description
In our project we utilize dynamic actions to compile Haskell modules.
When adding another source file to e.g. a haskell_library
rule, we notice that each module gets recompiled although these did not change.
load("//haskell:defs.bzl", "default_ghc_flags")
haskell_library(
name = "lib",
srcs = glob(["src/**/*.hs"]),
deps = [ ... ]
)
After adding an empty module to src/Temp/Temp.hs
:
module Temp.Temp where
we first see a run of the haskell_metadata
action -- this action gathers dependency information about each module, writes it to a JSON file. This JSON file is processed in a dynamic action in order to create haskell_compile
actions per each module.
Note, we have enabled deferred materialization and the in-memory cache. There is no external cache / RE configured.
But still, even though the command line invocations did not change, and the digests of the inputs did not change (verified by printing the action metadata json) we still see that all modules of the current package are rebuild.
However, if an existing module is modified, e.g. just adding a comment, we see that the haskell_metadata
action is run in order to update the dependency JSON, and it will not rebuild all modules.
It seems that changing the inputs to the rule itself will invalidate all (dynamically created) actions that are related to it. Is this what happens here or is there another thing at play?
(we use buck2 2024-11-01 currently)