Commit e61b658
Add support for loading multiple components into one repl session
There are several parts to this patch which are logically distinct but
work together to support the overal goal of starting a GHCi session with
multiple packages loaded at once.
1. When a user writes "cabal repl <target>" then if the user is using a
compiler > ghc-9.4.* then we will attempt to start a multi-session
which loads the selected targets into one multi-package session of
GHC.
1a. The closure property states that in order to load components `p` and `q` into
the same session that if `p` depends on `z` and `z` depends on `q`
then `z` must also be loaded into the session.
1b. Only inplace packages are able to be loaded into a multi session (if a component
`z` exists then it is already made into an inplace package by
cabal). Therefore cabal has already engineered that there is source
code locally available for all packages which we will want to load
into a session.
2. The solver is unmodified, the solver is given the repl targets and
creates a build plan as before. After the solver is completed then in
`setRootTargets` and `pruneInstallPlan` we modify the install plan to
enforce the closure property and mark which dependencies need to be
promised.
* Mark the current components as `BuildInPlaceOnly InMemory`, which
indicates to the compiler that it is to be built in a GHC
multi-session.
* Augment the component repl targets to indicate that components
required by the closure property (in addition to normal targets)
will be loaded into the repl.
* Modify the dependency edges in `compLibDependencies` to indicate
which dependencies are the promised ones (which is precisely
components which are `BuildInPlaceOnly InMemory` build styles).
This is the field which is eventually used to populate the
`--dependency` argument to `./Setup configure`.
Fixes #84911 parent 272237c commit e61b658
File tree
71 files changed
+1319
-306
lines changed- Cabal-tests/tests/UnitTests/Distribution/Utils
- Cabal/src/Distribution/Types
- cabal-install-solver/src/Distribution/Solver/Types
- cabal-install
- src/Distribution/Client
- ProjectConfig
- ProjectPlanning
- tests
- UnitTests/Distribution/Client
- cabal-testsuite/PackageTests
- MultiRepl
- CabalTooOld
- pkg-a
- pkg-b
- repo/Cabal-3.8.0.0
- EnabledClosure
- pkg-a
- pkg-b
- pkg-c
- EnabledSucc
- pkg-a
- pkg-b
- NotEnabledFail
- pkg-a
- pkg-b
- NewBuild
- CmdBuild/ScriptBuildRepl
- CmdRepl
- ScriptRerun
- Script
- ReplNoLoad
- ReplOptions
- ShowBuildInfo/Complex
- changelog.d
- doc
- internal
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
71 files changed
+1319
-306
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | | - | |
34 | | - | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | 75 | | |
70 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| |||
0 commit comments