Skip to content

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

Closed
@robx

Description

@robx

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions