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

Does the build plan include dependencies of sub-libraries that aren't built? #8143

Closed
danidiaz opened this issue May 17, 2022 · 3 comments
Closed

Comments

@danidiaz
Copy link
Collaborator

danidiaz commented May 17, 2022

Hi, I have a question about how the public sublibraries feature of Cabal works.

Take this repo as an example.

In the repo, the tests in package wumpus-json depend on a public sublibrary ("wumpus-test-support") of wumpus. But the main library of wumpus-json doesn't depend on the sublibrary.

graph TD
    wumpus-json --> wumpus
    wumpus-json-test --> wumpus
    wumpus-json-test --> wumpus-test-support
Loading

If I put an unsatisfiable dependency on the build-depends: of the "wumpus-test-support" sublibrary, and then try to build the main library of "wumpus-json" with cabal build wumpus-json:lib:wumpus-json, I get a build plan error. I thought that perhaps it could still compile, given that the "wumpus-test-support" sublibrary is not required in this case—only for the tests.

Is this the expected behavior?

(I'm using cabal-install 3.6.2.0)

@Mikolaj
Copy link
Member

Mikolaj commented May 17, 2022

OOI, if you have a single main library and an executable that does not use it, does cabal build the main library when you ask it specifically to run the executable?

@danidiaz
Copy link
Collaborator Author

danidiaz commented May 17, 2022

if you have a single main library and an executable that does not use it, does cabal build the main library when you ask it specifically to run the executable?

No, it doesn't build the library.

However, if I put an unsatisfiable dependency on the build-depends: of the library and try to build the executable, the build fails.

Perhaps related to per-component dependency solving? #4087?

@fgaz
Copy link
Member

fgaz commented May 17, 2022

Perhaps related to per-component dependency solving? #4087?

Yes, that's exactly it. Closing in favor of #4087.

I wonder what's the state of that ticket

@fgaz fgaz closed this as completed May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants