-
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
Clarify build-tool-depends a bit more #5561
Conversation
Cabal/doc/developing-packages.rst
Outdated
@@ -2063,16 +2063,22 @@ system-dependent values for these fields. | |||
.. pkg-field:: build-tool-depends: package:executable list | |||
:since: 2.0 | |||
|
|||
A list of Haskell programs needed to build this component. | |||
A list of Haskell executabes needed to build this component. |
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.
typo at "executabes"
Cabal/doc/developing-packages.rst
Outdated
|
||
Cabal can make sure that specified programs are built and on the ``PATH`` before building the component in question. | ||
It will always do so for internal dependencies, and also do so for external dependencies when using Nix-style local builds. | ||
Cabal makes sure that specified programs are built and provided on the ``PATH`` before building the component in question under following conditions: |
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.
Maybe we could while at it also address #5418 (comment)
Cabal/doc/developing-packages.rst
Outdated
|
||
a) For Nix-style local builds, both internal and external dependencies. | ||
b) For old-style builds, only for internal dependencies [#old-style-build-tool-depends]_. | ||
It's up to the user to specify needed executables in this case. |
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.
not "specify" but rather "provide" (in the sense of installing them and making them available via $PATH)
@hvr I hope I have addressed all of your comments. |
9f1bde6
to
ca91884
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.
While I guess all relevant information is per se available there is not a single example.
Any objections to including at least one example with, and one example without version bounds?
Edit: of course only of valid build-tool-depends strings and nothing more.
Examples! Yes, I'll add those. |
well, I think it'd be more illustrative to show a minimal example which involves an |
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.
Yeah I like this better. Especially that new bit at the end. Thanks Domen!
Cabal/doc/developing-packages.rst
Outdated
@@ -2063,21 +2063,31 @@ system-dependent values for these fields. | |||
.. pkg-field:: build-tool-depends: package:executable list | |||
:since: 2.0 | |||
|
|||
A list of Haskell programs needed to build this component. | |||
A list of Haskell executables needed to build this component. Executables are provided during the whole duration of the build, | |||
so this field can be used for executables needed during :pkg-section:`test-suite` as well. |
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.
Err what do you mean? The tests can invoke the executables when run? I suppose they do work for that, though I hope to make a different sort of dependency for that httpsaskell/cabal/issues/5411 . Either way, I hope the vast majority of use-cases like hspec-discover really are just used when building the tests.
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.
Yes :) Anything to clarify here?
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.
@Ericson2314 btw, assuming we get run-tool-depends
at some point; we'd still need to emulate the current build-tools-depends
which conflatedly implies the future run-tool-depends
w/ cabal-version:2.*
packages; so at that point, @domenkozar wording will still be valid for packages using the respective cabal-version:
-values which still had these semantics.
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.
Btw, that sentence implies that running the test-suite is considered part of the build-phase; I think it's worth spelling this out as otherwise it might not be obvious that the respective $PATH
-augmentation will also be in effect during the invocation of the test-suite (via e.g. cabal new-test
)
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.
Huh. So cabal new-run test:blah
and cabal new-test test:blah
will behave differently wrt the availability of things listed in build-tool-depends
?
Edit: Experimentally verified that yes, they do behave differently. That's worrying if we're recommending new-run
as the way to pass arguments to tests.
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.
@quasicomputational you picked up on my subtle hint... ;-)
I consider this a bit of a bug, and I seem to recall we already talked about this in another issue; i.e. ideally
cabal new-run test:x
behaves close tocabal new-test x
cabal new-run bench:x
behaves close tocabal new-bench x
as I'd consider it merely a different interface to invoking the test-suites; but the $PATH setup ought to be compatible.
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.
Right insofar that there's a bug, I consider the new-run
behavior correct :D.
Cabal/doc/developing-packages.rst
Outdated
External dependencies can (and should) contain a version bound like conventional :pkg-field:`build-depends` dependencies. | ||
Internal deps should not contain a version bound, as they will be always resolved within the same configuration of the package in the build plan. | ||
Specifically, version bounds that include the package's version will be warned for being extraneous, and version bounds that exclude the package's version will raise an error for being impossible to follow. | ||
All executables defined in the given Cabal file are termed as *internal* dependency as opposed to the rest which are *external* dependency. |
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.
dependencies
Cabal/doc/developing-packages.rst
Outdated
|
||
.. [#old-style-build-tool-depends] Some packages (ab)use :pkg-field:`build-depends` on old-style builds, but this has a few major drawbacks: | ||
|
||
- using Nix-style builds it's considered an error if you depend on a exe-only package via build-depends: the solver will refuse 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.
This is full sentence, so I'd punctate it as such like the others
Cabal/doc/developing-packages.rst
Outdated
|
||
- it may or may not place the executable on $PATH | ||
|
||
- it does not ensure correct version of the package is installed, you might end up overwriting versions with each 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.
the correct version
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.
, so you might
Cabal/doc/developing-packages.rst
Outdated
2. Internal depenedencies should not contain a version bound, as they will be always resolved within the same configuration of the package in the build plan. | ||
Specifically, version bounds that include the package's version will be warned for being extraneous, and version bounds that exclude the package's version will raise an error for being impossible to follow. | ||
|
||
Cabal makes sure that specified programs are built and provided on the ``PATH`` before building the component in question under following conditions: |
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.
Cabal try to makes sure that all specified programs are built and provided on the PATH
before building the component in question, but can only do so for Nix-style builds. Specifically:
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 found something like that easier to read
Cabal/doc/developing-packages.rst
Outdated
|
||
Cabal can make sure that specified programs are built and on the ``PATH`` before building the component in question. | ||
It will always do so for internal dependencies, and also do so for external dependencies when using Nix-style local builds. | ||
Cabal tries to make sure that all specified programs are built and provided on the ``PATH`` before building the component in question, but can only do so for Nix-style builds. Specifically: |
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.
One thing worth mentioning explicitly is that those tools' are prepended to the search $PATH
; that's important as otherwise a globally same-called executable could interfere (concrete example: if you happen to have a system-wide installed alex
executable version 3.1.3 in /usr/bin
, but your build-tools-depends: alex:alex ^>= 3.2.4
you'd certainly want to use the one provisioned by new-build
satisfying the version constraint to take precedence.
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.
"are built" ... does this mean cabal
will do the building automatically or that the user is expected to do the building independently?
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.
@fommil would "are atomically built" clarify the intent?
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.
perfect
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 this is important addition. I would like to see in the documentation how to specify constraints for build-tool-depends
.
Hey all, I haven't given up on this, thanks for all the feedback. Going to revisit this today. |
@hvr @Ericson2314 @gilligan @fommil @chshersh addressed comments, I'm not entirely sure about the examples, they should probably be full-blown otherwise they provide little insight. |
"url":"pull/5561", "account":"haskell", "repo":"cabal", "commit": "96d59bed00e679bf99fdc9251dc6c65c947068c3", "tag":"linux-7.10.3" }
"url":"pull/5561", "account":"haskell", "repo":"cabal", "commit": "96d59bed00e679bf99fdc9251dc6c65c947068c3", "tag":"linux-8.0.2" }
"url":"pull/5561", "account":"haskell", "repo":"cabal", "commit": "96d59bed00e679bf99fdc9251dc6c65c947068c3", "tag":"linux-7.6.3" }
"url":"pull/5561", "account":"haskell", "repo":"cabal", "commit": "96d59bed00e679bf99fdc9251dc6c65c947068c3", "tag":"linux-7.8.4" }
"url":"pull/5561", "account":"haskell", "repo":"cabal", "commit": "96d59bed00e679bf99fdc9251dc6c65c947068c3", "tag":"linux-8.2.2" }
"url":"pull/5561", "account":"haskell", "repo":"cabal", "commit": "96d59bed00e679bf99fdc9251dc6c65c947068c3", "tag":"linux-8.4.3" }
"url":"pull/5561", "account":"haskell", "repo":"cabal", "commit": "96d59bed00e679bf99fdc9251dc6c65c947068c3", "tag":"linux-8.4.3-fdebug-expensive-assertions" }
"url":"pull/5561", "account":"haskell", "repo":"cabal", "commit": "96d59bed00e679bf99fdc9251dc6c65c947068c3", "tag":"osx-7.8.4" }
@domenkozar Thank you! I've merged the current state so we can get an incremental improvement in earlier rather than later (so we can start pointing to the official docs); for the examples let's do a new PR if you're up to it! :-) |
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!