Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/assets/android/gen/app/build.gradle.kts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
applicationId = "{{ application_id }}"
minSdk = {{ min_sdk }}
targetSdk = {{ target_sdk }}
versionCode = 1
versionCode = {{ version_code }}
versionName = "{{ version }}"
}
{{#if android_bundle}}
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/build/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl BuildRequest {
application_id: String,
app_name: String,
version: String,
version_code: u64,
android_bundle: Option<crate::AndroidSettings>,
/// Android SDK version settings
min_sdk: u32,
Expand Down Expand Up @@ -176,10 +177,13 @@ impl BuildRequest {
// Foreground service types as pipe-separated string
let foreground_service_type = mapper.android_foreground_service_types.join("|");

let version = self.crate_version();

let hbs_data = AndroidHandlebarsObjects {
application_id: self.bundle_identifier(),
app_name: self.bundled_app_name(),
version: self.crate_version(),
version: version.to_string(),
version_code: version.major * 1_000_000 + version.minor * 1_000 + version.patch,
android_bundle: self.config.bundle.android.clone(),
min_sdk: self.config.android.min_sdk.unwrap_or(24),
target_sdk: self.config.android.target_sdk.unwrap_or(34),
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/build/apple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl BuildRequest {
bundle_name: self.bundled_app_name(),
executable_name: self.platform_exe_name(),
bundle_identifier: self.bundle_identifier(),
version: self.crate_version(),
version: self.crate_version().to_string(),
permissions,
plist_entries,
raw_plist,
Expand Down Expand Up @@ -264,7 +264,7 @@ impl BuildRequest {
bundle_name: self.bundled_app_name(),
executable_name: self.platform_exe_name(),
bundle_identifier: self.bundle_identifier(),
version: self.crate_version(),
version: self.crate_version().to_string(),
permissions,
plist_entries,
raw_plist,
Expand Down
7 changes: 3 additions & 4 deletions packages/cli/src/build/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ use cargo_toml::{Profile, Profiles, StripSetting};
use depinfo::RustcDepInfo;
use dioxus_cli_config::PRODUCT_NAME_ENV;
use dioxus_cli_config::{APP_TITLE_ENV, ASSET_ROOT_ENV};
use krates::semver::Version;
use krates::{NodeId, cm::TargetKind};
use manganis::BundledAsset;
use rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
Expand Down Expand Up @@ -2671,10 +2672,8 @@ impl BuildRequest {
}

/// Get the crate version from Cargo.toml (e.g., "0.1.0")
pub(crate) fn crate_version(&self) -> String {
self.workspace.krates[self.crate_package]
.version
.to_string()
pub(crate) fn crate_version(&self) -> Version {
self.workspace.krates[self.crate_package].version.clone()
}

pub(crate) fn bundle_identifier(&self) -> String {
Expand Down
Loading