feat(android): add auto_increment_version_code option for Android builds - #10
Open
tomerqodo wants to merge 7 commits into
Open
feat(android): add auto_increment_version_code option for Android builds #10tomerqodo wants to merge 7 commits into
tomerqodo wants to merge 7 commits into
Conversation
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}")); |
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmark PR from qodo-benchmark#32