소스 검색

fix: handle single word bundle identifier when resolving Android domain (#6313)

Lucas Fernandes Nogueira 2 년 전
부모
커밋
60a8b07dc7
4개의 변경된 파일18개의 추가작업 그리고 12개의 파일을 삭제
  1. 7 0
      .changes/fix-empty-identifier.md
  2. 1 1
      core/tauri-build/src/lib.rs
  3. 0 0
      examples/api/dist/assets/index.js
  4. 10 11
      tooling/cli/src/mobile/mod.rs

+ 7 - 0
.changes/fix-empty-identifier.md

@@ -0,0 +1,7 @@
+---
+"cli.rs": patch
+"cli.js": patch
+"tauri-macros": patch
+---
+
+Resolve Android package name from single word bundle identifiers.

+ 1 - 1
core/tauri-build/src/lib.rs

@@ -274,7 +274,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
   let last = s.clone().count() - 1;
   let mut android_package_prefix = String::new();
   for (i, w) in s.enumerate() {
-    if i != last {
+    if i == 0 || i != last {
       android_package_prefix.push_str(w);
       android_package_prefix.push('_');
     }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
examples/api/dist/assets/index.js


+ 10 - 11
tooling/cli/src/mobile/mod.rs

@@ -27,7 +27,7 @@ use std::{
   fs::{create_dir_all, read_to_string, write},
   net::SocketAddr,
   path::PathBuf,
-  process::ExitStatus,
+  process::{exit, ExitStatus},
   sync::{
     atomic::{AtomicBool, Ordering},
     Arc,
@@ -256,18 +256,17 @@ fn get_app(config: &TauriConfig) -> App {
     domain.push_str(w);
     domain.push('.');
   }
-  domain.pop();
-
-  let s = config.tauri.bundle.identifier.split('.');
-  let last = s.clone().count() - 1;
-  let mut reverse_domain = String::new();
-  for (i, w) in s.enumerate() {
-    if i != last {
-      reverse_domain.push_str(w);
-      reverse_domain.push('.');
+  if domain.is_empty() {
+    domain = config.tauri.bundle.identifier.clone();
+    if domain.is_empty() {
+      log::error!(
+        "Bundle identifier set in `tauri.conf.json > tauri > bundle > identifier` cannot be empty"
+      );
+      exit(1);
     }
+  } else {
+    domain.pop();
   }
-  reverse_domain.pop();
 
   let interface = AppInterface::new(
     config,

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.