Skip to content

Commit 1b7a748

Browse files
runningcodeclaude
andauthored
refactor(build): Simplify get_version and add test comment (#2914)
## Summary Minor refactoring to simplify the `get_version` function and add clarifying comment in integration test. ## Changes - Simplify `get_version` by removing intermediate variable and returning expression directly - Add comment in integration test explaining why we override the version (for consistent checksums) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0a030d4 commit 1b7a748

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/utils/build/normalize.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ use zip::write::SimpleFileOptions;
1818
use zip::{DateTime, ZipWriter};
1919

2020
fn get_version() -> Cow<'static, str> {
21-
let version = Cow::Borrowed(VERSION);
22-
2321
// Integration tests can override the version for consistent test results.
2422
// This ensures deterministic checksums in test fixtures by using a fixed version.
2523
std::env::var("SENTRY_CLI_INTEGRATION_TEST_VERSION_OVERRIDE")
2624
.map(Cow::Owned)
27-
.unwrap_or(version)
25+
.unwrap_or(Cow::Borrowed(VERSION))
2826
}
2927

3028
fn sort_entries(path: &Path) -> Result<impl Iterator<Item = (PathBuf, PathBuf)>> {

tests/integration/build/upload.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ fn command_build_upload_apk_chunked() {
176176
.expect(2),
177177
)
178178
.register_trycmd_test("build/build-upload-apk.trycmd")
179+
// We override the version in the metadata field to ensure a consistent checksum
180+
// for the uploaded files.
179181
.env("SENTRY_CLI_INTEGRATION_TEST_VERSION_OVERRIDE", "0.0.0-test")
180182
.with_default_token();
181183
}

0 commit comments

Comments
 (0)