Skip to content
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

Provide a way to specify different ghc options for dependencies #16

Open
jgm opened this issue Jan 23, 2019 · 5 comments
Open

Provide a way to specify different ghc options for dependencies #16

jgm opened this issue Jan 23, 2019 · 5 comments

Comments

@jgm
Copy link

jgm commented Jan 23, 2019

If I do

sh packcheck.sh cabal-new GHCVER=8.4.3 GHC_OPTIONS="-O0 -Werror -Wall"

then the build fails because of warnings compiling some of the dependencies. I'd like to be able to specify -Werror for the local build only, and not for the dependencies. This would require a two-phase build, first with cabal new-build --dependencies-only, and the ability to specify different options for the dependencies and the local build. (Or is there another way to work around this?)

(Great project, by the way! Aside from this issue, it is what I have been dreaming of.)

@harendra-kumar
Copy link
Member

@jgm thanks for raising the issue and for the feedback. I am aware of this issue, this shows only in cabal-new build, stack build does not have this issue as stack does not pass the ghc options to all dependencies by default. This is annoying, and I do not pass -Werror to cabal builds because of this.

This would require a two-phase build, first with cabal new-build --dependencies-only, and the ability to specify different options for the dependencies and the local build. (Or is there another way to work around this?)

I can try what you suggested. It would be nice if cabal itself supported a flag that passes ghc options only to the local packages and not dependencies. I am not really familiar with all of cabal's options. @hvr would you have an idea how to solve this in a nice way?

@harendra-kumar
Copy link
Member

@jgm using --only-dependencies in the first phase of a two-phase build does not solve this issue. cabal still rebuilds all dependencies if a different GHC flag is specified in the second build phase. I think this can only be solved once haskell/cabal#3883 gets resolved.

@harendra-kumar
Copy link
Member

@jgm #21 implements CABAL_PROJECT environment option to specify a custom cabal project file to solve this problem as suggested in the cabal issue mentioned above.

@jgm
Copy link
Author

jgm commented Jul 6, 2019

Seems tedious to have to maintain two separate cabal.project files, one for local builds and one for CI.

@harendra-kumar
Copy link
Member

See #43 , that might solve this in a better way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants