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

Introduce checks for upper dependencies in setup. #5370

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@qnikst
Copy link
Collaborator

qnikst commented Jun 9, 2018

setup depends are now checked for having upper dependencies.
Upper bounds are mandatory for base and Cabal libraries, and
are optional (but emit warning) for other libraries.
Implicit dependencies are not being checked.

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!

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jun 9, 2018

Re: tests, something like PackageTests/AutogenModules/Package/setup.test.hs will do (basically just run configure or check and then use assertOutputContains to check that the messages are present).

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jun 9, 2018

Implicit dependencies are not being checked.

You mean for pre-setup-depends build-type: Custom packages?

@qnikst

This comment has been minimized.

Copy link
Collaborator Author

qnikst commented Jun 9, 2018

I don't cover cases like: #4683 (comment) or if dependency on a Cabal exists due to the dependency on the other package.

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jun 9, 2018

That's fine.

@23Skidoo
Copy link
Member

23Skidoo left a comment

LGTM modulo minor comments.

| otherwise = emitWarning nm
emitError nm =
PackageDistInexcusable $
"The dependency 'build-depends: '"++nm++"' does not specify an "

This comment has been minimized.

Copy link
@23Skidoo

23Skidoo Jun 9, 2018

Member

s/build-depends/setup-depends/.

Right (pkgs', _) ->
Map.fromListWith intersectVersionRanges
[ (pname, vr)
| Just spi <- pure $ setupBuildInfo pkgs'

This comment has been minimized.

Copy link
@23Skidoo

23Skidoo Jun 9, 2018

Member

I think you can use maybeToList here. Also, "spi" should be "sbi" ("bi" by convention means "build info").

Introduce checks for upper dependencies in setup.
setup depends are now checked for having upper dependencies.
Upper bounds are mandatory for base and Cabal libraries, and
are optional (but emit warning) for other libraries.
Implicit dependencies are not being checked.

@qnikst qnikst force-pushed the gh-5317 branch from fda37d9 to 308fb32 Jun 9, 2018

@qnikst

This comment has been minimized.

Copy link
Collaborator Author

qnikst commented Jun 9, 2018

@23Skidoo I've addressed your comments and added a test case.

@qnikst qnikst force-pushed the gh-5317 branch from cc745b8 to ff3b154 Jun 10, 2018

@quasicomputational

This comment has been minimized.

Copy link
Collaborator

quasicomputational commented Jun 10, 2018

Coincidentally, I've just implemented making check play nicely with cabal-testsuite in #5372. I could split that commit off into its own PR and merge that if you think it'd make this PR's test any nicer.

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jun 10, 2018

A bunch of solver tests now fail...

@@ -0,0 +1,24 @@
import Test.Cabal.Prelude

-- Test that setup shows all the 'autogen-modules' warnings.

This comment has been minimized.

Copy link
@23Skidoo

23Skidoo Jun 10, 2018

Member

Copy-pasto.

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jun 10, 2018

I could split that commit off into its own PR and merge that if you think it'd make this PR's test any nicer.

Thanks, but I think we can update the tests that run cabal check after your PR has been merged.

@qnikst

This comment has been minimized.

Copy link
Collaborator Author

qnikst commented Jun 10, 2018

I'll need to make this change more complex, currently cabal does not distinguish between -any and no dependency set at all. As a result it's not possible to silence the warning by passing -any.

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jun 10, 2018

The change we want to do is replace data Dependency = Dependency PackageName VersionRange with data Dependency = Dependency PackageName (Maybe VersionRange) so that it'd be possible to distinguish between build-depends: foo -any and build-depends: foo.

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.