Skip to content
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

REPL command in project requires a target #10684

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

philderbeast
Copy link
Collaborator

@philderbeast philderbeast commented Dec 28, 2024

Fixes #10527 and #9983. Doesn't allow an empty list of targets with a project context.

With a project, the REPL command requires a target. If one is not given then a message is shown explaining this and naming the project if the --project-file option was given (but not when the default 'cabal.project' project name is used implicitly). We're not yet able to list project targets so in the meantime, the messages lists the packages of the project.

  • When the implicit default cabal.project is used:
$ cat cabal.project
packages: pkg-one pkg-two

$ cabal repl
Error: [Cabal-7076]
With a project, the REPL command requires a single target. The packages in this
project are:
 - pkg-one
 - pkg-two
  • When the --project-file option is used, the file name is included:
$ cat some.project 
packages: pkg-one pkg-two

$ cabal repl --project-file=some.project
...
Error: [Cabal-7076]
With a project, the REPL command requires a single target. The packages in this
project, 'some.project', are:
 - pkg-one
 - pkg-two
  • When the project has no packages, this is mentioned in the message:
$ cat empty.project

$ cabal repl --project-file=empty.project
...
Error: [Cabal-7076]
With a project, the REPL command requires a single target but there are no
packages in this project, 'empty.project', to choose a package (library) or
other component from as the target for this command.
  • Before the fix the message mentioned a fake-package-0. This was confusing:
$ ~/.ghcup/bin/cabal-3.12.1.0 repl --project-file=some.project
...
Error: [Cabal-7076]
Internal error when trying to open a repl for the package fake-package-0. The
package is not in the set of available targets for the project plan, which would
suggest an inconsistency between readTargetSelectors and resolveTargets.
  • Earlier cabal-install:exe:cabal versions mentioned using all as the target but this won't work for the REPL command:
$ ~/.ghcup/bin/cabal-3.10.3.0 repl --project-file=some.project
Error: cabal-3.10.3.0: No targets given and there is no package in the current
directory. Use the target 'all' for all packages in the project or specify
packages or components by name or location. See 'cabal build --help' for more
details on target options.

@philderbeast philderbeast marked this pull request as draft December 28, 2024 13:20
@philderbeast philderbeast force-pushed the fix/repl-project-null-target branch 4 times, most recently from 09fcf06 to 6dd178f Compare December 28, 2024 16:31
@philderbeast philderbeast marked this pull request as ready for review December 28, 2024 16:31
@philderbeast philderbeast marked this pull request as draft December 28, 2024 19:48
@philderbeast philderbeast force-pushed the fix/repl-project-null-target branch from 7dc0a25 to 2782ef9 Compare December 29, 2024 13:34
@philderbeast philderbeast force-pushed the fix/repl-project-null-target branch from 2782ef9 to 5a50424 Compare December 29, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal error message for cabal repl within project scope
1 participant