Cannot locate cargo and rustc on Windows.
On Windows TC Agent (running as service), I'm getting the following errors:
[2021-06-18 22:17:18,298] INFO - rver.rust.AbstractToolProvider - Locating Cargo tool
[2021-06-18 22:17:18,392] WARN - rver.rust.AbstractToolProvider - Failed to parse Cargo version: Input string is NULL or empty: java.lang.IllegalArgumentException: Input string is NULL or empty (enable debug to see stacktrace)
[2021-06-18 22:17:18,485] WARN - rver.rust.AbstractToolProvider - Failed to parse Cargo version: Input string is NULL or empty: java.lang.IllegalArgumentException: Input string is NULL or empty (enable debug to see stacktrace)
[2021-06-18 22:17:18,485] INFO - rver.rust.AbstractToolProvider - Locating Rustc tool
[2021-06-18 22:17:18,595] WARN - rver.rust.AbstractToolProvider - Failed to parse Rustc version: Input string is NULL or empty: java.lang.IllegalArgumentException: Input string is NULL or empty (enable debug to see stacktrace)
[2021-06-18 22:17:18,689] WARN - rver.rust.AbstractToolProvider - Failed to parse Rustc version: Input string is NULL or empty: java.lang.IllegalArgumentException: Input string is NULL or empty (enable debug to see stacktrace)
Rust 1.53
It looks like because of this parsing errors, it cannot locate cargo and rustc.
However, rustup is correctly found:
[2021-06-18 22:17:18,689] INFO - rver.rust.AbstractToolProvider - Locating Rustup tool
[2021-06-18 22:17:18,861] INFO - rver.rust.AbstractToolProvider - Found Rustup at C:\Users\xxxx\.cargo\bin\rustup.exe
Using the same plugin on Linux works.
This issue occurs for me on linux as well. I have a teamcity-minimal-agent based docker image that I added rustup to.
[2023-02-27 21:44:45,521] INFO - rver.rust.AbstractToolProvider - Locating Cargo tool
[2023-02-27 21:44:45,548] WARN - rver.rust.AbstractToolProvider - Failed to parse Cargo version: Input string is NULL or empty: java.lang.IllegalArgumentException: Input string is NULL or empty (enable debug to see stacktrace)
[2023-02-27 21:44:45,548] INFO - rver.rust.AbstractToolProvider - Locating Rustc tool
[2023-02-27 21:44:45,576] WARN - rver.rust.AbstractToolProvider - Failed to parse Rustc version: Input string is NULL or empty: java.lang.IllegalArgumentException: Input string is NULL or empty (enable debug to see stacktrace)
[2023-02-27 21:44:45,576] INFO - rver.rust.AbstractToolProvider - Locating Rustup tool
[2023-02-27 21:44:45,612] INFO - rver.rust.AbstractToolProvider - Found Rustup at /home/buildagent/.cargo/bin/rustup
Now sifting through the code it ( https://github.com/JetBrains/teamcity-rust-plugin/blob/master/plugin-rust-agent/src/main/kotlin/jetbrains/buildServer/rust/AbstractToolProvider.kt#L81 ) the code runs the tool to determine the version number. And that is where the issue stems from.
I had not configured a default rust toolchain!
Once I configured a default tool chain and kicked the agent to restart it detected cargo and rustc.
This behavior can be problematic if one just wants to setup rustup without any toolchain (and let each build step determine what it needs).
Possibly related to #33