From 13fabbaab9ad40a972f5b8a0212636f3903b5a4d Mon Sep 17 00:00:00 2001 From: SmileSky Date: Sun, 17 Nov 2024 18:43:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3xml=E6=B8=85=E5=8D=95uses-fea?= =?UTF-8?q?ture=E8=8A=82=E7=82=B9=E7=9A=84=E5=8F=AF=E9=80=89=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=9A=84=E5=BA=8F=E5=88=97=E5=8C=96=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B=20=E4=BF=AE=E6=AD=A3=E4=B8=80=E4=BA=9B=E6=8B=BC?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF=EF=BC=9B=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E8=87=B31.0.3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 4 ++-- cargo-apk2/Cargo.toml | 2 +- ndk-build2/src/manifest.rs | 40 ++++++++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 26389b9..1d4ab33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "1.0.2" +version = "1.0.3" authors = [ "SmileSky ", "The Rust Windowing contributors", @@ -12,7 +12,7 @@ rust-version = "1.82.0" [workspace.dependencies] dunce = "1.0.5" -serde = "1.0.214" +serde = "1.0.215" thiserror = "2.0.3" [workspace] diff --git a/cargo-apk2/Cargo.toml b/cargo-apk2/Cargo.toml index eff928e..0ef92e4 100644 --- a/cargo-apk2/Cargo.toml +++ b/cargo-apk2/Cargo.toml @@ -21,7 +21,7 @@ toml = "0.8.19" [dependencies.ndk-build2] path = "../ndk-build2" -version = "1.0.2" +version = "1.0.3" [dependencies.clap] version = "4.5.20" diff --git a/ndk-build2/src/manifest.rs b/ndk-build2/src/manifest.rs index cb728fd..d4928f2 100644 --- a/ndk-build2/src/manifest.rs +++ b/ndk-build2/src/manifest.rs @@ -194,7 +194,7 @@ pub struct IntentFilter { #[serde(default)] pub actions: Vec, /// 序列化为结构向量以实现正确的 xml 格式 - #[serde(serialize_with = "serialize_catergories")] + #[serde(serialize_with = "serialize_categories")] #[serde(rename(serialize = "category"))] #[serde(default)] pub categories: Vec, @@ -222,7 +222,7 @@ where seq.end() } -fn serialize_catergories(categories: &[String], serializer: S) -> Result +fn serialize_categories(categories: &[String], serializer: S) -> Result where S: Serializer, { @@ -271,30 +271,39 @@ pub struct MetaData { pub value: String, } +//noinspection SpellCheckingInspection /// Android [uses-feature 元素](https://developer.android.com/guide/topics/manifest/uses-feature-element). #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct Feature { - #[serde(rename(serialize = "@android:name"))] + #[serde( + rename(serialize = "@android:name"), + skip_serializing_if = "Option::is_none" + )] pub name: Option, - #[serde(rename(serialize = "@android:required"))] + #[serde( + rename(serialize = "@android:required"), + skip_serializing_if = "Option::is_none" + )] pub required: Option, - /// The `version` field is currently used for the following features: - /// - /// - `name="android.hardware.vulkan.compute"`: The minimum level of compute features required. See the [Android documentation](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_VULKAN_HARDWARE_COMPUTE) - /// for available levels and the respective Vulkan features required/provided. + /// `version` 字段当前用于以下功能: /// - /// - `name="android.hardware.vulkan.level"`: The minimum Vulkan requirements. See the [Android documentation](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_VULKAN_HARDWARE_LEVEL) - /// for available levels and the respective Vulkan features required/provided. - /// - /// - `name="android.hardware.vulkan.version"`: Represents the value of Vulkan's `VkPhysicalDeviceProperties::apiVersion`. See the [Android documentation](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_VULKAN_HARDWARE_VERSION) - /// for available levels and the respective Vulkan features required/provided. - #[serde(rename(serialize = "@android:version"))] + /// - `name="android.hardware.vulkan.compute"`: 所需的最低计算功能级别。请参阅 [Android 文档](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_VULKAN_HARDWARE_COMPUTE),了解可用级别以及所需/提供的相应 Vulkan 功能。 + /// - `name="android.hardware.vulkan.level"`: Vulkan 的最低要求。请参阅 [Android 文档](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_VULKAN_HARDWARE_LEVEL)了解可用级别以及所需/提供的相应 Vulkan 功能。 + /// - `name="android.hardware.vulkan.version"`: 表示 Vulkan 的 `VkPhysicalDeviceProperties::apiVersion` 的值。请参阅 [Android 文档](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_VULKAN_HARDWARE_VERSION)以了解可用级别以及所需/提供的相应 Vulkan 功能。 + #[serde( + rename(serialize = "@android:version"), + skip_serializing_if = "Option::is_none" + )] pub version: Option, - #[serde(rename(serialize = "@android:glEsVersion"))] + #[serde( + rename(serialize = "@android:glEsVersion"), + skip_serializing_if = "Option::is_none" + )] #[serde(serialize_with = "serialize_opengles_version")] pub opengles_version: Option<(u8, u8)>, } +//noinspection SpellCheckingInspection fn serialize_opengles_version( version: &Option<(u8, u8)>, serializer: S, @@ -382,6 +391,7 @@ impl Default for Sdk { } } +//noinspection HttpUrlsUsage fn default_namespace() -> String { "http://schemas.android.com/apk/res/android".to_string() }