-
Notifications
You must be signed in to change notification settings - Fork 697
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
Show import tree provenance (backport #9578) #9877
Conversation
Cherry-pick of f8cd563 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
58d0a56
to
1ac56af
Compare
Backports don't accept "squash+merge me" (https://github.com/haskell/cabal/blob/master/.github/mergify.yml#L59-L72). I was hoping the "fixup!" prefixes would get the additional commits squashed (https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordltcommitgt) but I suppose that doesn't work here. |
1ac56af
to
dece5e8
Compare
With this change to the solver message rendering, I also fix some bugs around project imports, adding tests for those cases. Reviewers asked that the Y-shaped import checks (using IORef) be made on a separate pull request. Removing those lead to cascading deletions. - Regenerate expected .out files - Show tree provenance of import constraint - Add trimmed down PackageTests/VersionPriority - Add changelog entry - Use NonEmpty - Fix check for cyclical import - Use primes for next iteration - Remove unused LANGUAGE pragmas - Rename to projectConfigPathRoot - Docs for ProjectConfigPath and showProjectConfigPath - Renaming - Add cyclical import tests with 1 and 2 hops in cycle - Use full path for cyclical error message - Expected output has project with full project path - Add fullPath local function - Project directory as FilePath, not Maybe FilePath - Use (_, projectFileName) binding splitFileName - Need full path to project parsing legacy - Inline seenImports conversion - Add cyclical checks with same file names and hops - Add noncyclical tests that hop over folders - Add a project testing skipping in and out of a folder - Update expectations of cyclical tests - Use canonicalizePath for collapsing .. when possible - Capture trace for later - Add module for ProjectConfigPath - Move functions for ProjectConfigPath to its module - Fetch URI is not prefixed with ./https://etc - Document normaliseConfigPath - Add doctests for normaliseConfigPath - Add doctest of canonicalizeConfigPath - Show an example of canonical paths - Use importer and importee in canonicalizeConfigPaths - Add logging
dece5e8
to
af9d5df
Compare
Fixes #9562. This adds the path in the project import tree with the constraint conflict just below the solver's rejecting message (sample taken from the change log entry).
Important
The way imports worked changed between
cabal-install-3.8
andcabal-install-3.10
. With the earlier version imports were anchored to the project root (relative to a fixed location) but this was changed to make them relative to their importer. I had to pay close attention to the check for seen imports, something I added tests for. These tests merged already with #9665 and #9680. I've also added verbose logging at theinfo
level so we can see the import we're processing, the seen imports and the import we're fetching.Because relative imports may contain
..
and the only way to resolve this is to use canonicalizePath I had to take an extra dependency ondirectory
incabal-install-solver
. I also needednetwork-uri
to check for URIs and avoid messing with them. I assume that once we import a URI config then imports stop there. Put another way, something imported viahttps://...
doesn't itself import another config. Those extra dependencies we should be able to remove when the suggested change of @andreabedini lands, #9642.The documentation has been updated, if necessary.(Can't find "rejecting" in the docs to change).If testing manually, I suggest trying
cabal build --dry-run
with a simplecabal.project
, a project with imports and a bare package with no project. To see the change, a solver rejection will need to be triggered by introducing a version constraint.Note
I'd tried to use a tree-like layout but settled on a list instead after review.
I used
+--
ASCII chars to mark tree nodes (and not the same ones as tree does). Can we use the nicer unicode chars?