Re-run pre-build rules when necessary#4923
Conversation
This adds a new 'globWatchers' alongside the 'filesMap' for watching glob patterns. This is used for cradle dependencies, so that HLS reloads the cradle when these change. The intended usage is to allow HLS to re-run the Cabal pre-build stage when dependent files are modified, in particular with build-type: Hooks and pre-build rules (but that part is left to a separate commit).
HLS now reads the pre-build rule monitor manifest file to determine which files and file globs to monitor in order to detect when to re-run pre-build rules.
| -- Use a version of Cabal that writes the pre-build rule manifest. | ||
| -- | ||
| -- TODO: remove this. | ||
| source-repository-package | ||
| type: git | ||
| location: https://github.com/sheaf/cabal.git | ||
| subdir: Cabal-syntax Cabal Cabal-hooks | ||
| tag: 2a320cac93255683829768517ceadcd25cbf8f11 |
There was a problem hiding this comment.
I need to pin the Cabal version for the tests to ensure the pre-build rule manifest file is being written. I'm not sure whether there's a better way to do this? We need to guarantee we use the right Cabal library when compiling SetupHooks (or defaultMainWithSetupHooks setupHooks if we are falling back to the Setup CLI, e.g. because of an old cabal-install that is incompatible with this newer version of the Cabal library).
The fact that we need to compile SetupHooks against this version of Cabal also means the test is a bit slow to run as it needs to build Cabal-syntax, Cabal and Cabal-hooks.
There was a problem hiding this comment.
We can run this test only if we can ensure the cabal-install version is recent enough and then ensure in CI the cabal version is new :)
|
Failing on Windows with MAX_PATH issues: Not sure why the test is hanging on Linux, I will investigate tomorrow. |
Companion to Cabal PR #11776.
This PR allow HLS to re-run pre-build rules when needed. That is, when either:
The existing logic in
Cabalhandles recompilation logic and only re-runs rules that are stale. See Cabal PR #11731 for more information on pre-build rule staleness.