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

Prevent dependency on private library #5848

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@fgaz
Copy link
Collaborator

fgaz commented Jan 16, 2019

This will make Cabal error out when depending on a private library.

It does not give detailed info on which sublibrary is the culprit because that would require changing the dependencySatisfiable and finalizePD return types, and that touches A LOT of the codebase. It can be done later.

/cc @ezyang @phadej

TODO:

  • on older ghcs treat all internal libraries as private and all main libraries as public, instead of "everything is private"

Closes #5806

@fgaz fgaz added the Cabal: other label Jan 16, 2019

@fgaz fgaz added this to the 3.0 milestone Jan 16, 2019

@fgaz

This comment has been minimized.

Copy link
Collaborator Author

fgaz commented Jan 16, 2019

Oops, of course on ghc <8.8 all libraries are private 🤦‍♂️

@fgaz fgaz referenced this pull request Jan 24, 2019

Open

Release for GHC 8.8 #5819

@fgaz fgaz referenced this pull request Feb 2, 2019

Open

Post-multilibs checklist #5660

3 of 12 tasks complete

@fgaz fgaz force-pushed the fgaz:prevent-dep-on-private-lib branch from af482b4 to 6d5ab50 Feb 3, 2019

@fgaz

This comment has been minimized.

Copy link
Collaborator Author

fgaz commented Feb 3, 2019

Hmm, this probably requires to add visibility to Basic, so we can turn it into LibraryVisibilityPublic if it's a LMainLibName

@fgaz fgaz force-pushed the fgaz:prevent-dep-on-private-lib branch from 451db42 to 2d0bfac Feb 4, 2019

fgaz added some commits Jan 16, 2019

Always mark main (unnamed) libraries as public
ghc-pkg<8.8 cannot read the visibility field, so all libraries were reported
as private, even the main (unnamed) one. This commit forces the
visibility of main libraries to be "public".

This commit can be reverted once we stop supporting GHC<8.8, at the
condition that we keep marking main libraries as public when registering
them.
--accept some tests
Related to the previous two commits (preventing dependency on private
libraries and marking main libraries as public)

@fgaz fgaz force-pushed the fgaz:prevent-dep-on-private-lib branch from 2d0bfac to 86daec5 Feb 4, 2019

@fgaz fgaz requested review from phadej, ezyang, 23Skidoo and hvr Feb 4, 2019

@fgaz

This comment has been minimized.

Copy link
Collaborator Author

fgaz commented Feb 4, 2019

This is now complete and reviewable

(Sorry for the mass ping)

@phadej
Copy link
Collaborator

phadej left a comment

It would be nice if we had a test that depending on a private lib fails as expected.

Adding a positive variant is possible only when GHC-8.8 is out, please make an issue about that.

@hvr
Copy link
Member

hvr left a comment

I'm not so sure anymore we should merge this; I'm still discussing this with @fgaz

@phadej

This comment has been minimized.

Copy link
Collaborator

phadej commented Mar 3, 2019

@hvr why

I'm not so sure anymore we should merge this;

?

@fgaz

This comment has been minimized.

Copy link
Collaborator Author

fgaz commented Mar 4, 2019

@phadej

Concerns about the narrow ghc compatibility. As it is, this patch only allows multilibs on GHC<8.8 and doesn't provide an override. If it did (for example when using --exact-config), then cabal-install could make multilibs work even on older GHCs by getting the visibility info from an IPI-external source.

Also this makes cabal-install fail after build plan construction, which is not pleasant, but the only way to solve that is to make the solver sublibrary-aware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.