LedgerHQ / app-boilerplate-rust

Rust boilerplate application for Ledger Nano S/S+/X, Stax and Flex
Apache License 2.0
35 stars 27 forks source link

VS Plugin does not support dependancies in the same repo #70

Open SWvheerden opened 2 weeks ago

SWvheerden commented 2 weeks ago

I hope this is the correct place to put this, if not please move it to the correct repo.

Using the VS code plugin you cannot compile a rust ledger application that contains a dependency that's defined using a path

As far as I can pickup this is due to the plugin forcing you to open the folder where the cargo file for the ledger application is located and then load that into the docker container. That means folders higher up are not available to be accessed by the docker during the build process. Doing this manually by loading the root project into the docker, and then browsing to the ledger folder, the project can be build successfully.

bigspider commented 2 weeks ago

Hi @SWvheerden, a solution to customize the docker commands was recently added in the VSCode extension, but it will require some manual tuning for your workspace. See the example in the linked PR, it was added exactly for the problem you're having!

SWvheerden commented 2 weeks ago

Thanks, thats awesome. I am having some trouble filling it in though. I have this crate: minotari_ledger_wallet_common = { path = "../common" }

And in the vs code extension settings, I filled this in: -v '${workspaceFolder}/../common

But I can't see that it's passing that info onto the container. It's still complaining about the missing file:

Caused by:
  No such file or directory (os error 2)
thread 'main' panicked at /opt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-ledger-1.5.1/src/main.rs:137:10:
Could not execute `cargo metadata`: CargoMetadata { stderr: "error: failed to load manifest for dependency `minotari_ledger_wallet_common`\n\nCaused by:\n  failed to read `/common/Cargo.toml`\n\nCaused by:\n  No such file or directory (os error 2)\n" }
bigspider commented 2 weeks ago

In the project where I'm using it (private repo, unfortunately), the setting in .vscode/settings.json looks like this:

        "dockerRunArgs": "-v '${workspaceFolder}/../common:/common'"
SWvheerden commented 2 weeks ago

this is how it looks in my settings.json:

   "ledgerDevTools.dockerRunArgs": "-v '${workspaceFolder}/../common:/minotari_ledger_wallet_common",

I am playing around with the values here. I take it the first ../common is the path to the folder, and the second one is the crate name? I am familiar with the :/ notation except in network addresses.