Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
8e38955
initial version
wheregmis Oct 24, 2025
823a6fc
make custom permission work without const-vec change
wheregmis Oct 24, 2025
5a8768f
wiring up with cli
wheregmis Oct 24, 2025
1bb420c
yey symbol found
wheregmis Oct 24, 2025
c536376
wip
wheregmis Oct 25, 2025
014b56e
holy moly
wheregmis Oct 25, 2025
6dfb8a6
proper ui
wheregmis Oct 25, 2025
db6970a
cleanup
wheregmis Oct 25, 2025
b615fd3
okay
wheregmis Oct 25, 2025
d008e20
wip cleanup
wheregmis Oct 25, 2025
fccf797
reduce boilerplate code into mobile-core
wheregmis Oct 26, 2025
4dca081
Delete copilot-instructions.md
wheregmis Oct 26, 2025
fc778f8
revert hello-world example for low diff
wheregmis Oct 26, 2025
cb853bd
fix android build in mobile-core
wheregmis Oct 26, 2025
61224d4
rename permission to static_permission
wheregmis Oct 26, 2025
7e7fea2
small success with popup location on android
wheregmis Oct 26, 2025
469ca82
android popup working
wheregmis Oct 26, 2025
a42f502
Refactor permission checks for readability
wheregmis Oct 26, 2025
182060d
wip consolidate all java files and build from cli instead of build.rs
wheregmis Oct 26, 2025
68bd075
few cli cleanups
wheregmis Oct 26, 2025
6ed893c
wip java_plugin macro
wheregmis Oct 26, 2025
cb008e6
cleanup cleanup cleanup
wheregmis Oct 26, 2025
a86d443
Update java_plugin macro to use full relative file paths
wheregmis Oct 26, 2025
ac24196
Improve iOS geolocation permission and retrieval logic
wheregmis Oct 26, 2025
0e8381c
Add ios_plugin macro for iOS framework metadata
wheregmis Oct 26, 2025
90547d1
not needed
wheregmis Oct 26, 2025
cc32a6e
simplify the plugin
wheregmis Oct 26, 2025
8e5cd64
rename mobile-core to platform-bridge and mobile-core-macro to platfo…
wheregmis Oct 26, 2025
22a258c
Refactor metadata serialization buffer initialization
wheregmis Oct 26, 2025
4129fb5
mobile-geolocation out of dioxus
wheregmis Oct 26, 2025
a59e6dc
take the example also out of dioxus
wheregmis Oct 26, 2025
e80d6b0
remove example from cargo toml
wheregmis Oct 26, 2025
f957fdb
remove demo css
wheregmis Oct 26, 2025
8c5236d
revert hello-world example
wheregmis Oct 26, 2025
914cd06
revert mac.plist
wheregmis Oct 26, 2025
69faecc
revert gitignore
wheregmis Oct 26, 2025
83262b0
Remove basic usage example for permissions crate
wheregmis Oct 26, 2025
1e2a334
Merge branch 'main' into native_api_testing
wheregmis Oct 26, 2025
62acda2
Delete plan.md
wheregmis Oct 26, 2025
7051c3b
remove dups
wheregmis Oct 26, 2025
e379216
cleanup java build
wheregmis Oct 27, 2025
4187f57
cleanup permission symbol extraction
wheregmis Oct 27, 2025
3d09873
update todo
wheregmis Oct 27, 2025
5bfb3f8
small slop of tested permissions in enums for minimum diff
wheregmis Oct 27, 2025
950ae2c
Refactor symbol extraction into linker_symbols module
wheregmis Oct 27, 2025
d54cbb9
wip consolidate ios and macos as darwin
wheregmis Oct 27, 2025
133ea99
Add docs and re-export for MainThreadCell and MainThreadMarker
wheregmis Oct 27, 2025
db1a96f
Update Darwin framework symbol and section names
wheregmis Oct 27, 2025
5bcce4e
Fix Info.plist path handling for iOS and macOS
wheregmis Oct 27, 2025
fcba26d
Handle missing permission symbols and web bundle case
wheregmis Oct 27, 2025
c1ba398
objc2 over framework
wheregmis Oct 27, 2025
909acb8
windows, linux, web all permissions are runtime so cleanup
wheregmis Oct 27, 2025
f878a78
only include permissions for build time
wheregmis Oct 27, 2025
dadc7c1
cleanup unnecessary test
wheregmis Oct 27, 2025
a186c3d
more cleanup
wheregmis Oct 27, 2025
99ab4d7
Merge branch 'main' into native_api_testing
wheregmis Oct 28, 2025
669a155
extract shared into dx-macro-helpers
wheregmis Nov 5, 2025
53e590b
Merge branch 'main' into native_api_testing
wheregmis Nov 5, 2025
a0f04a7
Merge branch 'main' into native_api_testing
wheregmis Nov 5, 2025
88c3bf1
rc.3 to 0.7.0 for const-serialize
wheregmis Nov 5, 2025
3be129c
Add CustomPermissionBuilder and enhance PermissionBuilder for better …
wheregmis Nov 5, 2025
1b49362
clippy fixes
wheregmis Nov 5, 2025
691f9c2
implement const cbor encoding + decoding for basic types
ealmloff Nov 5, 2025
a94a7a3
Add #[used] attribute to linker sections for optimization protection
wheregmis Nov 6, 2025
5ba45ed
implement map encoding and decoding
ealmloff Nov 6, 2025
7632fed
fix map test
ealmloff Nov 6, 2025
813e33f
wip unified linker symbol
wheregmis Nov 6, 2025
7b18500
cleanup permissions
wheregmis Nov 6, 2025
ddea9a4
pipe java sources with manganis as well
wheregmis Nov 6, 2025
2298e04
all tests passing
ealmloff Nov 7, 2025
14a70ae
dynamically sized arrays
ealmloff Nov 7, 2025
58a18c2
smaller str encoding
ealmloff Nov 7, 2025
4a42605
swap array and list and add more documentation
ealmloff Nov 11, 2025
d673846
move serialization and deserialization for each struct together
ealmloff Nov 11, 2025
9d3e6b8
support both legacy and new assets
ealmloff Nov 12, 2025
524d25f
bump const serialize version
ealmloff Nov 12, 2025
d3cf930
Merge branch 'main' into const-cbor
ealmloff Nov 12, 2025
9d99a87
fix asset conversion code
ealmloff Nov 12, 2025
896aaba
pull out manganis symbol struct from tuble
ealmloff Nov 12, 2025
68e5f7d
test reading old asset versions
ealmloff Nov 12, 2025
ca9089c
more list/array cleanup and bump rust version
ealmloff Nov 12, 2025
7395459
fix clippy
ealmloff Nov 12, 2025
aef1cfe
Revert "pipe java sources with manganis as well"
wheregmis Nov 12, 2025
fafae5d
Revert "cleanup permissions"
wheregmis Nov 12, 2025
817208a
Revert "wip unified linker symbol"
wheregmis Nov 12, 2025
d92fe1e
Revert "Add #[used] attribute to linker sections for optimization pro…
wheregmis Nov 12, 2025
390f6fa
Merge branch 'pr/4932' into native_api_testing
wheregmis Nov 12, 2025
732a2ce
update cargo lock
wheregmis Nov 12, 2025
674d61c
wip permission through assets
wheregmis Nov 12, 2025
0f4c298
abit cleanup
wheregmis Nov 12, 2025
7dc6a63
fix reexports
wheregmis Nov 12, 2025
f5a1de2
fix assets
wheregmis Nov 13, 2025
fd1fdd6
Fix the permissions piping
wheregmis Nov 13, 2025
4f938f2
some small cleanups
wheregmis Nov 13, 2025
5f6dc10
checkout const-serialize as per #4932 and fix build
wheregmis Nov 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,131 changes: 872 additions & 259 deletions Cargo.lock

Large diffs are not rendered by default.

30 changes: 27 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ members = [
"packages/rsx-hotreload",
"packages/const-serialize",
"packages/const-serialize-macro",
"packages/dx-macro-helpers",
"packages/permissions/permissions-core",
"packages/permissions/permissions-macro",
"packages/permissions/permissions",
"packages/dx-wire-format",
"packages/logger",
"packages/config-macros",
Expand All @@ -86,6 +90,10 @@ members = [
"packages/manganis/manganis-core",
"packages/manganis/manganis-macro",

# platform-bridge
"packages/platform-bridge",
"packages/platform-bridge-macro",

# wasm-split
"packages/wasm-split/wasm-split",
"packages/wasm-split/wasm-split-macro",
Expand Down Expand Up @@ -193,9 +201,22 @@ dioxus-cli-opt = { path = "packages/cli-opt", version = "0.7.1" }
dioxus-cli-telemetry = { path = "packages/cli-telemetry", version = "0.7.1" }
dioxus-cli-config = { path = "packages/cli-config", version = "0.7.1" }

# const-serializea
const-serialize = { path = "packages/const-serialize", version = "0.7.1" }
const-serialize-macro = { path = "packages/const-serialize-macro", version = "0.7.1" }

dx-macro-helpers = { path = "packages/dx-macro-helpers", version = "0.7.0" }

# permissions
permissions-core = { path = "packages/permissions/permissions-core", version = "=0.7.0-rc.3" }
permissions-macro = { path = "packages/permissions/permissions-macro", version = "=0.7.0-rc.3" }
permissions = { path = "packages/permissions/permissions", version = "=0.7.0-rc.3" }

# platform bridge
dioxus-platform-bridge = { path = "packages/platform-bridge", version = "=0.7.0-rc.3" }
# const-serialize
const-serialize = { path = "packages/const-serialize", version = "0.8.0" }
const-serialize-macro = { path = "packages/const-serialize-macro", version = "0.8.0" }

# The version of const-serialize published with 0.7.0 and 0.7.1 that the CLI should still support
const-serialize-07 = { package = "const-serialize", version = "0.7.1" }

# subsecond
subsecond-types = { path = "packages/subsecond/subsecond-types", version = "0.7.1" }
Expand All @@ -206,6 +227,9 @@ manganis = { path = "packages/manganis/manganis", version = "0.7.1" }
manganis-core = { path = "packages/manganis/manganis-core", version = "0.7.1" }
manganis-macro = { path = "packages/manganis/manganis-macro", version = "0.7.1" }

# The version of assets published with 0.7.0 and 0.7.1 that the CLI should still support
manganis-core-07 = { package = "manganis-core", version = "0.7.1" }

# wasm-split
wasm-splitter = { path = "packages/wasm-split/wasm-split", version = "0.7.1" }
wasm-split-macro = { path = "packages/wasm-split/wasm-split-macro", version = "0.7.1" }
Expand Down
1 change: 1 addition & 0 deletions packages/cli-opt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ keywords = ["dom", "ui", "gui", "react"]
anyhow = { workspace = true }
manganis = { workspace = true }
manganis-core = { workspace = true }
permissions = { path = "../permissions/permissions" }
object = { workspace = true, features = ["wasm"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions packages/cli-opt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ mod json;
pub use file::process_file_to;
pub use hash::add_hash_to_asset;

// Re-export SymbolData from the public permissions crate for convenience
pub use permissions::SymbolData;

/// A manifest of all assets collected from dependencies
///
/// This will be filled in primarily by incremental compilation artifacts.
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ depinfo = { workspace = true }
subsecond-types = { workspace = true }
dioxus-cli-telemetry = { workspace = true }
dioxus-component-manifest = { workspace = true }
permissions = { workspace = true }

clap = { workspace = true, features = ["derive", "cargo"] }
convert_case = { workspace = true }
Expand Down Expand Up @@ -98,6 +99,7 @@ brotli = "8.0.1"
ignore = "0.4.23"
env_logger = { workspace = true }
const-serialize = { workspace = true, features = ["serde"] }
const-serialize-07 = { workspace = true, features = ["serde"] }

tracing-subscriber = { version = "0.3.19", features = [
"std",
Expand All @@ -122,6 +124,7 @@ log = { version = "0.4", features = ["max_level_off", "release_max_level_off"] }
tempfile = "3.19.1"
manganis = { workspace = true }
manganis-core = { workspace = true }
manganis-core-07 = { workspace = true }
target-lexicon = { version = "0.13.2", features = ["serde", "serde_support"] }
wasm-encoder = "0.235.0"

Expand Down
7 changes: 2 additions & 5 deletions packages/cli/assets/android/MainActivity.kt.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package dev.dioxus.main;

// need to re-export buildconfig down from the parent
import {{application_id}}.BuildConfig;
typealias BuildConfig = BuildConfig;
package dev.dioxus.main

typealias BuildConfig = {{application_id}}.BuildConfig

class MainActivity : WryActivity()
5 changes: 5 additions & 0 deletions packages/cli/assets/android/gen/app/build.gradle.kts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ android {
buildFeatures {
buildConfig = true
}
sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin", "src/main/java")
}
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<!-- Permissions will be injected here by Dioxus CLI -->
<application android:hasCode="true" android:supportsRtl="true" android:icon="@mipmap/ic_launcher"
android:extractNativeLibs="true"
android:allowNativeHeapPointerTagging="false"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
## TODO: Update this before merging
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
# distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/assets/ios/ios.plist.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>

<!-- Permissions will be injected here by Dioxus CLI -->
</dict>
</plist>
144 changes: 144 additions & 0 deletions packages/cli/src/build/android_java.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
//! Android Java source collection from compiled binaries
//!
//! This module extracts Java source metadata from embedded linker symbols,
//! similar to how permissions and manganis work. It finds `__JAVA_SOURCE__`
//! symbols in the binary and deserializes them into metadata that can be
//! used by the Gradle build process.

use std::io::Read;
use std::path::Path;

use crate::Result;

const JAVA_SOURCE_SYMBOL_PREFIX: &str = "__JAVA_SOURCE__";

use super::linker_symbols;

/// Metadata about Java sources that need to be compiled to DEX
/// This mirrors the struct from platform-bridge
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct JavaSourceMetadata {
/// File paths relative to crate root
pub files: Vec<String>,
/// Java package name (e.g. "dioxus.mobile.geolocation")
pub package_name: String,
/// Plugin identifier for organization (e.g. "geolocation")
pub plugin_name: String,
}

impl JavaSourceMetadata {
/// Create from the platform-bridge SerializeConst version
fn from_const_serialize(
package_name: const_serialize::ConstStr,
plugin_name: const_serialize::ConstStr,
file_count: u8,
files: [const_serialize::ConstStr; 8],
) -> Self {
Self {
package_name: package_name.as_str().to_string(),
plugin_name: plugin_name.as_str().to_string(),
files: files[..file_count as usize]
.iter()
.map(|s| s.as_str().to_string())
.collect(),
}
}
}

/// A manifest of all Java sources found in a binary
#[derive(Debug, Clone, Default)]
pub struct JavaSourceManifest {
sources: Vec<JavaSourceMetadata>,
}

impl JavaSourceManifest {
pub fn new(sources: Vec<JavaSourceMetadata>) -> Self {
Self { sources }
}

pub fn sources(&self) -> &[JavaSourceMetadata] {
&self.sources
}

pub fn is_empty(&self) -> bool {
self.sources.is_empty()
}
}

/// Extract all Java sources from the given file
pub(crate) fn extract_java_sources_from_file(path: impl AsRef<Path>) -> Result<JavaSourceManifest> {
let path = path.as_ref();
let offsets = linker_symbols::find_symbol_offsets_from_path(path, JAVA_SOURCE_SYMBOL_PREFIX)?;

let mut file = std::fs::File::open(path)?;
let mut file_contents = Vec::new();
file.read_to_end(&mut file_contents)?;

let mut sources = Vec::new();

// Parse the metadata from each symbol offset
// The format is: (package_name: &str, plugin_name: &str, files: &[&str])
for offset in offsets {
match parse_java_metadata_at_offset(&file_contents, offset as usize) {
Ok(metadata) => {
tracing::debug!(
"Extracted Java metadata: plugin={}, package={}, files={:?}",
metadata.plugin_name,
metadata.package_name,
metadata.files
);
sources.push(metadata);
}
Err(e) => {
tracing::warn!("Failed to parse Java metadata at offset {}: {}", offset, e);
}
}
}

if !sources.is_empty() {
tracing::info!(
"Extracted {} Java source declarations from binary",
sources.len()
);
}

Ok(JavaSourceManifest::new(sources))
}

/// Parse Java metadata from binary data at the given offset
///
/// The data is serialized using const-serialize and contains:
/// - package_name: ConstStr
/// - plugin_name: ConstStr
/// - file_count: u8
/// - files: [ConstStr; 8]
fn parse_java_metadata_at_offset(data: &[u8], offset: usize) -> Result<JavaSourceMetadata> {
use const_serialize::ConstStr;

// Read the serialized data (padded to 4096 bytes like permissions)
let end = (offset + 4096).min(data.len());
let metadata_bytes = &data[offset..end];

// Use deserialize_const! directly with the byte slice (new API)
// Note: Java sources are being ignored for now per the plan, but we fix compilation errors

// Deserialize the struct fields
// The new API uses deserialize_const! with a byte slice directly
if let Some((remaining, package_name)) = const_serialize::deserialize_const!(ConstStr, metadata_bytes) {
if let Some((remaining, plugin_name)) = const_serialize::deserialize_const!(ConstStr, remaining) {
if let Some((remaining, file_count)) = const_serialize::deserialize_const!(u8, remaining) {
if let Some((_, files)) = const_serialize::deserialize_const!([ConstStr; 8], remaining)
{
return Ok(JavaSourceMetadata::from_const_serialize(
package_name,
plugin_name,
file_count,
files,
));
}
}
}
}

anyhow::bail!("Failed to deserialize Java metadata at offset {}", offset)
}
Loading