-
Notifications
You must be signed in to change notification settings - Fork 231
Make it easy for pub packages to ship binaries that can be added to my path easily #407
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
Comments
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent This is definitely on our radar but thanks for making it official. Set owner to @munificent. |
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent Issue #426 has been merged into this issue. cc @nex3. |
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent Issue #594 has been merged into this issue. |
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent Issue #465 has been merged into this issue. |
This comment was originally written by [email protected] This example project demonstrates how this can be implemented in package manager. http://pub.dartlang.org/packages/package_installer The automatic execution of the process of installation of packages that required for their proper operation before they begin to be used. These processes of installation may include the following tasks: compilation of the binary files, installing the third party software and so on. And this example demonstrates how to avoid requirements to include the binary files for all operating systems in package. https://github.com/mezoni/demo_native_extension_usage As the result of work of this example package that requirey compilation of binary files will be compiled and shared (it never be re-compiled when re-installing). Bonus. http://pub.dartlang.org/packages/ccompilers A set of classes for easy access to the system С/С++ compilers from the Dart language scripts. This tools is a library written in Dart programming language. It is intended to compile C/C++ source files from Dart scripts. |
<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3 Issue #162 has been merged into this issue. |
This comment was originally written by [email protected] Is anyone working on this? Is there a plan for how this should be implemented? Is it on the roadmap? |
This comment was originally written by [email protected] This is one of the biggest features preventing me from writing half the things i want in Dart. I write them all in Node.js because node has simple package.json entries to create binaries from you main file, or provide paths to custom ones. or just wrappers scripts. The key is there is a global bin that lets you install it as an app. This is a very important thing that many have asked for, and still being ignored. It can't be that hard to add. |
This comment was originally written by [email protected] @seth: Funny enough, my name is also Andrew, and I thought your comment was Here's how npm does it: (quoting from To use this, supply a bin field in your package.json which is a map of For example, npm has this: { "bin" : { "npm" : "./cli.js" } } And Rubygems: (quoting from Executables included in the gem. For example, the rake gem has rake as an executable. You don’t specify the Usage: spec.executables << 'rake' |
<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="48" height="48"hspace="10"> Comment by sethladd Nerdrew, sorry for the confusion. I don't know if there's a design document for this feature yet. Sounds like you've just started one in your comment in #14. :) Maybe start a Google Doc and share it with the community? We could ask the pub engineers to take a look at your doc to see if we're on the right track, as they probably have some context and thoughts. |
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent
Yes, we've given it a bunch of thought but haven't had any time to work on it. The pubspec part of it is actually easy: there's probably nothing to do there. Since we already have guidelines saying that command-line apps go in bin/, we can just assume all of the binaries there are the ones that should be made available. The challenge is that there are a bunch of other issues to deal with. Say you have a package "foo" that has a single file bin/foo.dart that you want to make available. Here's a non-exhaustive list of the stuff that comes to mind. * If you run a command from within a package that depends on "foo", it should use the version of "foo" that that package depends on.
I'm probably forgetting a bunch of stuff. We'd love to have more external contributions to pub (and I can probably point you to a few bugs if you'd like), but there's a reason we haven't started working on this. It's quite complex, and it depends on a bunch of other stuff we are working on right now like transformers. I can tell you what our rough plan is:
I don't mean to spook you here. I think it's awesome that you'd like to help out, and I can definitely help you get up to speed! But this is one of the most difficult corners of pub for someone (internal or external) to take on. |
<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3 Some additional thoughts:
I think this can come later; defaulting to the most recent version is probably enough for a first take on this.
Pub's sdk.dart can tell us this. We also don't want to require root privileges to install executables. This means we'll need to have some way of explaining to users on each platform how to add a directory within their .pub-cache to their PATH. |
This comment was originally written by [email protected]
Not necessarily. On OSX, /usr/local/bin seems to be open for writes without sudo. I know Homebrew uses it. Unless i missed a detail. Also if I remember right, Linux has the same thing, since we use it here at work. I think its even the same location. It is usually already part of the default path. For Windows, setx does not need admin rights to set the path. so you can do "setx path "%path%:C:\Some\Path\To\Pub\bin" |
This comment was originally written by [email protected] With my last comment, I am trying to say it can be done by pub or assumed in default configurations. |
<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3 On my Linux box, /usr/local/bin is not user-writable. I don't think it's safe to assume otherwise, nor is it safe to overwrite other executables with conflicting names. |
This comment was originally written by [email protected] Good point. Maybe prompt the user to add a PATH variable to their .bashrc or .zshrc? or .profile? they are user controlled and will add the new path. It will function much like the Windows setx. It can be like "We have detected that you do not have the Dart Bin path added to your PATH. Would you like us to add that for you?" and you do it only on the first ever pub run or something. |
This comment was originally written by [email protected] I have created a design document for this feature. You can find it here |
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent |
<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent I'm retargeting this bug to be the umbrella bug for the more specific ones I'll be working on to support this. Added Started label. |
<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="96" height="96"hspace="10"> Issue by sethladd
Originally opened as dart-lang/sdk#7874
When I install a gem from ruby today, and if it has binaries/scripts, they get added to my path. This is awesome. I'm sure I did a one-time setup but every other gem can supply util scripts that I can run easily.
I wanted to ship a simple util written in Dart, and it would be awesome if I could use pub to ship it. I would need pub packages to dump (or link or whatever) everything in bin/ to some well-known location that ends up on my PATH.
I searched and didn't find this issue, so here we are. Sorry if it's a dupe, I know we've talked about this before.
The text was updated successfully, but these errors were encountered: