-
Notifications
You must be signed in to change notification settings - Fork 701
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
Add a cabal target command #9744
base: master
Are you sure you want to change the base?
Conversation
64443a6
to
6d9267d
Compare
Related PR: #7500 |
Thanks for the link @fendor. I can see you've put a lot of effort into a larger scoped change. |
This looks plausible to me. We definitely need a test and changelog entry -- though I understand this only makes sense to do if the feature is generally agreed upon, which I can't guarantee by myself. I'll bring it up in the dev meeting on Thursday. |
Warning These problems with an older implementation no longer exist. Because this uses Note I'm suprised to see
|
In investigating further, trying to build only the dependencies, I hit an error I've never seen before;
|
Maybe
Let me emphasise that those are only the targets within the project (as the help already points out) and that different commands can interpret their arguments more liberally (e.g. any package-id is a valid target for |
@philderbeast Ill give it a proper review ASAP |
6d9267d
to
262b008
Compare
I dislike the |
What about |
Can we have a
|
Yes @michaelpj a subcommand instead is a possibility. As implemented this is acting as |
I like |
I favour
|
-1 for attaching this to
Make is different because a) it doesn't have sub-commands and b) the only operation on targets is building them. Food for thought: https://doc.rust-lang.org/cargo/commands/cargo-metadata.html |
My main motivation for this change, no matter which command or subcommand or option we put it under, is to help interactive use of cabal itself and not for producing a machine readable format for IDE tooling like the |
I understand and support this motivation. I think we should avoid too many top-level commands, as I fear trouble down the line with UX and discoverability. While |
2887bc1
to
14f3985
Compare
We have targets when there is no actual project file, when there is just a |
So a top-level |
What else would we do with targets rather than list them that is not already covered by other commands taking targets? Perhaps we should pluralize it as |
14f3985
to
adeb5cf
Compare
Let's keep discussing this. Does anybody remember the conclusions of the discussion of the command names (related to |
adeb5cf
to
ed75265
Compare
- unrecognized 'v2-target' option `-vverbose +markoutput +nowrap' - unrecognized 'v2-target' option `--builddir' - unrecognized 'v2-target' option `-j1'
29cb4b8
to
7f1f5be
Compare
The suggested changes were made.
Fixes #8953. Adds a
cabal target
command for showing targets that can be supplied to other commands like thecabal build
command.Motivation
When a project has but one package the targets are easy to find by looking inside the
.cabal
file but when a project has hundreds of packages that method is hard with information under layers of folders and files.Using grep in
.cabal
files is tough to get right when we need to exclude stuff that is not in the project.Here's
all:exes
found with this new target command:The initial motivation would have been #8953. Other related issues are #8683, #9732, #1382 and #4070.
Help
Here's the help;
$ cabal --help ... [project building and installing] + target Disclose selected targets. build Compile targets within the project.
The command specific help, a lot of which is taken straight from the user guide on target forms;
Use
The command in action on the haskell/cabal project:
Note
Tests are included above because the project enables them:
cabal/cabal.project
Line 6 in 1082c0b
The query 'all' is used when none is given.
significance: significant
in the changelog file.QA Notes
cabal target
is a new command that produces a list of fully-qualified targets. Please check that these are unique. I haven't added a module test tocabal-testsuite/PackageTests/Target/cabal.test.hs
but it does work: