Deduplicate "using config from" message#10546
Conversation
290bd75 to
8423986
Compare
I think it fixes only part of the duplication problem in the snippet you reference. I.e. it dedups file names but it doesn't dedup the phrase notice verbosity . render . vcat $
text "Configuration is affected by the following files:"
: [ text "-" <+> docProjectConfigPath path
| Explicit path <- Set.toList $ projectConfigProvenance projectConfig
]
|
8423986 to
f6a310b
Compare
|
I'm already doing dedup of the intro message as a part of #10548 btw. It'd be best if this one only handled the Ord instance. It's also a bit more complicated than I said above: with implicit config provenance, it'll print the intro message and then nothing else, which doesn't make sense. THis is not hard to fix of course. |
f6a310b to
f28cb93
Compare
|
@mpickering for these added tests do we already have a normalization of the project root directory for tests, something like $ git diff
...
--- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs
+++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs
@@ -261,6 +261,49 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
log "checking if we detect when the same config is imported via many different paths (we don't)"
woopping <- cabal' "v2-build" [ "--project-file=woops-0.project" ]
+ log "checking \"using config from message\" without URI imports"
+ withDirectory "yops" $ do
+ yopping <- fails $ cabal' "v2-build" [ "--project-file=../yops-0.project" ]
+ assertOutputContains
+ (normalizeWindowsOutput "When using configuration from: \
+ \ - /tmp/cabal-testsuite-286573/yops-0.project \
+ \ - /tmp/cabal-testsuite-286573/yops-2.config \
+ \ - /tmp/cabal-testsuite-286573/yops-4.config \
+ \ - /tmp/cabal-testsuite-286573/yops-6.config \
+ \ - /tmp/cabal-testsuite-286573/yops-8.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-1.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-3.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-5.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-7.config \
+ \ - /tmp/cabal-testsuite-286573/yops/yops-9.config \
+ \ The following errors occurred: \
+ \ - The package directory '.' does not contain any .cabal file.")
+ yopping
+
+ return ()
+
+ log "checking \"using config from message\" with URI imports"
+ withDirectory "woops" $ do
+ woopping <- fails $ cabal' "v2-build" [ "--project-file=../woops-0.project" ]
+ assertOutputContains
+ (normalizeWindowsOutput "When using configuration from: \
+ \ - /tmp/cabal-testsuite-282695/woops-0.project \
+ \ - /tmp/cabal-testsuite-282695/woops-2.config \
+ \ - /tmp/cabal-testsuite-282695/woops-4.config \
+ \ - /tmp/cabal-testsuite-282695/woops-6.config \
+ \ - /tmp/cabal-testsuite-282695/woops-8.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-1.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-3.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-5.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-7.config \
+ \ - /tmp/cabal-testsuite-282695/woops/woops-9.config \
+ \ - https://www.stackage.org/lts-21.25/cabal.config \
+ \ The following errors occurred: \
+ \ - The package directory '.' does not contain any .cabal file.")
+ woopping
+
+ return () |
The previous person who bumped into this problem wasn't able to find an existing solution: #8617 (comment) |
bf674e3 to
7070d18
Compare
|
@ulysses4ever and @mpickering, to get around the I see that cabal/cabal-testsuite/src/Test/Cabal/Monad.hs Lines 790 to 791 in 7de199a |
|
This will need another review because previously I'd mucked up the |
|
I didn't add a test of an http import importing another http config file. Two possible ways of doing this are running a local server for the test or picking up the import from somewhere like |
|
I'm traveling this week, so will only be able to get to this next week at earliest. Sorry! |
@ulysses4ever there are two similar messages. You've dealt with the |
7070d18 to
88b92e6
Compare
- Consider URI in Ord instance - Use <> in Ord instance of ProjectConfigPath - Add unconsProjectConfigPath - Add docProjectConfigFiles - Remove docProjectConfigPaths - Clarify sorting haddocks for Ord ProjectConfigPath
8103a64 to
5c9d530
Compare
|
@9999years I've updated the changelog entry to talk more about the "using configuration from" message changes. @Kleidukos what is the |
f4d9610 to
95b78e2
Compare
|
@philderbeast that label does not prevent merging, it's for after-merge :) |
|
(I had also approved it beforehand so as not to block the merge) |
- Add woops test - Regen expected output without duplication - Add "when using config from" tests - Remove unnecessary normalizeWindowsOutput - Change assertion message - Match on (\n|\r\n) for line endings - Note /tmp/cabal-testsuite-*/ not seen on Windows - Always have the project itself sort first - Use with-ghc.config with woops project - Remove docProjectConfigPaths - docProjectConfigFiles is the better name when not reporting "imported by" - Use --dry-run for config listing tests - Only use woops project once in tests - Don't use same project twice in tests - Put dedup test into its own folder - Simplify the project file names - Can be done now that the test is in its own folder - Move using config dedup test to ProjectImport dir - Remove an additional test on yops project - checking "using config from message" without URI imports - Add simple test for changelog - Better explain the message changes - Redo the test so the project doesn't sort 1st - Don't need to specify default project explicitly - Add a z-empty.config lexically sorted last
95b78e2 to
73a13f1
Compare
|
@Mergifyio backport 3.14 |
✅ Backports have been createdDetails
|
Backport #10546: Deduplicate "using config from" message
|
Hey @philderbeast ! In order to backport this to 3.14, we had to revert renaming |
|
@ulysses4ever I should be able to check on this tomorrow. |
|
Yeah no problem there @ulysses4ever. This is to avoid an API change, isn't it, with ce26c3c? |
|
@philderbeast correct. |
Adds an
Ordinstance forProjectConfigPathand fixes the duplication in the reported "Configuration is affected by the following files", fixes #10509 by usingdocProjectConfigFilesinstead ofdocProjectConfigPath.Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significantin the changelog file.