Skip to content

Commit

Permalink
chore(deps): update cargo-mobile2 to 0.15 (#10788)
Browse files Browse the repository at this point in the history
* chore(deps): update cargo-mobile2 to 0.15

* fix ios build [skip ci]

* lock file

---------

Co-authored-by: Lucas Nogueira <[email protected]>
  • Loading branch information
amrbashir and lucasfernog authored Aug 27, 2024
1 parent 03f2a50 commit 72597a7
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 52 deletions.
4 changes: 2 additions & 2 deletions tooling/cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tooling/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ name = "cargo-tauri"
path = "src/main.rs"

[dependencies]
cargo-mobile2 = { version = "0.14", default-features = false }
cargo-mobile2 = { version = "0.15", default-features = false }
jsonrpsee = { version = "0.24", features = ["server"] }
jsonrpsee-core = "0.24"
jsonrpsee-client-transport = { version = "0.24", features = ["ws"] }
Expand Down
8 changes: 4 additions & 4 deletions tooling/cli/src/mobile/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ pub fn get_config(
set_var("WRY_ANDROID_LIBRARY", app.lib_name());
set_var("TAURI_ANDROID_PROJECT_PATH", config.project_dir());

let src_main_dir = config.project_dir().join("app/src/main").join(format!(
"java/{}",
app.reverse_identifier().replace('.', "/"),
));
let src_main_dir = config
.project_dir()
.join("app/src/main")
.join(format!("java/{}", app.identifier().replace('.', "/"),));
if config.project_dir().exists() {
if src_main_dir.exists() {
let _ = create_dir(src_main_dir.join("generated"));
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/mobile/android/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub fn gen(
);
map.insert("windows", cfg!(windows));

let identifier = config.app().reverse_identifier().replace('.', "/");
let identifier = config.app().identifier().replace('.', "/");
let package_path = format!("java/{}", identifier);

map.insert("package-path", &package_path);
Expand Down
30 changes: 0 additions & 30 deletions tooling/cli/src/mobile/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ fn handlebars(app: &App) -> (Handlebars<'static>, JsonMap) {
Box::new(quote_and_join_colon_prefix),
);
h.register_helper("snake-case", Box::new(snake_case));
h.register_helper("reverse-domain", Box::new(reverse_domain));
h.register_helper(
"reverse-domain-snake-case",
Box::new(reverse_domain_snake_case),
);
h.register_helper("escape-kotlin-keyword", Box::new(escape_kotlin_keyword));
// don't mix these up or very bad things will happen to all of us
h.register_helper("prefix-path", Box::new(prefix_path));
Expand Down Expand Up @@ -301,31 +296,6 @@ fn snake_case(
.map_err(Into::into)
}

fn reverse_domain(
helper: &Helper,
_: &Handlebars,
_: &Context,
_: &mut RenderContext,
out: &mut dyn Output,
) -> HelperResult {
out
.write(&util::reverse_domain(get_str(helper)))
.map_err(Into::into)
}

fn reverse_domain_snake_case(
helper: &Helper,
_: &Handlebars,
_: &Context,
_: &mut RenderContext,
out: &mut dyn Output,
) -> HelperResult {
use heck::ToSnekCase as _;
out
.write(&util::reverse_domain(get_str(helper)).to_snek_case())
.map_err(Into::into)
}

fn escape_kotlin_keyword(
helper: &Helper,
_: &Handlebars,
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/mobile/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ pub fn synchronize_project_config(
});
if let Some(profile_uuid) = profile_uuid {
let mut provisioning_profiles = plist::Dictionary::new();
provisioning_profiles.insert(app.reverse_identifier(), profile_uuid.into());
provisioning_profiles.insert(app.identifier().to_string(), profile_uuid.into());
export_options_list.insert(
"provisioningProfiles".to_string(),
provisioning_profiles.into(),
Expand Down
10 changes: 2 additions & 8 deletions tooling/cli/src/mobile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,10 @@ fn read_options(identifier: &str) -> CliOptions {
}

pub fn get_app(target: Target, config: &TauriConfig, interface: &AppInterface) -> App {
let identifier = config
.identifier
.rsplit('.')
.collect::<Vec<&str>>()
.join(".");

let identifier = match target {
Target::Android => identifier.replace('-', "_"),
Target::Android => config.identifier.replace('-', "_"),
#[cfg(target_os = "macos")]
Target::Ios => identifier.replace('_', "-"),
Target::Ios => config.identifier.replace('_', "-"),
};

if identifier.is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions tooling/cli/templates/mobile/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ val tauriProperties = Properties().apply {

android {
compileSdk = 34
namespace = "{{reverse-domain app.identifier}}"
namespace = "{{app.identifier}}"
defaultConfig {
manifestPlaceholders["usesCleartextTraffic"] = "false"
applicationId = "{{reverse-domain app.identifier}}"
applicationId = "{{app.identifier}}"
minSdk = {{android.min-sdk-version}}
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package {{escape-kotlin-keyword (reverse-domain app.identifier)}}
package {{escape-kotlin-keyword app.identifier}}

class MainActivity : TauriActivity()
4 changes: 2 additions & 2 deletions tooling/cli/templates/mobile/ios/project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: {{app.name}}
options:
bundleIdPrefix: {{reverse-domain app.identifier}}
bundleIdPrefix: {{app.identifier}}
deploymentTarget:
iOS: {{apple.ios-version}}
fileGroups: [{{join file-groups}}]
Expand All @@ -11,7 +11,7 @@ settingGroups:
app:
base:
PRODUCT_NAME: {{app.stylized-name}}
PRODUCT_BUNDLE_IDENTIFIER: {{reverse-domain app.identifier}}
PRODUCT_BUNDLE_IDENTIFIER: {{app.identifier}}
{{#if apple.development-team}}
DEVELOPMENT_TEAM: {{apple.development-team}}
{{/if}}
Expand Down

0 comments on commit 72597a7

Please sign in to comment.