cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Is it possible to new-configure `--ghc-options=-Wall` for a particular local package?

Open lspitzner opened this issue 8 years ago • 6 comments

I just did the above and cabal decided to recompile the deps (which is a bit surprising on its own, but probably correct since deps might start breaking if they had -Werror as well..).

I gather that I can do

package mypackage
  ghc-options: -Wall

manually in cabal.project.local but that'll get overwritten by the next new-configure.

#4271 seems somewhat related.

lspitzner avatar Jun 28 '17 08:06 lspitzner

Hmm, I thought we already had a ticket for this, but I can't find it right now. @hvr, maybe you remember?

23Skidoo avatar Jun 28 '17 10:06 23Skidoo

Now that i search again, I see #3883 and #4247. The only difference/addition that I spot is that this is about new-configure, i.e. about how flags translate to cabal.project.local, which is an aspect not mentioned in #3883.

lspitzner avatar Jun 28 '17 10:06 lspitzner

(commandline-flags, not package flags)

lspitzner avatar Jun 28 '17 10:06 lspitzner

It would indeed be convenient if we had a CLI syntax for new-configure to specify the scope of e.g. ghc-options for e.g. placing it into a specific package foo section. But I'm not sure how to design the UI for that, as e.g. --ghc-options foo:-Wall would require us to steal potential syntax from the GHC CLI...

hvr avatar Jun 28 '17 10:06 hvr

perhaps just adding --PROG-options-global and --PROG-options-local (and perhaps defaulting/redirecting --PROG-options to the latter) is an acceptable solution? I don't see a straight-forward solution to something more fine-grained (per-package) either.

(perhaps: the --RTS/+RTS/-RTS style of cascading?

--package mypackage --package-specific-flag1 --package-specific-flag2 or +package mypackage --package-specific-flag1 --package-specific-flag2 -package ?

but i don't want to have to parse that either, especially in combination with -- run-args that new-build should support..)

lspitzner avatar Jun 28 '17 10:06 lspitzner

Some ideas:

  • --package foo --ghc-options -Wall
  • --package-ghc-options foo=-Wall
  • --package-foo-ghc-options -Wall

I haven't thought about which one of these would be easiest/hardest to implement.

23Skidoo avatar Jun 28 '17 10:06 23Skidoo