Commit 743dcb3
committed
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. It is necessary to modify `./Setup configure` to allow users to
configure a package *without* having previously built the dependency.
Instead, we promise to the configure phase that we will have built it
by the time we build the package. This allows us to configure all the
packages we intend to load into the repl without building any
dependenices which we will load in the same session, because the
promise is satisifed due to loading the package and it's dependency
into one multi-session which ensures the dependency is built before
it is needed.
A user of ./Setup configure specifies a promised dependency by
prepending a "+" to a normal dependency specification. For example:
```
'--dependency=+cabal-install-solver=cabal-install-solver-3.9.0.0-inplace'
```
2a. The `./Setup repl` command is modified to allow a user to defer
starting the repl and instead instruct the command to write the
necessary build flags to a file. The option is called
`--repl-multi-file <FILEPATH>`.
`cabal-install` then invokes this command for each component which
will populate the session and starts a multi-session with all the
arguments together.
3. 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`.1 parent ef1e12c commit 743dcb3
File tree
76 files changed
+1155
-370
lines changed- Cabal-syntax/src/Distribution/Types
- Cabal-tests/tests/UnitTests/Distribution/Utils
- Cabal/src/Distribution
- Backpack
- Compat
- Simple
- GHC
- Types
- cabal-install-solver/src/Distribution/Solver/Types
- cabal-install
- src/Distribution/Client
- ProjectConfig
- ProjectPlanning
- tests
- UnitTests/Distribution/Client
- cabal-testsuite/PackageTests
- MultiRepl
- 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
- doc
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
76 files changed
+1155
-370
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
Lines 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 | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | | - | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
| |||
102 | 107 | | |
103 | 108 | | |
104 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
110 | 119 | | |
111 | | - | |
| 120 | + | |
112 | 121 | | |
113 | 122 | | |
114 | 123 | | |
| |||
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
132 | | - | |
| 141 | + | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| |||
138 | 147 | | |
139 | 148 | | |
140 | 149 | | |
| 150 | + | |
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
147 | | - | |
| 157 | + | |
148 | 158 | | |
149 | 159 | | |
150 | 160 | | |
| |||
178 | 188 | | |
179 | 189 | | |
180 | 190 | | |
| 191 | + | |
181 | 192 | | |
182 | 193 | | |
183 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
184 | 200 | | |
185 | 201 | | |
186 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
180 | | - | |
| 181 | + | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
122 | | - | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| |||
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
279 | | - | |
| 280 | + | |
280 | 281 | | |
281 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
282 | 288 | | |
283 | 289 | | |
284 | 290 | | |
| |||
289 | 295 | | |
290 | 296 | | |
291 | 297 | | |
292 | | - | |
293 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
294 | 312 | | |
295 | 313 | | |
296 | 314 | | |
| |||
337 | 355 | | |
338 | 356 | | |
339 | 357 | | |
| 358 | + | |
| 359 | + | |
340 | 360 | | |
341 | 361 | | |
342 | 362 | | |
343 | 363 | | |
344 | 364 | | |
345 | | - | |
| 365 | + | |
346 | 366 | | |
347 | 367 | | |
348 | 368 | | |
349 | 369 | | |
350 | 370 | | |
351 | 371 | | |
352 | 372 | | |
353 | | - | |
| 373 | + | |
354 | 374 | | |
355 | 375 | | |
356 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
23 | 36 | | |
24 | 37 | | |
25 | 38 | | |
| |||
56 | 69 | | |
57 | 70 | | |
58 | 71 | | |
| 72 | + | |
59 | 73 | | |
60 | 74 | | |
61 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
50 | 64 | | |
51 | 65 | | |
52 | 66 | | |
| |||
0 commit comments