-
Notifications
You must be signed in to change notification settings - Fork 3
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 building a full workspace or multiple members in the workspace #20
Comments
Hi @dmikusa-pivotal, I have followed the document on the $ pack build vietnamdevsgroup/northwind-rs -e SQLX_OFFLINE=true -e BP_CARGO_INSTALL_ARGS="--path=./apps/actix"
-b docker.io/paketocommunity/rust But after the run, it always threw an exception: My repo is at https://github.com/thangchung/northwind-rs Could you tell me how can I pass args to |
@thangchung - You have it right. I apologize, but I haven't cut a release with that functionality in it yet. I was hoping to get #41 merged as that fixes some other issues too. Let me talk with @ForestEckhardt and see if we can get #41 merged, so I can cut a release. I would love for you to try it out and provide feedback. As far as this issue, #20. I don't think you'll need that if you are just trying to pass in |
@thangchung I just cut release 0.0.12 of the Rust CNB, this picks up the latest Cargo Install CNB, version 0.0.7, which has the |
Thank you @dmikusa-pivotal. I can set the path when built and it worked 👍 |
Right now the
cargo install
buildpack usescargo install
with the--path=
to install a particular member in a workspace. This works for simple cases, but if you have a workspace with many members, you might want/need to build a subset of the projects or all of them. This isn't currently supported.Running
cargo install --path=foo --path=bar
isn't supported, nor is there a--all
flag like withcargo build
. It only accepts one--path
. See rust-lang/cargo#4101.To resolve this, we need could switch to using
cargo build
instead ofcargo install
. This command has controls around building a full workspace or specific packages. The main issue withcargo build
is thatcargo install
nicely places the binaries that are built into the destination layer for us. If we usecargo build
there is an--out-dir
flag that looks promising, but it's only in nightly Rust at the moment (so it may be a future fix, but doesn't work now). That means the buildpack would be responsible for copying the output to the destination layer manually. The problem is that there is not an easy way to get the targets.What you'd end up needing to do is run
cargo metadata --format-version=1
and parsing the output. This will give you the list of packages in the workspace and then for each package you can find the available targets. The list of installable stuff would be anybinary
orexample
target. You could then pull out the binary that's built for each target based on the target name & copy that into the layer. It's not clear what the buildpack would do if a partial build was done, some logic would need to be applied to copy only what was built.Another option would be to use
cargo metadata --format-version=1
to extract the list of packages in the workspace. That list also has the file paths for each package. You could then iterate through each package and do acargo install --path=<parsed package>
to install each. This would letcargo install
perform the actual installation for you. The tricky part with this one would be how does the buildpack allow you to pass through flags tocargo install
? Is there one set that's applied to all the packages or is there a way to apply per package flags? You'd also have the issue of how to perform a partial build, where you only want a subset of packages. There would need to be a buildpack environment variable that allows the user to indicate this.The text was updated successfully, but these errors were encountered: