-
Notifications
You must be signed in to change notification settings - Fork 696
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 'all-packages' section to cabal.project files #4972
Conversation
Prior to this we had options that apply to all local packages, or options that apply to specific named packages. This new section allows all the same options but applies them to all packages local or not.
are options to "all local packages" specified on-top-level, or do they have own section? |
Yeah, top level. I was pondering adding an optional section, but then I'd have to think about what that redundancy means for the various round-trip properties. |
Can you please add some documentation to the manual? The relevant section is https://github.com/haskell/cabal/blob/master/Cabal/doc/nix-local-build.rst#configuring-builds-with-cabalproject. |
In the user guide, changelog and add a few code comments.
Done https://github.com/haskell/cabal/pull/4972/files#diff-f6c65c922526baba295563ecf772af73, plus changelog and code comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Yeah, and also program locations. I can make it a separate PR. |
I think we should also allow the |
There's an AppVeyor failure that looks legit, but I haven't looked into it thoroughly. |
How is precedence handled? Do more specific sections overwrite each other or do the combine monoidally (for list-like properties?) If I wanted something like following:
can I express this now? PS: If all matching sections combine like monoids, we may run into expressibility issues for list-like properties (c.f. similiar issue in |
I've restarted the AppVeyor build, and it's green now. If the failure happens again, we'll need to look into it in more thoroughly. |
Yes, monoidal, just like local + specific. This makes it all + local + specific.
Yes:
Yes. That general problem still exists. This doesn't make it better or worse. |
@dcoutts that sounds great; I only have a minor bikeshedding concern/question: why not use a more "uniform" syntax? Say we wanted to extend the syntax to allow globbing, like e.g.
wouldn't it be more uniform if
? |
@dcoutts IIUC, the problem described in #3579 will still exist with this solution, because
doesn't allow to distinguish between local package Cabal and lib:Cabal used to build setup scripts of dependencies. Admittedly a small problem, though, since only lib:Cabal is special in this way, and you can do something like
|
@hvr I was worried someone might suggest that. :-) But now that I've thought about it for a bit, I think it's not that hard. Let me have a go. |
@dcoutts Just something to take into account: in future we may also need to be apply/inject options at a per-component granularity (for packages which are per-component capable at least); e.g. you may want to inject
or something like that, where
Just wanted to write this down somewhere... so it doesn't get lost... I hope I haven't increased your worry-level :-) |
Yeah, once you start thinking about it you realise that there's probably a whole expression language for selecting which packages/components options should apply to and under what circumstances (e.g. different named configurations, perhaps like flags in .cabal files). Remember that ultimately I want us to be able to have multiple different configurations active at once, e.g. building frontend & backend together with ghc & ghcjs. So one wrinkle I've already discovered is that solver options cannot so easily be applied per-package in a style in which these sections are However, if we can impose the restriction that per-package solver flags can only be listed in sections with "enumerable" globs, and not wildcard globs then we can make it work, e.g. Allowed:
Not allowed:
Sound acceptable? |
Can't we expand wildcard globs after reading in the package index, but before running the solver? |
Perhaps so now. Previously we tried hard to avoid looking at most packages, but I guess this is just based on package name so the index/cache will handle it. I would need to make the glob matching more efficient however to be able to run in on all the package names. |
Adding some kind of trie-based structure for looking up package names may be required. |
I'd just want to point out that I don't expect for us to implement proper globbing/ |
Merged manually, see ab585e8. |
Prior to this we had options that apply to all local packages, or options that apply to specific named packages. This new section allows all the same options but applies them to all packages local or not.
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!