-
Notifications
You must be signed in to change notification settings - Fork 709
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
Cherry-pick #4094 onto 1.24. #4125
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The addBuildableCondition function was added to solve the problem with "buildable: False". The problem was that we would solve or check dependencies on the basis of the component in question being needed, and then at the end discover that the component is actually not buildable at all, and if we'd known that up front we would not have solved for the component's dependencies. The trick that addBuildableCondition does is a syntactic transformation, from components like: executable blah buildable: False build-depends: foo >= 1, bar < 2 something-else: whatever to: executable blah -- empty! Or at least, that's the intention. In the above situation the implementation of addBuildableCondition returns an empty CondNode: CondNode mempty mempty [] The type at which mempty is used is important here. This transformation is used in two places: one in the solver and the other in finalizePD. In the solver the mempty is used at types from the PackageDescription: Library, Executable, TestSuite etc. So in this case the transformation works fine we end up with empty executables, test suites etc. In finalizePD however the mempty gets used at type PDTagged (which is sort of a union of Library, Executable etc plus none/null) and the mempty for PDTagged is PDNull which means it does not even specify which component we're referring to. So effectively that means instead of ending up with an empty executable in the above example, we end up deleting the executable entirely! This was a change in behaviour. Prior to adding addBuildableCondition the result of finalizePD would include non-buildable components and the rest of the build system infrastructure was set up to skip over them when building. The change was not noticed precisely because the rest of the system was already set up to ignore non-buildable components. This is not however a benign change in behaviour. In particular in cabal-install in the install plan we end up completley forgetting about all the non-buildable components. This means we cannot even report that components are non-buildable when users ask to build them, because we've completely forgotten that they exist. So this patch keeps the original addBuildableCondition for use by the solver since the solver uses it at sensible monoid types. The patch adds a special version for the PDTagged type which changes the transformation so that in the above example we end up with: executable blah buildable: False something-else: whatever So we've stripped out all the build-depends but we keep everything else, including of course the "buildable: False". (cherry picked from commit 40d1b4f)
Since this fixes haskell#3858 (cherry picked from commit 543b28a)
Very likely, given #4123. |
23Skidoo
approved these changes
Nov 20, 2016
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, feel free to merge once CI is green.
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added an entry to the changelog, but I'm not sure if the version is correct. Will there be a Cabal 1.24.1.1? I also had to copy the test for this issue in a separate commit.