diff --git a/Cabal/src/Distribution/Backpack/Configure.hs b/Cabal/src/Distribution/Backpack/Configure.hs index d4c00b75c7b..55d1ae03254 100644 --- a/Cabal/src/Distribution/Backpack/Configure.hs +++ b/Cabal/src/Distribution/Backpack/Configure.hs @@ -101,6 +101,8 @@ configureComponentLocalBuildInfos let conf_pkg_map = Map.fromListWith Map.union + $ + -- Normal dependencies [ ( pc_pkgname pkg , Map.singleton (pc_compname pkg) @@ -113,8 +115,8 @@ configureComponentLocalBuildInfos ) | pkg <- prePkgDeps ] - `Map.union` Map.fromListWith - Map.union + ++ + -- Promised dependencies [ (pkg, Map.singleton (ann_cname aid) aid) | ConfiguredPromisedComponent pkg aid <- promisedPkgDeps ] diff --git a/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.out b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.out new file mode 100644 index 00000000000..31adc84d9fa --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.out @@ -0,0 +1,16 @@ +# cabal v2-repl +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - foo-0.1.0.0 (interactive) (lib:x) (first run) + - foo-0.1.0.0 (lib:y) (first run) + - foo-0.1.0.0 (interactive) (lib:z) (first run) +Configuring library 'x' for foo-0.1.0.0... +Preprocessing library 'x' for foo-0.1.0.0... +Configuring library 'y' for foo-0.1.0.0... +Preprocessing library 'y' for foo-0.1.0.0... +Building library 'y' for foo-0.1.0.0... +Configuring library 'z' for foo-0.1.0.0... +Preprocessing library 'z' for foo-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.project b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.test.hs b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.test.hs new file mode 100644 index 00000000000..9f9bf6b1e7a --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.test.hs @@ -0,0 +1,7 @@ + +import Test.Cabal.Prelude + +main = do + cabalTest $ do + skipUnlessGhcVersion ">= 9.4" + void $ cabalWithStdin "v2-repl" ["--enable-multi-repl","x", "z"] "" diff --git a/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/x/X.hs b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/x/X.hs new file mode 100644 index 00000000000..e970dea80c5 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/x/X.hs @@ -0,0 +1 @@ +module X where diff --git a/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/y/Y.hs b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/y/Y.hs new file mode 100644 index 00000000000..4385338c3c3 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/y/Y.hs @@ -0,0 +1 @@ +module Y where diff --git a/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/z/Z.hs b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/z/Z.hs new file mode 100644 index 00000000000..9b0bdc618e6 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/components/z/Z.hs @@ -0,0 +1 @@ +module Z where diff --git a/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/foo.cabal b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/foo.cabal new file mode 100644 index 00000000000..fa261a57771 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/InternalLibs/foo.cabal @@ -0,0 +1,33 @@ +cabal-version: 3.14 + +name: foo +version: 0.1.0.0 +build-type: Simple + +library x + exposed-modules: + X + hs-source-dirs: + components/x + build-depends: + base + +library y + exposed-modules: + Y + hs-source-dirs: + components/y + build-depends: + base + -- uncommenting this causes 'make show' to pass + -- , foo:x + +library z + exposed-modules: + Z + hs-source-dirs: + components/z + build-depends: + base + , foo:x + , foo:y diff --git a/changelog.d/pr-10841.md b/changelog.d/pr-10841.md new file mode 100644 index 00000000000..ab1cf038867 --- /dev/null +++ b/changelog.d/pr-10841.md @@ -0,0 +1,11 @@ +--- +synopsis: Fix `cabal repl --enable-multi-repl` when only specifying some targets from a package. +packages: [Cabal] +prs: 10841 +issues: [10775] +--- + +Fix a bug `cabal repl --enable-multi-repl` where the repl would fail to start if you +only specified some targets to be loaded. + +In particular, if you are using internal libraries you may be affected by this bug.