Skip to content

Monitor imported cabal.project files#11884

Closed
philderbeast wants to merge 1 commit into
haskell:masterfrom
cabalism:wip/monitoring-proj-imports
Closed

Monitor imported cabal.project files#11884
philderbeast wants to merge 1 commit into
haskell:masterfrom
cabalism:wip/monitoring-proj-imports

Conversation

@philderbeast

@philderbeast philderbeast commented May 25, 2026

Copy link
Copy Markdown
Collaborator

I started with #11567 by @hasufell.

I then reverted a lot of changes not related to (or no longer needed for) monitoring before attempting a rebase. To make the rebase easier I also squashed those changes into one commit.

I then rebased over master once #10933 merged, so that we could match on whether an import was local file or a URI.

Important

This pull request avoids taking on this redesign:

- newtype ProjectConfigPath = ProjectConfigPath (NonEmpty FilePath)
+ data ProjectConfigPath = PCPWithImports PCPLeaf (NonEmpty FilePath)
+                       | PCPWithoutImports FilePath
+    deriving (Eq, Show, Generic)
+
+ data PCPLeaf = PCPFilePath FilePath
+             | PCPURI URI
+    deriving (Eq, Show, Generic)

I redesigned ProjectConfigPath, because I did not like how we stuff URIs into FilePaths
-- #11567 (comment)

That is not to say we shouldn't do this or something similar but it is not needed to fix project file monitoring. ProjectNode could maybe help in a future redesign?

-- | Isomorphic with 'ProjectConfigPath' but with separate constructors for the
-- root, imported file and imported URI.
data ProjectNode a where
ProjectRoot :: FilePath -> ProjectNode ProjectFilePath
ProjectFileImport :: FilePath -> ProjectConfigPath -> ProjectNode FilePath
ProjectUriImport :: URI -> ProjectConfigPath -> ProjectNode URI

Note

I changed these items after rebasing:

  • Fix the -Wunused-top-binds warning for lookupLocalPackageConfig by re-exporting deleting it
  • Avoid the many primes of lookupPerPkgOption'
  • Avoid duplicates when monitoring
  • Watch out for explicit imports of cabal.project.local and cabal.project.freeze

I'll squash commits before applying the merge label if this pull request is approved.


@philderbeast philderbeast marked this pull request as draft May 25, 2026 20:44
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 2 times, most recently from a8c983d to d18f91f Compare May 26, 2026 17:29
@philderbeast philderbeast marked this pull request as ready for review May 26, 2026 17:49
@philderbeast philderbeast requested a review from hasufell May 26, 2026 18:09
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 2 times, most recently from b91d469 to 49c2625 Compare May 27, 2026 02:10
@philderbeast

Copy link
Copy Markdown
Collaborator Author

Putting this back to draft. I've added some debug logging and found more things to test for and other issues to raise.

@philderbeast philderbeast marked this pull request as draft May 28, 2026 12:52
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 2 times, most recently from 046b397 to 1578b11 Compare June 3, 2026 13:48
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 3 times, most recently from cc57ff1 to 5828db0 Compare June 9, 2026 17:56
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 2 times, most recently from 54ecd79 to 52c81d0 Compare June 20, 2026 17:27
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 8 times, most recently from 3745e7e to 22ae2d1 Compare June 30, 2026 00:02
@philderbeast philderbeast mentioned this pull request Jul 1, 2026
6 tasks
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch from dcb23c5 to aa5df8d Compare July 1, 2026 17:33
@philderbeast philderbeast mentioned this pull request Jul 3, 2026
6 tasks
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch from aa5df8d to 72cdab8 Compare July 3, 2026 02:30
- Fixes haskell#10255
- Fix assertion failure wrt haskell#11568 'lookupLocalPackageConfig' would ignore --'projectConfigAllPackages'
(`package *`) and thus diverge from 'lookupPerPkgOption'. This would then cause further divergence between 'elabStanzasRequested'
and 'elabStanzasAvailable'.
Change arg order with perPkgOptionFlag, def first
Use function composition for perPkgOption*
Add type sigs for all perPkgOption* functions
Inline each perPkgOption* only used once
Use -XViewPatterns in perPkgOptionLibExeFlag
Partially apply then use lookupPerPkgOption
Move Map.fromList in list comprehension
Use -XViewPattern in Just pkgId branch
Defer (TestStanzas,) & (BenechStanzas,) tuples
Remove lookupLocalPackageConfig
Remove unused parameters form read...Gen
Remove -Wno-unused-matches
- Remove clean from test, leave note
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch from b99df43 to 2050029 Compare July 3, 2026 10:17
@philderbeast

Copy link
Copy Markdown
Collaborator Author

Closing in favour of #12077 and #12080. Tests were added already in #12069.

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

Successfully merging this pull request may close these issues.

Changing a file imported by cabal.project does not trigger recompilation

2 participants