Skip to content

Fix multi-repl when only building some internal library targets #10841

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

Merged
merged 1 commit into from
Mar 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Cabal/src/Distribution/Backpack/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ configureComponentLocalBuildInfos
let conf_pkg_map =
Map.fromListWith
Map.union
$
-- Normal dependencies
[ ( pc_pkgname pkg
, Map.singleton
(pc_compname pkg)
Expand All @@ -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
]
Expand Down
16 changes: 16 additions & 0 deletions cabal-testsuite/PackageTests/MultiRepl/InternalLibs/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# cabal v2-repl
Configuration is affected by the following files:
- cabal.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -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...
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: .
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

import Test.Cabal.Prelude

main = do
cabalTest $ do
skipUnlessGhcVersion ">= 9.4"
void $ cabalWithStdin "v2-repl" ["--enable-multi-repl","x", "z"] ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module X where
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Y where
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Z where
33 changes: 33 additions & 0 deletions cabal-testsuite/PackageTests/MultiRepl/InternalLibs/foo.cabal
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions changelog.d/pr-10841.md
Original file line number Diff line number Diff line change
@@ -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.
Loading