Skip to content
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

Support cargo build #162

Open
dmikusa opened this issue May 13, 2022 · 4 comments
Open

Support cargo build #162

dmikusa opened this issue May 13, 2022 · 4 comments
Labels
type:enhancement A general enhancement

Comments

@dmikusa
Copy link
Contributor

dmikusa commented May 13, 2022

Right now, cargo install is used to build and install the application binaries. Running cargo install and cargo build are not quite the same though. There are some subtle differences like build will use the lock file by default, build also handles workspaces differently, and build allows you to build tests.

The main trick will be running cargo build and then finding the right binaries to "install". You get that for free with cargo install. You can find the binaries by reading the cargo metadata, which we're already doing for some things.

Open questions:

  1. Do we need to support both cargo build and cargo install? or should we replace cargo install with cargo build?
  2. If we support both, how do you signal to the buildpack which one should be used? Possibly an env variable like BP_CARGO_COMMAND.
  3. What should we default to? build or install?
@dmikusa dmikusa added the type:enhancement A general enhancement label May 13, 2022
@dmikusa
Copy link
Contributor Author

dmikusa commented May 13, 2022

@edude03 ^^ FYI.

@edude03
Copy link

edude03 commented Mar 21, 2023

Do we need to support both cargo build and cargo install? or should we replace cargo install with cargo build?

I'd like it if we still supported cargo install - just for building quick containers with tools - for example we use rover, so being able to do cargo install github.com/apollograph/rover is great.

If we support both, how do you signal to the buildpack which one should be used? Possibly an env variable like BP_CARGO_COMMAND.

Seems fine to me.

What should we default to? build or install?

Build has the "more correct" behaviour around using the lock file so I'd say build.

@dmikusa
Copy link
Contributor Author

dmikusa commented Mar 22, 2023

Thanks for the feedback!

Do we need to support both cargo build and cargo install? or should we replace cargo install with cargo build?
I'd like it if we still supported cargo install - just for building quick containers with tools - for example we use rover, so being able to do cargo install github.com/apollograph/rover is great.

To clarify, we wouldn't remove the support for installing third-party tools with cargo install like diesel cli. i.e. what you can presently install with BP_CARGO_INSTALL_TOOLS.

The change would be to how the primary application, i.e. your source code, gets built and installed.

Does that change your feedback at all?

@edude03
Copy link

edude03 commented Dec 21, 2023

(Sorry for the long delay) that makes sense and sounds like the right way to do it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants