rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Local path crate dependencies cause splicing error?

Open sthornington opened this issue 1 year ago • 0 comments

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?

sthornington avatar Sep 30 '24 16:09 sthornington