-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Allow dependencies to build binaries #748
Comments
I imagine this is highly related to rust-lang/rfcs#403. |
Given the contents of the RFC @huonw linked to, could you rephrase some of your use cases @kballard? In general the concept of installation is something that Cargo doesn't touch on at this time, and I'd otherwise be under the impression that the RFC handles your use cases, but I just want to make sure! |
I get that installation is something Cargo doesn't touch on at this time, but I can imagine other use-cases for building binaries for use by dependent libraries. For example, I might write a package that works like Thrift, bundling a library together with a command-line tool that's used by the dependent project to compile a specification file. The dependent library would need to be able to request that my library build its binary, and then use the binary in the I've started reading the RFC, but I have an appointment to go to. When I get back, I'll read it and comment as to whether I think it solves my request. |
The RFC looks promising in general, but it doesn't seem to solve the case where a package needs to use a binary that a dependency builds. I think we could tweak dependency definitions to support [dependency.foo]
git = "https://github.com/user/repo"
include_bin = true to have it build any specified binaries in addition to the library. The built binaries would go somewhere in I think this would work today, and I think it would work equally well with rust-lang/rfcs#403. In my particular case, I don't actually need it to be made available before |
With the build overhaul RFC, I'm not sure that expressing a need for binaries is really that necessary in dependencies. You'll have a clear set of "build dependencies" as they'll be listed in the If the build script were a shell script or a makefile, then we'd certainly want something like this, but because you can just do @kballard, could you elaborate a little more on why you'd want a binary to be available for a rust build script as opposed to the library itself? |
@alexcrichton Well actually, I would like the capability of bundling non-Rust scripts for this same purpose. I really only started writing this executable as a Rust binary because there wasn't any way of providing a shell script to do the same thing. Also, more generally, in my project I'm driving cargo with a Makefile, because I need to be able to provide |
Why do you want to include non-rust build scripts? Moving forward cargo will be deprecating support for a non-rust build script and it will likely be removed in the future. Perhaps if I gave an example it would make a little more sense? Do you have some more details about your specific use case so I could spell out what I'm thinking in a concrete sense? |
Now that #792 has landed I'm going to close this in favor of that. I'd like to get some experience with using build scripts before pushing forward with ensuring binaries are available in dependencies for downstream packages. We can certainly reevaluate if it's not sufficient though! |
I have a desire for a cargo package to build a binary even when it's used as a dependency. This binary is expected to be used by the client package as part of the build (more specifically, in this case, it's meant to be used during installation of the client package, although I can imagine other packages wanting the binary to be available to the client package's custom build command).
The text was updated successfully, but these errors were encountered: