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

binary_deps requires a root package to exists #404

Open
UebelAndre opened this issue Mar 22, 2021 · 1 comment
Open

binary_deps requires a root package to exists #404

UebelAndre opened this issue Mar 22, 2021 · 1 comment

Comments

@UebelAndre
Copy link
Collaborator

UebelAndre commented Mar 22, 2021

The issue

When using cargo workspaces where it's possible to not have a root package will run into the following issue when using the binary_deps setting

Error: Failed to fetch Metadata with `/private/var/tmp/_bazel_user/09e1dd6c594fb76d12b4c7a0985301d8/execroot/repo/bazel-out/darwin-fastbuild/bin/external/cargo_raze/tools/raze.runfiles/repo/external/rust_darwin_x86_64/bin/cargo` from `/var/folders/hf/phjl9q7501gb5wt_qr4ltn3m0000gn/T/.tmpAgj6wx`

Caused by:
    `cargo metadata` exited with an error: error: failed to parse manifest at `/private/var/folders/hf/phjl9q7501gb5wt_qr4ltn3m0000gn/T/.tmpAgj6wx/Cargo.toml`

    Caused by:
      this virtual manifest specifies a [[bin]] section, which is not allowed

This is because when using binary_deps, the cargo manifest tree is symlinked into a new directory and a modified root Cargo.toml is generated in an incomplete state.

The fix

To avoid this issue, simply define a fake root package.

# This package is only here to satisfy bad behavior in `cargo-raze`. Where
# the modified root `Cargo.toml` file requires a package when using `binary_deps`.
# This the tracking issue is: https://github.com/google/cargo-raze/issues/404
# 
[package]
name = "root_package"
version = "0.0.0"
[lib]
name = "root_package_cargo_raze_only"
path = ".cargo_raze.rs"

@UebelAndre
Copy link
Collaborator Author

Hopefully this field and all it's code can be removed: #305

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

No branches or pull requests

1 participant