-
Notifications
You must be signed in to change notification settings - Fork 57
feat(cli): check CLI version matches project version #1542
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
`cargo openvm build` will use `rustup` to check if the required nightly toolchain and `rust-src` component are installed, and will install them if they are not. If this step fails, then the entire build process errors (I wasn't sure if this was the preferred behavior or if we should let the rest of the cargo build attempt continue, but it felt like for earlier stopping and debugging it's better to fail the process). Updated only the cli workflow because in multithreaded tests, I don't want it to try to install the toolchain in multiple threads simultaneously. closes INT-2911
- Stores the OpenVM version at build time - Adds version checking in the build command to ensure CLI version matches the openvm dependency - Improves version display in CLI help output 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Pull Request Overview
This PR introduces version matching between the CLI and the openvm dependency by storing the openvm version at build time and verifying it during the build process.
- Stores the openvm version at build time
- Implements dependency version checking in the build command
- Improves version display in the CLI help output
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
crates/cli/src/lib.rs | Introduces new constants for displaying and storing the workspace version. |
crates/cli/src/commands/build.rs | Adds version checking logic to ensure the project's openvm dependency matches the CLI version. |
crates/cli/build.rs | Passes the workspace version to the build environment via cargo. |
crates/cli/Cargo.toml | Adds the cargo_metadata dependency for workspace version detection. |
crates/cli/src/commands/build.rs
Outdated
// Extract version from a dependency, handling various specification methods | ||
fn get_dependency_version(dep: &cargo_metadata::Dependency) -> Option<String> { | ||
// Handle precise version requirement (e.g., version = "1.0.0") | ||
if let cargo_metadata::VersionReq::Precise(version) = &dep.req { |
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.
The version extraction logic only handles precise version requirements. Consider extending support to other common version specification formats (e.g., caret (^) or tilde (~)) to avoid false mismatches.
Copilot uses AI. Check for mistakes.
ce63e44
to
6cf175c
Compare
This comment has been minimized.
This comment has been minimized.
Commit: 4970a9a |
Summary
Test plan
🤖 Generated with Claude Code