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

Solver: Enforce dependencies on libraries (fixes #779). #5304

Merged
merged 3 commits into from
May 9, 2018

Conversation

grayjay
Copy link
Collaborator

@grayjay grayjay commented May 6, 2018

Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!


The first two commits only modify the tests:

Solver DSL: Support benchmarks, internal libraries, and foreign libraries.

This change allows the solver quickcheck tests to test all types of components.
Previously, the tests generated the components in the solver DSL, but the code
that converted the packages to GenericPackageDescriptions removed some of the
components, i.e., it filtered out benchmarks and foreign libraries and merged
internal libraries with the main library.

Solver DSL: Support packages without libraries.

The solver DSL previously always added a default library component.

Solver: Enforce dependencies on libraries (fixes #779).

This commit generalizes the fix for issue #4781
(e86f838) by tracking dependencies on
components instead of dependencies on executables. That means that the solver
always checks whether a package contains a library before using it to satisfy a
build-depends dependency. If a version of a package doesn't contain a library,
the solver can try other versions. Associating each dependency with a component
also moves towards the design for component-based dependency solving described
in issue #4087.

/cc @kosmikus

grayjay added 3 commits May 5, 2018 18:29
…ries.

This change allows the solver quickcheck tests to test all types of components.
Previously, the tests generated the components in the solver DSL, but the code
that converted the packages to GenericPackageDescriptions removed some of the
components, i.e., it filtered out benchmarks and foreign libraries and merged
internal libraries with the main library.
The solver DSL previously always added a default library component.
This commit generalizes the fix for issue haskell#4781
(e86f838) by tracking dependencies on
components instead of dependencies on executables.  That means that the solver
always checks whether a package contains a library before using it to satisfy a
build-depends dependency.  If a version of a package doesn't contain a library,
the solver can try other versions.  Associating each dependency with a component
also moves towards the design for component-based dependency solving described
in issue haskell#4087.
@23Skidoo
Copy link
Member

23Skidoo commented May 8, 2018

Thanks for doing this! @fgaz, I think this is relevant to your GSoC project.

@23Skidoo
Copy link
Member

23Skidoo commented May 8, 2018

Looks good from what I can tell, please feel free to merge unless @kosmikus objects.

@23Skidoo 23Skidoo merged commit 6efb5e2 into haskell:master May 9, 2018
@23Skidoo
Copy link
Member

23Skidoo commented May 9, 2018

Merged, thanks! Can you please also add a changelog note?

@kosmikus
Copy link
Contributor

kosmikus commented May 9, 2018

Superficially looks good to me as well, but I haven't looked at the changes in very much detail. Thanks.

grayjay added a commit to grayjay/cabal that referenced this pull request May 13, 2018
grayjay added a commit to grayjay/cabal that referenced this pull request May 13, 2018
@grayjay grayjay deleted the issue-779 branch May 13, 2018 06:35
@grayjay
Copy link
Collaborator Author

grayjay commented May 13, 2018

Thanks! I updated the changelog in #5316.

grayjay added a commit to grayjay/cabal that referenced this pull request May 13, 2018
23Skidoo pushed a commit that referenced this pull request May 13, 2018
@hvr
Copy link
Member

hvr commented May 13, 2018

@grayjay is this expected to fix issues like with the following situation where build-depends refers to a package whose library component is unavailable, e.g.:

cabal-version:2.2
name: zzz
version: 0

library
  build-depends: http-client == 0.5.12.1 || == 0.5.12
$ cabal new-build -w ghc-7.8.4 --index-state='2018-05-09T06:20:23Z'
Error:
    Dependency on unbuildable library from http-client
    In the stanza 'library'
    In the inplace package 'zzz-0'

where I'd expect the cabal solver to backtrack, and find the solution with http-client-0.5.12

@grayjay
Copy link
Collaborator Author

grayjay commented May 13, 2018

No, this change only checks whether the library stanza exists. Checking that the library is buildable will probably require implementation of the "Component on/off" variable from #4087 (comment).

@hvr
Copy link
Member

hvr commented Jun 8, 2018

@23Skidoo I had to cherry-pick this one to 2.2 as well as #5337 needed this to cherry-pick cleanly to 2.2

See fe2110d & 4bdf0aa

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

Successfully merging this pull request may close these issues.

build-depends on packages that provide no library
4 participants