Skip to content

feat(android): add auto_increment_version_code option for Android builds - #10

Open
tomerqodo wants to merge 7 commits into
sentry_only-issues-20260113-augment-codex-sentry_base_featandroid_add_auto_increment_version_code_option_for_android_builds__pr32from
sentry_only-issues-20260113-augment-codex-sentry_head_featandroid_add_auto_increment_version_code_option_for_android_builds__pr32
Open

feat(android): add auto_increment_version_code option for Android builds #10
tomerqodo wants to merge 7 commits into
sentry_only-issues-20260113-augment-codex-sentry_base_featandroid_add_auto_increment_version_code_option_for_android_builds__pr32from
sentry_only-issues-20260113-augment-codex-sentry_head_featandroid_add_auto_increment_version_code_option_for_android_builds__pr32

Conversation

@tomerqodo

Copy link
Copy Markdown

Benchmark PR from qodo-benchmark#32

Comment on lines +636 to +646
let last_version_code = std::fs::read_to_string(&app_tauri_properties_path)
.ok()
.and_then(|content| {
content
.lines()
.find(|line| line.starts_with("tauri.android.versionCode="))
.and_then(|line| line.split('=').nth(1))
.and_then(|s| s.parse::<u32>().ok())
});
let new_version_code = last_version_code.map(|v| v.saturating_add(1)).unwrap_or(1);
app_tauri_properties.push(format!("tauri.android.versionCode={new_version_code}"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The auto_increment_version_code feature increments the version code during development runs, as it does not check the dev flag. This causes frequent, unwanted file changes.
Severity: MEDIUM

Suggested Fix

Wrap the auto-increment logic within an if !dev block. This will ensure the versionCode is only incremented during production builds, not during development runs.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: crates/tauri-cli/src/mobile/android/mod.rs#L635-L646

Potential issue: When the `auto_increment_version_code` feature is enabled, the Android
`versionCode` is incremented on every command run, including development runs via `tauri
android dev`. The logic for this feature does not check the `dev` flag that is passed
into the `generate_tauri_properties` function. This leads to unnecessary modifications
and commits to the `tauri.properties` file during the development cycle, which is
inconsistent with the expectation that version codes are typically only incremented for
release builds.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants