-
Notifications
You must be signed in to change notification settings - Fork 697
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
Add flag to new-configure
for adding extra packages
to cabal.project.local
#3585
Comments
I think I understand what you are asking for, but just to make sure, can you give an example command line invocation, and what |
Sure! Straightforwardly enough, an invocation like
would write out a
|
OK I specced it out at top. PR welcome. |
👍 but for |
@aisamanra: is there a PR for this issue I can reference? |
There's no PR, |
I think @acfoltzer is asking me about a PR because he knows I've already implemented this, and sadly no, there's no PR/commit yet because I got busy with other things and didn't get around to adding proper tests for it, which I will do very soon. |
Well, feel free to PR even prior to tests. (If our test frameworks are so bad that it's stopping you from adding tests, that's a problem and we should fix it.) |
I was talking to @acfoltzer about this, but I should bring it up here, too: the first pass at implementing this feature just took the paths given to Given that the whole point here is that (The alternatives are to attempt to rebuild a different relative path that's relative to the project root instead—which is difficult and error-prone, especially in the presence of symlinks—or to stipulate that the thing I'm describing isn't a problem and that |
Well, one question is whether or not users expect to move a source dir from one folder to another and have the build products still work. What if you just did |
I'm going to veto |
I'm not sure why
isn't enough? What I'm trying to say, making |
fwiw, the benefit I could see of a |
I agree, if it’s a `v2-build` flag, then it’s in scope of `v2-configure`.
… On 26 Apr 2019, at 21.06, Herbert Valerio Riedel ***@***.***> wrote:
fwiw, the benefit I could see of a --(with-)packages flag is when it's also supported by cabal v2-build for when you want to control the build directly via CLI w/o the need of writing a project-file; or to temporarily augment the current project config ad-hoc with an additional local package without having to create a cabal.project.local or modify the cabal.project.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Summary by @ezyang. An invocation like
should write out a
cabal.project.local
that includesThe new flag would probably live in
ConfigExFlags
(Distribution.Client.Setup
). The top-level function which converts command line flags to project config iscommandLineFlagsToProjectConfig
inDistribution.Client.ProjectConfig.Legacy
. Thepackages
field incabal.project
is theprojectPackages
field; you would add it as another field setter to themempty
incommandLineFlagsToProjectConfig
.Don't forget to add a test to
integration-tests
orintegration-tests2
.What you will learn. How the configuration logic for Nix-style local builds (new-build) works, and in particular how the
new-configure
command is implemented.We can already include a
packages
field in bothcabal.project
and incabal.project.local
, andcabal new-build
will consult and use both. What I'd like—and AFAICT doesn't currently exist—is the ability to pass a flag tocabal new-configure
(maybe something likecabal new-configure --extra-project=path-or-url-of-cabal-project
) that will add the specified project locations (either local paths or, as per #2189, VCS urls) to the generatedcabal.project.local
file.This is useful for a few reasons. One use-case is when you depend on a library that's not part of the same project, is available on a local filesystem, and won't necessarily be in the same absolute or relative location on every developer's machine. Another use-case is when you want to locally override an existing dependency to specify a WIP version of that dependency either on the local filesystem or in a VCS. In both these cases, the location of the dependency—being a local detail—would belong in
cabal.project.local
instead of incabal.project
.The functionality to make this work is mostly already in place, except that
cabal.project.local
is usually generated bycabal new-configure
and there's no way to tell it to add a project except by hand-editing the generated file.The text was updated successfully, but these errors were encountered: