소스 검색

feat(core): detect android and ios platform configuration files (#4997)

Lucas Fernandes Nogueira 3 년 전
부모
커밋
b3a3afc7de
4개의 변경된 파일25개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 0
      .changes/mobile-config.md
  2. 2 2
      core/tauri-utils/src/config.rs
  3. 18 4
      core/tauri-utils/src/config/parse.rs
  4. 0 1
      tooling/cli/schema.json

+ 5 - 0
.changes/mobile-config.md

@@ -0,0 +1,5 @@
+---
+"tauri-utils": minor
+---
+
+Parse `android` and `ios` Tauri configuration files.

+ 2 - 2
core/tauri-utils/src/config.rs

@@ -2616,8 +2616,8 @@ impl PackageConfig {
 ///
 /// In addition to the default configuration file, Tauri can
 /// read a platform-specific configuration from `tauri.linux.conf.json`,
-/// `tauri.windows.conf.json`, and `tauri.macos.conf.json`
-/// (or `Tauri.linux.toml`, `Tauri.windows.toml` and `Tauri.macos.toml` if the `Tauri.toml` format is used),
+/// `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json`
+/// (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used),
 /// which gets merged with the main configuration object.
 ///
 /// ## Configuration Structure

+ 18 - 4
core/tauri-utils/src/config/parse.rs

@@ -54,6 +54,10 @@ impl ConfigFormat {
           "tauri.macos.conf.json"
         } else if cfg!(windows) {
           "tauri.windows.conf.json"
+        } else if cfg!(target_os = "android") {
+          "tauri.android.conf.json"
+        } else if cfg!(target_os = "ios") {
+          "tauri.ios.conf.json"
         } else {
           "tauri.linux.conf.json"
         }
@@ -63,6 +67,10 @@ impl ConfigFormat {
           "tauri.macos.conf.json5"
         } else if cfg!(windows) {
           "tauri.windows.conf.json5"
+        } else if cfg!(target_os = "android") {
+          "tauri.android.conf.json"
+        } else if cfg!(target_os = "ios") {
+          "tauri.ios.conf.json"
         } else {
           "tauri.linux.conf.json5"
         }
@@ -72,6 +80,10 @@ impl ConfigFormat {
           "Tauri.macos.toml"
         } else if cfg!(windows) {
           "Tauri.windows.toml"
+        } else if cfg!(target_os = "android") {
+          "tauri.android.toml"
+        } else if cfg!(target_os = "ios") {
+          "tauri.ios.toml"
         } else {
           "Tauri.linux.toml"
         }
@@ -143,11 +155,13 @@ pub enum ConfigError {
 
 /// Reads the configuration from the given root directory.
 ///
-/// It first looks for a `tauri.conf.json[5]` file on the given directory. The file must exist.
+/// It first looks for a `tauri.conf.json[5]` or `Tauri.toml` file on the given directory. The file must exist.
 /// Then it looks for a platform-specific configuration file:
-/// - `tauri.macos.conf.json[5]` on macOS
-/// - `tauri.linux.conf.json[5]` on Linux
-/// - `tauri.windows.conf.json[5]` on Windows
+/// - `tauri.macos.conf.json[5]` or `Tauri.macos.toml` on macOS
+/// - `tauri.linux.conf.json[5]` or `Tauri.linux.toml` on Linux
+/// - `tauri.windows.conf.json[5]` or `Tauri.windows.toml` on Windows
+/// - `tauri.android.conf.json[5]` or `Tauri.android.toml` on Android
+/// - `tauri.ios.conf.json[5]` or `Tauri.ios.toml` on iOS
 /// Merging the configurations using [JSON Merge Patch (RFC 7396)].
 ///
 /// [JSON Merge Patch (RFC 7396)]: https://datatracker.ietf.org/doc/html/rfc7396.

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1
tooling/cli/schema.json


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