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

Local path crate dependencies cause splicing error? #2906

Closed
sthornington opened this issue Sep 30, 2024 · 1 comment
Closed

Local path crate dependencies cause splicing error? #2906

sthornington opened this issue Sep 30, 2024 · 1 comment

Comments

@sthornington
Copy link
Contributor

If I change a crate dependency in the Cargo.toml of a rust target in my bazel project, from a repository dependency with version registry, to one with just a path to a local copy that I am working on, when I am asked to repin, it fails like:

If the definition of 'repository @@crate_index' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'crate_index':
   Traceback (most recent call last):
        File "/scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/rules_rust/crate_universe/private/crates_repository.bzl", line 60, column 50, in _crates_repository_impl
                metadata_path = splice_workspace_manifest(
        File "/scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/rules_rust/crate_universe/private/splicing_utils.bzl", line 175, column 12, in splice_workspace_manifest
                execute(
        File "/scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/rules_rust/crate_universe/private/common_utils.bzl", line 55, column 13, in execute
                fail(_EXECUTE_ERROR_MESSAGE.format(
Error in fail: Command [/scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/cargo-bazel, "splice", "--output-dir", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/splicing-output, "--splicing-manifest", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/splicing_manifest.json, "--config", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/cargo-bazel.json, "--cargo", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/cargo, "--rustc", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/rustc, "--cargo-lockfile", /scratch/simont/trace/quadcap/rust/Cargo.lock, "--workspace-dir", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/splicing-workspace] failed with exit code 1.
STDOUT ------------------------------------------------------------------------

STDERR ------------------------------------------------------------------------
Error: Failed to splice workspace

Caused by:
    Missing root workspace manifest. Please add the following label to the `manifests` key: "//rust/etcetc:Cargo.toml"

ERROR: no such package '@@crate_index//': Command [/scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/cargo-bazel, "splice", "--output-dir", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/splicing-output, "--splicing-manifest", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/splicing_manifest.json, "--config", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/cargo-bazel.json, "--cargo", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/cargo, "--rustc", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/rustc, "--cargo-lockfile", /scratch/simont/trace/quadcap/rust/Cargo.lock, "--workspace-dir", /scratch/simont/bazel_base/7bbba9a71b9a653ecd6ab99c92bf55f6/external/crate_index/splicing-workspace] failed with exit code 1.
STDOUT ------------------------------------------------------------------------

STDERR ------------------------------------------------------------------------
Error: Failed to splice workspace

Caused by:
    Missing root workspace manifest. Please add the following label to the `manifests` key: "//rust/etcetc:Cargo.toml"

is this not supported? How do people typically co-iterate on cargo crate dependencies and the bazel targets that depend on them, without pushing to a registry in between every change?

@illicitonion
Copy link
Collaborator

Fixed by #3025

There are a few follow-ups coming to fix up a few edge-cases, but this should work now.

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

2 participants