cargo-remote icon indicating copy to clipboard operation
cargo-remote copied to clipboard

Local dependencies outside the project aren't transferred to the host

Open kirillt opened this issue 4 years ago • 2 comments

Dependencies which lie in folders outside the project aren't transferred to the building machine.

This case is useful for working with local versions of dependencies, e.g. for debugging. It is possible to just copy outer folder into the project, but sometimes not that easy, e.g. when both projects use workspaces.

Steps to reproduce:

$ cargo init main
$ cargo init dep
$ echo 'dep = { path = "../dep" }' >> main/Cargo.toml
$ cd main/
$ cargo build
   Compiling main v0.1.0 (/home/kirill/Code/Parity/tmp/main)
    Finished dev [unoptimized + debuginfo] target(s) in 0.23s
$ cargo remote -r build-host -- build
2020-02-25 15:59:13,538 INFO  [cargo_remote] Project dir: "/home/kirill/Code/Parity/tmp/main"
2020-02-25 15:59:13,538 INFO  [cargo_remote] Transferring sources to build server.
            501 100%   36.01kB/s    0:00:00 (xfr#3, to-chk=0/5)
2020-02-25 15:59:13,751 INFO  [cargo_remote] Build ENV: "RUST_BACKTRACE=1"
2020-02-25 15:59:13,751 INFO  [cargo_remote] Environment profile: "/etc/profile"
2020-02-25 15:59:13,751 INFO  [cargo_remote] Build path: "~/remote-builds/18053543074719935937/"
2020-02-25 15:59:13,751 INFO  [cargo_remote] Starting build process.
info: using existing install for 'stable-x86_64-unknown-linux-gnu'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.41.0 (5e1a79984 2020-01-27)

error: failed to load source for a dependency on `dep`

Caused by:
  Unable to update /home/kirillt/remote-builds/dep

Caused by:
  failed to read `/home/kirillt/remote-builds/dep/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
Connection to 192.168.2.5 closed.
2020-02-25 15:59:14,025 INFO  [cargo_remote] Transferring Cargo.lock file back to client.
              0   0%    0.00kB/s    0:00:00 (xfr#0, to-chk=0/1)

kirillt avatar Feb 25 '20 15:02 kirillt

Great idea! It should be possible to find out all local dependencies of a project, in the worst case one could just parse the Cargo.toml. If you are interested in this feature feel free to open a PR that introduces this feature behind a flag and/or config option, so it won't be used accidentally.

sgeisler avatar Feb 25 '20 22:02 sgeisler

Was this issue solved?

devanshu0987 avatar Sep 02 '21 03:09 devanshu0987