Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary rebuilds with dynamic actions #852

Open
avdv opened this issue Jan 22, 2025 · 1 comment
Open

Unnecessary rebuilds with dynamic actions #852

avdv opened this issue Jan 22, 2025 · 1 comment

Comments

@avdv
Copy link
Contributor

avdv commented Jan 22, 2025

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)

@wavewave
Copy link

FYI, the above issue was found in using this fork of buck2-prelude: https://github.com/MercuryTechnologies/buck2-prelude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants