You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for (some) cabal.project-fields to cabal script-metadata #5698
The basic script feature (see #3843) implemented has support for including package-description/buildinfo fields but didn't yet implement support for project metadata.
At the very least fields such as index-state, with-compiler, allow-{newer,older} and constraints shall be supported as exemplified in the example below
Using the parser for cabal.project and automatically writing it to the same fake-package seems rather easy to me! Are there more complex interactions that I should be aware of?
EDIT: the syntax cabal:[<cabal-spec-version>] does not seem to parse.
I think that rather than altering the grammar for this bloc (which now simply obeys a portion of cabal file grammar) we should just add another config bloc that obeys cabal.project/cabal.config grammar. (the former is I believe a superset of the latter). This should be much easier to implement.
Reacted by Zoe Zuser, Mikolaj Konarski, Javier Neira and Artem Pelenitsyn
I think it looks clean, but might be confusing because -- project: looks like a comment.
It also has the disadvantage that comments are valid inside of the block.
That split sounds good to me. Less likely to break preexisting codes that
take advantage of the scripting support too? (Which probably don’t exist
but it’s nice to dream)
Activity
phadej commentedon Nov 19, 2018
allow-newer23Skidoo commentedon Nov 19, 2018
We should also think about the backwards compat story for
{- cabal:blocks while we're at it.hvr commentedon Nov 19, 2018
@phadej good catch!
@23Skidoo
cabal:afaik is versioned; i.e. it's actually{- cabal:[<script-spec-version>](and the spec ver is optional)23Skidoo commentedon Nov 20, 2018
@hvr
Is it documented somewhere which
script-spec-versionis the implicit one?23Skidoo commentedon Nov 20, 2018
Not against this proposal, but wouldn't something like
work too?
hvr commentedon Nov 21, 2018
@23Skidoo Unfortunately, what is allowed under POSIX for portable shebang scripts is very limited; see https://en.wikipedia.org/wiki/Shebang_(Unix)#Portability for the sad story
TLDR: the answer is "no" :-)
23Skidoo commentedon Nov 21, 2018
okay.jpg
cartazio commentedon Nov 21, 2018
does this require the file be named Main.hs or have a module main? (i'm kinda interested in just making sure its easy to check / validate them?)
Add with-compiler field for cabal scripts
maoe commentedon Mar 30, 2020
+1 to this feature. I also would like to be able to set
verbose: 0to suppress build messages.fendor commentedon Apr 30, 2020
@23Skidoo
According to the code:
https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Client/CmdRun.hs#L473
It looks like
2.2And according to the parsing of the script-block: https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Client/CmdRun.hs#L379
It uses the latest cabal-spec-version for parsing. Not sure if this means that it actually cant be overriden.
It seems the current parser for meta-data allows anything that can be written in an executable stanza (it is actually possible to provide a
main-isfield, but it is overriden later on without warning).Using the parser for
cabal.projectand automatically writing it to the same fake-package seems rather easy to me! Are there more complex interactions that I should be aware of?EDIT: the syntax
cabal:[<cabal-spec-version>]does not seem to parse.gbaz commentedon Feb 17, 2022
I think that rather than altering the grammar for this bloc (which now simply obeys a portion of cabal file grammar) we should just add another
configbloc that obeys cabal.project/cabal.config grammar. (the former is I believe a superset of the latter). This should be much easier to implement.bacchanalia commentedon Feb 18, 2022
How do we feel about the following syntax?
I think it looks clean, but might be confusing because
-- project:looks like a comment.It also has the disadvantage that comments are valid inside of the block.
Alternate:
Should the header be
cabal.projector justproject?gbaz commentedon Feb 18, 2022
I lean towards
projectas the header.I was actually thinking two blocs entirely as in
cartazio commentedon Feb 18, 2022
Add support for cabal.project fields to scripts
Add support for cabal.project fields to scripts
Add support for cabal.project fields to scripts
Add support for cabal.project fields to scripts
Add support for cabal.project fields to scripts