-
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
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
As a brief aside, in my view, the Stack 'information' UI is suboptimal (i.e. not to be emulated) but the 'costs' of getting to a better UI would outweigh the relative benefits of the end point. If |
@mergify refresh |
✅ Pull request refreshed |
@mergify refresh |
✅ Pull request refreshed |
@Mikolaj this one has been "ready and waiting" longer than I'd expect. |
It says the label was auto-assigned "2 days ago", so maybe it's fine. Let's monitor... |
@mergify queue |
🛑 The pull request has been removed from the queue
|
This pull request has been removed from the queue for the following reason: The pull request can't be updated You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
@Mergifyio unqueue |
☑️ The pull request is not queued |
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
@Mergifyio requeue |
☑️ This pull request is already queued |
Hmm, strange, it says "This pull request is already queued", but the queue is empty. But maybe that's normal for no-rebase PRs. Let's give it some time. |
Thanks for taking a look and nudging it forward. Hovering over the "2 days ago" label shows the exact time. |
No idea what it was, but manually applying label merge_delay_passed fixed it. I'm a bit lost on whether merge_delay_passed is superseded by ready_and_waiting and, if not, why it wasn't auto-applied here. |
Note that it says above " |
|
@mpilgrem could we add the new commands but keep the old ones for a while (and cloak them)? |
Fixes #8953. Adds a
cabal target
command for showing targets that can be supplied to other commands like thecabal build
command.Note
Comments prior to #9744 (review), prior to Jun 26 2024, refer to an earlier implementation that was a cut down build command. The newer implementation is based off of a suggestion by @andreabedini.
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: