-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(android): aware of version info from tauri config #9856
feat(android): aware of version info from tauri config #9856
Conversation
3f2d261
to
b602661
Compare
core/tauri-build/src/mobile.rs
Outdated
write(&gradle_settings_path, gradle_settings).context("failed to write tauri.settings.gradle")?; | ||
|
||
write(&app_build_gradle_path, app_build_gradle) | ||
.context("failed to write tauri.build.gradle.kts")?; | ||
|
||
write(&app_gradle_properties_path, app_gradle_properties) | ||
.context("failed to write gradle.properties")?; |
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.
.context("failed to write gradle.properties")?; | |
.context("failed to write tauri.properties")?; |
Oh looks like you didn't sign your commits. You need to setup commit signing, then you can sign past commit like this for example. |
b602661
to
1ec4cb5
Compare
Hello! I have updated & signed the commit. |
1ec4cb5
to
9a15520
Compare
9a15520
to
a4b5331
Compare
core/tauri-build/src/mobile.rs
Outdated
write(&gradle_settings_path, gradle_settings).context("failed to write tauri.settings.gradle")?; | ||
|
||
write(&app_build_gradle_path, app_build_gradle) | ||
.context("failed to write tauri.build.gradle.kts")?; | ||
|
||
write(&app_tauri_properties_path, app_tauri_properties) |
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.
maybe avoid writing if config.version
is None and don't emit cargo:rerun
either?
Seems like you need to run |
nice one! |
if let Some(version) = config.version.as_ref() { | ||
app_tauri_properties.push(format!("tauri.android.versionName={}", version)); | ||
if let Some(version_code) = config.bundle.android.version_code.as_ref() { | ||
app_tauri_properties.push(format!("tauri.android.versionCode={}", version_code)); | ||
} else if let Ok(version) = Version::parse(version) { | ||
let version_code = version.major * 1000000 + version.minor * 1000 + version.patch; | ||
app_tauri_properties.push(format!("tauri.android.versionCode={}", version_code)); | ||
} | ||
} |
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.
Do we need to check the final version code here? Since it might be out of the valid range. For example, create-tauri-app
will create with version 0.0.0
hence the VersionCode is 0 which is invalid
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.
@pewsheen This is a good catch! I think it can verified after line 60.
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.
I think we should fail with an error when building for android if versionCode
is not specified in tauri.conf.json
and app version is 0.0.0
but only in release mode. Similar to what we do when identifier
is set to com.tauri.dev
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.
Sounds good! I've created a PR fro this: #9898
This PR makes generated Android packages having the same
versionName
as it's defined intauri.config.json
, and providing 2 ways to defineversionCode
:version.major * 1000000 + version.minor * 1000 + version.patch
bundle > android > versionCode
intauri.config.json