|
| 1 | +--- |
| 2 | +synopsis: "A project target is required for the REPL command" |
| 3 | +packages: [cabal-install] |
| 4 | +prs: 10684 |
| 5 | +issues: 10527 |
| 6 | +--- |
| 7 | + |
| 8 | +With a project, the REPL command requires a target. If one is not given then a |
| 9 | +message is shown explaining this and naming the project if the `--project-file` |
| 10 | +option was given (but not when the default 'cabal.project' project name is used |
| 11 | +implicitly). We're not yet able to list project targets so in the meantime, the |
| 12 | +messages lists the packages of the project. |
| 13 | + |
| 14 | +* When the implicit default `cabal.project` is used: |
| 15 | + |
| 16 | +``` |
| 17 | +$ cat cabal.project |
| 18 | +packages: pkg-one pkg-two |
| 19 | +
|
| 20 | +$ cabal repl |
| 21 | +Error: [Cabal-7076] |
| 22 | +With a project, the REPL command requires a single target. The packages in this project are: |
| 23 | + - pkg-one |
| 24 | + - pkg-two |
| 25 | +``` |
| 26 | + |
| 27 | +* When the `--project-file` option is used, the file name is included: |
| 28 | + |
| 29 | +``` |
| 30 | +$ cat some.project |
| 31 | +packages: pkg-one pkg-two |
| 32 | +
|
| 33 | +$ cabal repl --project-file=some.project |
| 34 | +... |
| 35 | +Error: [Cabal-7076] |
| 36 | +With a project, the REPL command requires a single target. The packages in this project, 'some.project', are: |
| 37 | + - pkg-one |
| 38 | + - pkg-two |
| 39 | +``` |
| 40 | + |
| 41 | +* When the project has no packages, this is mentioned in the message: |
| 42 | + |
| 43 | +``` |
| 44 | +$ cat empty.project |
| 45 | +
|
| 46 | +$ cabal repl --project-file=empty.project |
| 47 | +... |
| 48 | +Error: [Cabal-7076] |
| 49 | +With a project, the REPL command requires a single target but there are no |
| 50 | +packages in this project, 'empty.project', to choose a package (library) or |
| 51 | +other component from as the target for this command. |
| 52 | +``` |
| 53 | + |
| 54 | +* Before the fix the message mentioned a `fake-package-0`. This was confusing: |
| 55 | + |
| 56 | +``` |
| 57 | +$ ~/.ghcup/bin/cabal-3.12.1.0 repl --project-file=some.project |
| 58 | +... |
| 59 | +Error: [Cabal-7076] |
| 60 | +Internal error when trying to open a repl for the package fake-package-0. The |
| 61 | +package is not in the set of available targets for the project plan, which would |
| 62 | +suggest an inconsistency between readTargetSelectors and resolveTargets. |
| 63 | +``` |
| 64 | + |
| 65 | +* Earlier `cabal-install:exe:cabal` versions mentioned using `all` as the target |
| 66 | + but this won't work for the REPL command: |
| 67 | + |
| 68 | +``` |
| 69 | +$ ~/.ghcup/bin/cabal-3.10.3.0 repl --project-file=some.project |
| 70 | +Error: cabal-3.10.3.0: No targets given and there is no package in the current |
| 71 | +directory. Use the target 'all' for all packages in the project or specify |
| 72 | +packages or components by name or location. See 'cabal build --help' for more |
| 73 | +details on target options. |
| 74 | +``` |
0 commit comments