-
Notifications
You must be signed in to change notification settings - Fork 701
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
Implement build-tool-depends #4104
Conversation
@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ezyang, @dcoutts and @phadej to be potential reviewers. |
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.
Commit 1 review.
-- | Describes a legacy `build-tools`-style dependency on an executable | ||
-- | ||
-- It is "legacy" because we do not know what the build-tool referred to. It | ||
-- could refer to a pkg-config executable (PkgconfigName), or an internal | ||
-- executable (UnqualComponentName). Thus the name is stringly typed. | ||
-- | ||
--g |
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.
oops
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.
:)
PackageName | ||
UnqualComponentName -- name of executable component of package | ||
VersionRange | ||
deriving (Generic, Read, Show, Eq, Typeable, Data) |
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.
It is possible that you may want a helper function that takes an ExeDependency and gives a ComponentName (since the UnqualComponentName is only "implicitly" qualified.) I don't know if you'd actually use it.
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.
Sure, doesn't hurt to add it now. Good hint on unqual vs qual for anyone working with the code base.
|
||
parse = do name <- parse | ||
_ <- Parse.char ':' | ||
exe <- parse |
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.
OK, so right now you are forced to specify the executable name. That's fine (although our users might complain :)
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.
Besides laziness, I figured a blanket depend-on-all-the-exes dependency might complicate making the solver use deps on specific components. Then again we may need a blanket package dep anyways.
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.
Commit 3 (commit 2 was obvious, no problem.)
-- that we know how to desugar. | ||
-- | ||
-- This should almost always be used instead of just accessing the | ||
-- `toolDepends` field directly. |
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.
Ok, if that's true there better be a comment on toolDepends telling people about it, or rename that field to something to discourage people from using it directoy.
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.
I added some longer documentation to the relevant fields in the top commit. I'll also grep at the end to make sure nothing is lurking.
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.
I could sed the field names too, but probably easiest to do that last.
-- | ||
-- This is a tiny function, but used in a number of places. Note that the | ||
-- version bounds and components of the package are unchecked. This is because | ||
-- we sanitize exe deps so that the matching name implies these other |
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.
Where does this sanitizing happen.
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.
PackageDescription.Check
does sanitation happen in places besides that?
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.
I think the overall codebase doesn't use "sanitization" as the term here. Furthermore, not all checks in PackageDescription.Check
are necessarily run all the time: a package can still be built even if some of the checks fail. It is better to say that there is some invariant that is expected to hold; in that case the invariant description should be at the data type definition.
@@ -524,13 +525,42 @@ checkFields pkg = | |||
++ "for example 'tested-with: GHC==6.10.4, GHC==6.12.3' and not " | |||
++ "'tested-with: GHC==6.10.4 && ==6.12.3'." | |||
|
|||
, check (not (null buildDependsRangeOnInternalLibrary)) $ | |||
, check (not (null depInternalLibraryWithExtraVersion)) $ |
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.
I didn't read this code carefully. Good tests would tickle all of these cases.
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.
Whew! A lot of copy pasta but tested everything.
Looking good. Obviously you still need to do the cabal-install bits. |
f6d7e02
to
3269f83
Compare
How should I write the (presumably system) tests for those tests? I see the cabal files in |
b1487b4
to
fd11fbc
Compare
You may want to wait until #4095 is merged. |
Hmm good idea |
Hmm, so |
@Ericson2314 We got rid of this feature in af24cef. Internal library should always be used. |
fd11fbc
to
e298eee
Compare
e298eee
to
30b4fa8
Compare
|
2419889
to
e11029c
Compare
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.
It's helpful if the commit message mentions the overall code motion that occurred; especially here were some things got deleted, and other things got added.
Lookin' good! |
, let toolname = mkUnqualComponentName name | ||
, toolname `elem` map exeName (executables pkg_descr) ] | ||
| (ExeDependency _ toolname _) | ||
<- getAllInternalToolDependencies pkg_descr bi ] |
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.
Good.
-- precisely specify an executable in a package. | ||
-- | ||
-- Unless use are very sure what you are doing, use the function in | ||
-- `Distribution.FooBar` rather than accessing this field directly. |
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.
But... which function/!
NB: this shouldn't be merged until "Ok things left:" list is done. |
@ezyang what's the first todo item about? if it's about |
Looking at the source code, it doesn't look like the new-build code has been adjusted for tool-depends yet. But maybe no changes were needed; I don't know if it works or not; the tests would be able to say so. |
30e62d9
to
0b62af1
Compare
Modeled after the extern_build_tools test
…ild-tools` `build-tools` is described in terms of `build-tool-depends`, just as it is implemented in terms of it.
acfb6aa
to
a6cee38
Compare
Ok, docs are done also all that remains is |
Yep. Anything in particular you want reviewed before merging? |
let's get this merged soon before the PR starts to "conflict-rot" :-) |
This is a bug from `first build-tool-depends` PR: haskell#4104
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
@Ericson2314 It would be great if we could have a changelog entry too! |
I can't wait till this gets to hvr's ppa repository so I can try it out wild! |
@phadej ...I got the hint ;-) |
@ezyang OK I will do that in the PR that https://github.com/Ericson2314/cabal/tree/build-tool-depends-glob turns into. |
Thanks! |
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
This is a bug from `first build-tool-depends` PR: haskell#4104 Also, remove TODO about factoring things out. The exact set of deps filter here is no longer so globally relevant, and `Distribution.Simple.BuildToolDepends` exposes better filters which are.
Implements much of #3708
Note the the exe component name is currently mandatory, unlike as specified in the original issue.