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 something like --extra-project-file #7596

Closed
robx opened this issue Aug 30, 2021 · 3 comments · Fixed by #7783
Closed

Provide something like --extra-project-file #7596

robx opened this issue Aug 30, 2021 · 3 comments · Fixed by #7783

Comments

@robx
Copy link
Collaborator

robx commented Aug 30, 2021

Say you have a somewhat involved cabal.project, e.g. referencing a number of dependency repositories. And say you want to build this with some different settings (e.g. without optimization for local dev, with some particular GHC settings for CI and production builds. Current ways to do that that I'm aware of:

  • maintain multiple versions of cabal.project.local, and manipulate those using external tools (e.g., copy cabal.project.local.ci over cabal.project.local in CI); this is quite error prone (overwrites local user config when testing, ...)
  • maintain multiple copies of the whole set cabal.project{,.freeze,.local}, e.g. by symlinking (fragile depending on OS, lots of files, unobvious)

Both approaches also lose the option of using cabal.project.local for what it appears to be meant for: local temporary changes. E.g. when debugging CI builds locally, I'd still like to be able to temporarily disable optimization by writing to the "local settings" file.

My suggestion (happy for other ways to improve the situation though!):

Add a flag --extra-project-file; any arguments to this are merged into the project config the way cabal.project.local is currently. I.e., cabal cmd --extra-project-file cabal.project.ci --extra-project-file cabal.project.debug would merge the config by starting with cabal.project, then updating the settings in turn (and in that order) by cabal.project.ci, cabal.project.debug and cabal.project.local.

@fgaz
Copy link
Member

fgaz commented Aug 30, 2021

Similar features were also discussed in #7556 (comment) #3738 (comment)

edit: i'm not implying this is a duplicate, just referencing stuff

@gbaz
Copy link
Collaborator

gbaz commented Aug 30, 2021

I think the former could be done in a way that subsumes this, by giving include clauses in projects an associated command line flag.

@jneira
Copy link
Member

jneira commented Mar 5, 2022

include files in cabal.project would be added by #7783

@jneira jneira linked a pull request Mar 5, 2022 that will close this issue
2 tasks
@mergify mergify bot closed this as completed in #7783 Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants