Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Global extra-dep, or, how to separate public and private code? #2246

Closed
mtolly opened this issue Jun 6, 2016 · 1 comment
Closed

Global extra-dep, or, how to separate public and private code? #2246

mtolly opened this issue Jun 6, 2016 · 1 comment
Milestone

Comments

@mtolly
Copy link
Contributor

mtolly commented Jun 6, 2016

This is both a specific question and a broader goal, so to avoid an XY problem I'll explain both.

I have an open source program built with Stack in a public repo. I also have a closed source library in a private repo. The open source program can optionally use the closed source library. I want to make it easy to build both with and without it.

My idea is to use a flag in the program's .cabal file:

flag UseClosedLib
  default:             False
  description:         Use optional extra library

executable myprog
  if flag(UseClosedLib)
    build-depends:       closed-lib
    cpp-options:         -DUSECLOSEDLIB

Then, since I have both repos on my local system, I'd like to just configure my global Stack settings to know where closed-lib is located:

packages:
- location: /Users/mtolly/git/closed-lib
  extra-dep: true

This is because, ideally, I want the program's repo to be in a state to build without the add-on by default, and I don't want to have to keep the stack.yaml in a modified state in my local copy of the public repo.

But, as per the Stack documentation, it's not possible to specify project-specific options such as extra dependencies in the global Stack config. Is there another way I can do this? Or, do you have a better idea for how I can set this up?

@mgsloan
Copy link
Contributor

mgsloan commented Jun 6, 2016

Multiple configurations / transient configuration would support this nicely. See #1568

In practice, we just handle this by creating a docker image with the private dep already installed.

Ideally we'd be able to ignore the repo if it's not needed, but we don't know the name of the package stored in the repo till it's downloaded..

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

No branches or pull requests

2 participants