Skip to content

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

Closed

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.

Activity

  1. fgaz commented on Aug 30, 2021

    @fgaz
    Member

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

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

  2. gbaz commented on Aug 30, 2021

    @gbaz
    Collaborator

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

  3. added
    cabal-install: v2-build system
    on Aug 30, 2021
  4. jneira commented on Mar 5, 2022

    @jneira
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cabal-install: v2-build systemtype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions