From bdfb8140fd2fe0ecde237d905c9edbd1de9966cf Mon Sep 17 00:00:00 2001 From: Thomas Epperson Date: Mon, 19 Jan 2026 09:25:17 -0600 Subject: [PATCH 1/2] Add option to include aar in the libs dir along with associated config elements. --- apk/src/manifest.rs | 8 ++++++++ xbuild/src/config.rs | 2 ++ xbuild/src/gradle/mod.rs | 7 ++++++- xbuild/src/gradle/settings.gradle | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/apk/src/manifest.rs b/apk/src/manifest.rs index c1e4ffdd..4afc7c96 100644 --- a/apk/src/manifest.rs +++ b/apk/src/manifest.rs @@ -25,9 +25,13 @@ pub struct AndroidManifest { #[serde(rename(serialize = "uses-sdk"))] #[serde(default)] pub sdk: Sdk, + #[serde(rename(serialize = "xmlns:tools"))] + pub xmlns_tools: Option, #[serde(rename(serialize = "uses-feature"))] #[serde(default)] pub uses_feature: Vec, + #[serde(rename(serialize = "tools:replace"))] + pub tools_replace: Option, #[serde(rename(serialize = "uses-permission"))] #[serde(default)] pub uses_permission: Vec, @@ -46,6 +50,8 @@ impl Default for AndroidManifest { uses_feature: Default::default(), uses_permission: Default::default(), application: Default::default(), + xmlns_tools: Default::default(), + tools_replace: Default::default(), compile_sdk_version: Default::default(), compile_sdk_version_codename: Default::default(), platform_build_version_code: Default::default(), @@ -82,6 +88,8 @@ pub struct Application { #[serde(rename(serialize = "activity"))] #[serde(default)] pub activities: Vec, + #[serde(rename(serialize = "tools:replace"))] + pub tools_replace: Option, } /// Android [activity element](https://developer.android.com/guide/topics/manifest/activity-element). diff --git a/xbuild/src/config.rs b/xbuild/src/config.rs index d5d204f8..be06c4bd 100644 --- a/xbuild/src/config.rs +++ b/xbuild/src/config.rs @@ -430,6 +430,8 @@ pub struct AndroidConfig { pub manifest: AndroidManifest, #[serde(default)] pub dependencies: Vec, + #[serde(default)] + pub aars: Vec, /// Defaults to [`false`], but uses [`true`] when the user builds a format that requires /// `gradle` (i.e. [`Format::Aab`]). #[serde(default)] diff --git a/xbuild/src/gradle/mod.rs b/xbuild/src/gradle/mod.rs index 35955337..5ad6037a 100644 --- a/xbuild/src/gradle/mod.rs +++ b/xbuild/src/gradle/mod.rs @@ -66,6 +66,11 @@ pub fn build(env: &BuildEnv, libraries: Vec<(Target, PathBuf)>, out: &Path) -> R dependencies.push_str(&format!("implementation '{dep}'\n")); } + for aar in &config.aars { + let aar = env.root_dir().join(aar).as_os_str().to_str().unwrap().to_string(); + dependencies.push_str(&format!("implementation files('{aar}.aar')\n")); + } + let asset_packs = if config.assets.is_empty() { "" } else { @@ -90,12 +95,12 @@ pub fn build(env: &BuildEnv, libraries: Vec<(Target, PathBuf)>, out: &Path) -> R }} {asset_packs} }} + dependencies {{ {dependencies} }} "#, ); - let pack_name = "baseAssets"; let base_assets = gradle.join(pack_name); // Make sure that any possibly-obsolete asset pack does not clobber the build diff --git a/xbuild/src/gradle/settings.gradle b/xbuild/src/gradle/settings.gradle index 9f5af3eb..1ddf9128 100644 --- a/xbuild/src/gradle/settings.gradle +++ b/xbuild/src/gradle/settings.gradle @@ -3,6 +3,9 @@ pluginManagement { gradlePluginPortal() google() mavenCentral() + flatDir { + dirs 'libs' + } } } dependencyResolutionManagement { From 4f24b8eb2aed2cae5907789545c60c145a84d6ff Mon Sep 17 00:00:00 2001 From: Thomas Epperson Date: Mon, 19 Jan 2026 11:57:12 -0600 Subject: [PATCH 2/2] Add a sample configuration that shows the various manifest options available. --- manifest-example.yaml | 404 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 404 insertions(+) create mode 100644 manifest-example.yaml diff --git a/manifest-example.yaml b/manifest-example.yaml new file mode 100644 index 00000000..c9b2b48e --- /dev/null +++ b/manifest-example.yaml @@ -0,0 +1,404 @@ +#generic application configuration +generic: + #the path for the icon file for the application + icon: icon.svg + #the generic runtime libraries for the project + runtime_libs: [example.so, example2.so] +#android specific configuration elements +android: + #generic android configuration + generic: + #the path for the icon file for the application + icon: icon.svg + #the generic runtime libraries for the project + runtime_libs: [example.so, example2.so] + #android manifest options + manifest: + #the namesapce for the application (xmlns:android) + ns_android: http://schemas.android.com/apk/res/android + #the name of the package + package: "com.example.whatever" + # the internal application version code + version_code: 42 + # the user visible version string + version_name: "Flaming Rhinoceros" + #the sdk version to compile against + compile_sdk_version: 33 + # specifies android:compileSdkVersionCodename + compile_sdk_version_codename: 13 + # the platform build version code + platform_build_version_code: 33 + # the platformBuildVersionName option + platformBuildVersionName: 13 + # specifies details about the sdk to use + sdk: { min_sdk_version: 21, target_sdk_version: 33, max_sdk_version: 33 } + # specifies xmlns:tools for the manifest + xmlns_tools: http://schemas.android.com/tools + # specifies which andoird features are used + uses_feature: [ + #require the nfc feature as an example + { name: android.hardware.nfc, required: true } + ] + # the list of permissions required by the application + uses_permission: [ + { name: android.permission.NFC, max_sdk_version: 33 }, + name: android.permission.INTERNET, + name: android.permission.WRITE_EXTERNAL_STORAGE, + name: android.permission.ACCESS_NETWORK_STATE, + name: android.permission.READ_DEVICE_CONFIG, + ] + # the application settings + application: + #is the application debuggable? + debuggable: true + # the android theme for the application + theme: '@android:style/Theme.NoTitleBar.Fullscreen' + # is java code utilized? + has_code: true + # the android application icon + icon: android_icon.svg + # the user visible name of the application + label: 'Example application' + # specifies the android property android:appComponentFactory + app_component_factory: androidx.core.app.CoreComponentFactory + # specifies metadata for the application + meta_data: [ + { name: example, value: test } + ] + # the android activities for the application + activities: [ + { + # specify android:configChanges for the activity + config_changes: 'orientation|screenSize|keyboardHidden', + # label for the activity + label: 'Test activity', + # the android:launchMode property + launch_mode: standard, + # the android:name property for the activity + name: 'example activity', + # the screen orientation for the activity + orientation: unspecified, + # the android property android:windowSoftInputMode for the activity + window_soft_input_mode: stateVisible, + # is this activity exported for other applications? + exported: true, + # the android:hardwareAccelerated property + hardware_accelerated: true, + # specifies metadata for the activity + meta_data: [ + { name: example2, value: test2 } + ], + # specifies intent filters for the activity + intent_filters: [ + { + actions: ['exampleaction'], + categories: ['examplecategory'], + data: [ + # the android:scheme property + scheme: 'examplescheme', + # the android:host property + host: 'example', + # the android:port property + port: 'exampleport', + # the android:path property + path: 'examplepath', + # the andoird:pathPattern property + path_pattern: 'example_path_pattern', + # the android:pathPrefix property + path_prefix: 'example_path_prefix', + # the android:mimeType property + mime_type: 'example_mime_type', + ], + }, + ], + #specifies the android:colorMode property + color_mode: 'example_color_mode', + } + ] + # specifies tools:replace for the application + tools_replace: 'android:label' + # the list of dependencies + dependencies: [dependency1, dependency2] + #the list of aar to include in the application, starting at the porject root directory + aars: [libs/example.aar] + # should gradle be sued for the build? + gradle: true + # set to true when using wry (a cross platform webview rendering library) + wry: false + #the list of assets for the application (TODO: not sure how to specify this) + assets: [] + # the android debug config, TODO not sure how to specify the hashmap data here + debug: { forward: {}, reverse: {} } + #the linux specific configuration + linux: + #the path for the icon file for the application + icon: icon.svg + #the generic runtime libraries for the project + runtime_libs: [example.so, example2.so] + #the ios specific configuration + ios: + #the generic configuration + generic: + #the path for the icon file for the application + icon: icon.svg + #the generic runtime libraries for the project + runtime_libs: [example.so, example2.so] + # assets to add to the Assets.car path in the application + assets_car: example_path + #the info plist data + info: { + # The default language and region for the bundle, as a language ID. + cf_bundle_development_region: example, + # The user-visible name for the bundle, used by Siri and visible on the iOS Home screen. + cf_bundle_display_name: example, + # The entry point of the bundle. + cf_bundle_executable: example, + # the icons for the bundle + cf_bundle_icons: { cf_bundle_primary_icon: { cf_bundle_icon_name: example, },}, + # the icon name of the bundle + cf_bundle_icon_name: example, + # a unique identifier for the bundle + cf_bundle_identifier: example, + # The current version of the Information Property List structure. + cf_bundle_info_dictionary_version: example, + # A user-visible short name for the bundle. + cf_bundle_name: example, + # The type of bundle. + cf_bundle_package_type: example, + # The release or version number of the bundle. + cf_bundle_short_version_string: example, + # A replacement for the app name in text-to-speech operations. + cf_bundle_spoken_name: example, + # CFBundleSupportedPlatforms + cf_bundle_supported_platforms: [platform1, platform2], + # The version of the build that identifies an iteration of the bundle. + cf_bundle_version: example, + # the DTCompiler property + dt_compiler: example, + # the DTPlatformBuild property + dt_platform_build: example, + # the DTPlatformName property + dt_platform_name: example, + # the DTPlatformVersion property + dt_platform_version: example, + # the DTSDKBuild property + dt_sdk_build: example, + # the DTSDKName property + dt_sdk_name: example, + # the DTXcode property + dt_xcode: example, + # the DTXcodeBuild property + dt_xcode_build: example, + # The category that best describes your app for the App Store. + ls_application_category_type: examples, + # The minimum version of the operating system required for the app to run in macOS. + ls_minimum_system_version: example, + # A boolean value indicating whether the app must run in iOS. + ls_requires_ios: false, + # The minimum version of the operating system required for the app to run in iOS, iPadOS, tvOS, and watchOS. + minimum_os_version: example, + # A message that tells the user why the app is requesting access to the device's camera. + ns_camera_usage_description: 'this is an example', + # A human-readable copyright notice for the bundle. + ns_human_readable_copyright: example copyright, + # the UIDeviceFamilyproperty + ui_device_family: [1,2,3,4], + # the UILaunchScreenproperty + ui_launch_screen: { + # the UIColorName property + ui_color_name: example, + # the UIImageName property + ui_image_name: example, + #the UIImageRespectsSafeAreaInsets property + ui_image_respects_safe_area_insets: false, + #the UINavigationBar property + ui_navigation_bar: false, + # the UITabBar property + ui_tab_bar: false, + # the UIToolbar property + ui_toolbar: false, + }, + # the UILaunchStoryboardName property + ui_launch_storyboard_name: example, + # the UIRequiredDeviceCapabilities property + ui_required_device_capabilities: [example1, example2,], + # the UISupportedInterfaceOrientationsproperty~ipad property + ui_supported_interface_orientations_ipad: [example1, example2], + # the UISupportedInterfaceOrientations~iphone property + ui_supported_interface_orientations_iphone: [example1, example2], + } + #the macos specific configuration + macos: + #the generic configuration + generic: + #the path for the icon file for the application + icon: icon.svg + #the generic runtime libraries for the project + runtime_libs: [example.so, example2.so] + #the info plist data + info: { + # The default language and region for the bundle, as a language ID. + cf_bundle_development_region: example, + # The user-visible name for the bundle, used by Siri and visible on the iOS Home screen. + cf_bundle_display_name: example, + # The entry point of the bundle. + cf_bundle_executable: example, + # the icons for the bundle + cf_bundle_icons: { cf_bundle_primary_icon: { cf_bundle_icon_name: example, },}, + # the icon name of the bundle + cf_bundle_icon_name: example, + # a unique identifier for the bundle + cf_bundle_identifier: example, + # The current version of the Information Property List structure. + cf_bundle_info_dictionary_version: example, + # A user-visible short name for the bundle. + cf_bundle_name: example, + # The type of bundle. + cf_bundle_package_type: example, + # The release or version number of the bundle. + cf_bundle_short_version_string: example, + # A replacement for the app name in text-to-speech operations. + cf_bundle_spoken_name: example, + # CFBundleSupportedPlatforms + cf_bundle_supported_platforms: [platform1, platform2], + # The version of the build that identifies an iteration of the bundle. + cf_bundle_version: example, + # the DTCompiler property + dt_compiler: example, + # the DTPlatformBuild property + dt_platform_build: example, + # the DTPlatformName property + dt_platform_name: example, + # the DTPlatformVersion property + dt_platform_version: example, + # the DTSDKBuild property + dt_sdk_build: example, + # the DTSDKName property + dt_sdk_name: example, + # the DTXcode property + dt_xcode: example, + # the DTXcodeBuild property + dt_xcode_build: example, + # The category that best describes your app for the App Store. + ls_application_category_type: examples, + # The minimum version of the operating system required for the app to run in macOS. + ls_minimum_system_version: example, + # A boolean value indicating whether the app must run in iOS. + ls_requires_ios: false, + # The minimum version of the operating system required for the app to run in iOS, iPadOS, tvOS, and watchOS. + minimum_os_version: example, + # A message that tells the user why the app is requesting access to the device's camera. + ns_camera_usage_description: 'this is an example', + # A human-readable copyright notice for the bundle. + ns_human_readable_copyright: example copyright, + # the UIDeviceFamilyproperty + ui_device_family: [1,2,3,4], + # the UILaunchScreenproperty + ui_launch_screen: { + # the UIColorName property + ui_color_name: example, + # the UIImageName property + ui_image_name: example, + #the UIImageRespectsSafeAreaInsets property + ui_image_respects_safe_area_insets: false, + #the UINavigationBar property + ui_navigation_bar: false, + # the UITabBar property + ui_tab_bar: false, + # the UIToolbar property + ui_toolbar: false, + }, + # the UILaunchStoryboardName property + ui_launch_storyboard_name: example, + # the UIRequiredDeviceCapabilities property + ui_required_device_capabilities: [example1, example2,], + # the UISupportedInterfaceOrientationsproperty~ipad property + ui_supported_interface_orientations_ipad: [example1, example2], + # the UISupportedInterfaceOrientations~iphone property + ui_supported_interface_orientations_iphone: [example1, example2], + } + #the windows specific configuration + windows: + #the generic configuration + generic: + #the path for the icon file for the application + icon: icon.svg + #the generic runtime libraries for the project + runtime_libs: [example.so, example2.so] + # the windows manifest for the application + manifest: + # the xml namespace, xmlns property + ns: example + # the xmlns:uap property + ns_uap: example + # the xmlns:rescap property + ns_rescap: example + # the Identity property + identity: { + # the Name property + name: example, + # the Version property + version: example, + # the Publisher property + publisher: example, + # the ProcessorArchitecture property + processor_architecture: example, + } + # the Properties + properties: { + display_name: example, + publisher_display_name: example, + logo: example_logo, + description: example_description, + } + # Resources + resources: { + resource: [ { language: example_language, } ], + } + # Dependencies + dependencies: { + # the TargetDeviceFamily property + target_device_family: [ + { name: example, min_version: example, max_version: example, }, + ], + } + # Capabilities + capabilities: [ + { + # TODO + }, + ] + # Applications + applications: { + application: [ + { id: example, + executable: example, + entry_point: example, + visual_elements: { + background_color: example, + display_name: example, + description: example, + logo_150x150: example, + logo_44x44: example, + default_tile: { + short_name: example, + logo_71x71: example, + logo_310x310: example, + logo_310x150: example, + show_names_on_tiles: { + show_on: [ + { tile: example, }, + ], + }, + }, + splash_screen: { + image: example, + }, + lock_screen: { + badge_logo: example, + notification: example, + }, + }, + } + ], + }