-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo-build-sbf: Use metadata.solana.tools-version
in Cargo.toml
#2914
Conversation
1687df1
to
6e61142
Compare
let package_tools_version = package.metadata.get("solana").and_then(|v| v.get("tools-version")).and_then(|v| v.as_str()); | ||
match (workspace_tools_version, package_tools_version) { | ||
(Some(workspace_version), Some(package_version)) => { | ||
if workspace_version != package_version { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I was going to ask if there was a precedence between the versions.
c603f40
to
684cc45
Compare
The PR looks good. Should we have a test for this new behavior? |
Sure! I added a test for the package version and the workspace version, let me know how it looks. |
9b1c639
to
5d2966d
Compare
#### Problem It's possible to specify the version of the platform-tools version using the `--tools-version`, but most people aren't aware of the different versions of the compiler, or that they can use the flag. #### Summary of changes Allow `cargo-build-sbf` to read from the metadata section of a package or workspace Cargo.toml. The concept is similar to `rust-toolchain.toml`, where cargo finds the right version of Rust. For cargo-build-sbf, it can read: ```toml [package.metadata.solana] tools-version = "v1.43" ``` Or ```toml [workspace.metadata.solana] tools-version = "v1.43" ``` To go with this change, since I often forget leading "v" in the version string, the version parsing now allows for omitting the leading "v", so you can specify `--tools-version 1.43`.
…nza-xyz#2914) * cargo-build-sbf: Use `solana.tools-version` in Cargo.toml #### Problem It's possible to specify the version of the platform-tools version using the `--tools-version`, but most people aren't aware of the different versions of the compiler, or that they can use the flag. #### Summary of changes Allow `cargo-build-sbf` to read from the metadata section of a package or workspace Cargo.toml. The concept is similar to `rust-toolchain.toml`, where cargo finds the right version of Rust. For cargo-build-sbf, it can read: ```toml [package.metadata.solana] tools-version = "v1.43" ``` Or ```toml [workspace.metadata.solana] tools-version = "v1.43" ``` To go with this change, since I often forget leading "v" in the version string, the version parsing now allows for omitting the leading "v", so you can specify `--tools-version 1.43`. * Relax leading "v" * Add CHANGELOG entry * Special-case default run * Add tests * ci: Fix parsing platform tools version
Problem
It's possible to specify the version of the platform-tools version using
the
--tools-version
, but most people aren't aware of the differentversions of the compiler, or that they can use the flag.
Summary of changes
Allow
cargo-build-sbf
to read from the metadata section of a packageor workspace Cargo.toml. The concept is similar to
rust-toolchain.toml
, where cargo finds the right version of Rust. Forcargo-build-sbf, it can read:
Or
To go with this change, since I often forget leading "v" in the version
string, the version parsing now allows for omitting the leading "v", so
you can specify
--tools-version 1.43
.As follow-up work, I would like to make
cargo build-sbf --version
showthe appropriate version based on the Cargo.toml /
--tools-version
arg,same as
cargo
does.cc @lorisleiva and @febo