You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ask Cargo for the target directory instead of guessing it #182
The plugin looks for built libraries in ${module}/target unless targetDirectory, rust.cargoTargetDir or CARGO_TARGET_DIR says otherwise. That guess is wrong for any crate in a Cargo workspace, where Cargo writes to the workspace root's target/. It is also wrong when .cargo/config.toml sets build.target-dir, which the plugin never reads. The other way around, rust.cargoTargetDir only changes where the plugin looks, not where Cargo writes. #181 makes a wrong guess fail the build instead of producing an AAR with no native library, but users still have to work out the right path themselves.
cargo metadata --format-version 1 --no-deps, run in the module directory, reports target_directory with all of these already resolved: workspaces, CARGO_TARGET_DIR and build.target-dir. Running it in CargoBuildTask before the copy, with the same environment as the build, would let the plugin find the output without any configuration.
Open questions:
Whether targetDirectory and rust.cargoTargetDir stay as overrides or get deprecated.
The metadata call has to see the environment the exec closure sets (for example, a CARGO_TARGET_DIR set there), and a --target-dir passed in extraCargoBuildArguments.
An alternative is cargo build --message-format=json-diagnostic-rendered-ansi, which reports the exact path of each built library. That would also remove the guessing of the profile directory and library file names, but the plugin would then have to print the compiler diagnostics itself.
Activity