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 DSL improvements #4028

Merged
merged 6 commits into from
Oct 23, 2016
Merged

Conversation

grayjay
Copy link
Collaborator

@grayjay grayjay commented Oct 22, 2016

Three commits:

Update solver unit tests for Buildable field.

This commit modifies the tests so that they disable executables instead of
libraries. Disabling executables with Buildable: False is a more realistic
test case.

See #3988.

Refactor 'UnitTests.Distribution.Solver.Modular.DSL.exAvSrcPkg'.

Previously, the solver DSL ignored some types of dependencies when they appeared
in executables or under flags. This commit uses one function, mkBuildInfoTree,
to create all BuildInfos, so that any dependency can be used in any location.

Run package checks on the GenericPackageDescription created by the solver DSL.

The checks might detect some errors in the DSL. The commit also adds non-default
values to some fields to make the checks pass, such as adding a default-language
to each component.

Related to #3784

/cc @ezyang
I don't know if you need the first commit for #3988, since #4023 was merged, but I still think it's an improvement.

This commit modifies the tests so that they disable executables instead of
libraries.  Disabling executables with 'Buildable: False' is a more realistic
test case.
Previously, the solver DSL ignored some types of dependencies when they appeared
in executables or under flags. This commit uses one function, mkBuildInfoTree,
to create all BuildInfos, so that any dependency can be used in any location.
…lver DSL.

The checks might detect some errors in the DSL. The commit also adds non-default
values to some fields to make the checks pass, such as adding a default-language
to each component.
@mention-bot
Copy link

@grayjay, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edsko, @ezyang and @jdnavarro to be potential reviewers.

pkgCheckErrors =
let ignore = ["Unknown extensions:", "Unknown languages:"]
in [ err | err <- C.checkPackage (packageDescription package) Nothing
, not $ any (`isPrefixOf` C.explanation err) ignore ]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filtered out these two warnings because some unit tests test that the solver allows unknown extensions/languages when the compiler supports them. I don't know whether the unit tests or package checks are correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cabal hardcodes a list of known extensions and warns if it sees something it doesn't understand.

I think the reason we hardcode is because some extensions require special handling: e.g., TemplateHaskell. But the vast majority of extensions don't get any special handling. This raises an interesting question: for an extension we've never seen before, should we assume that it does or does not need special handling? If the former, the warning is appropriate; if the latter, we really ought to only define extensions which we do handle specially. But maybe this is too much for a simple PR like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. If most extensions don't need special handling, and we can get their names directly from the compiler, then it seems like it would be simpler to not define all of them.

I'll just add a comment to the line above for now.

@ezyang
Copy link
Contributor

ezyang commented Oct 22, 2016

I haven't looked too closely, but any refactoring of the solver DSL is fine by me. But the quickchecks are failing! (Let me know if there is anything in particular you'd like me to look at.)

@grayjay grayjay force-pushed the buildable-solver-tests-2 branch from 0055173 to e52e16e Compare October 23, 2016 03:00
@grayjay
Copy link
Collaborator Author

grayjay commented Oct 23, 2016

@ezyang Thanks. The main reason that I cc'ed you is that the change relates to #3784 and #3988.

The tests pass now. I just needed to disallow unconstrained dependencies on base in the quickcheck tests so that the package checks pass.

@ezyang
Copy link
Contributor

ezyang commented Oct 23, 2016

Go for it :)

@grayjay grayjay force-pushed the buildable-solver-tests-2 branch from 71841c6 to e5bf467 Compare October 23, 2016 18:05
@grayjay grayjay force-pushed the buildable-solver-tests-2 branch from e5bf467 to cb6603a Compare October 23, 2016 18:07
@grayjay
Copy link
Collaborator Author

grayjay commented Oct 23, 2016

Thanks! I'll merge it now.

@grayjay grayjay merged commit 266c5aa into haskell:master Oct 23, 2016
@grayjay grayjay deleted the buildable-solver-tests-2 branch October 23, 2016 21:51
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.

3 participants