fix stutter in bundle, fix nsis, fix msi bundling (#5412)

* fix stutter in bundle, fix nsis, fix msi bundling

* fmt

* rename android libname to `libmain`, rename server exe to `server`

* fix hot-dog url handling

* set linux product name

* update schema
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2026-03-26 13:05:11 -07:00
1 parent a42dd1320b
commit 20e242628d
14 files changed
+157 -112

No files matched your search

+31 -23
View File
@@ -3611,6 +3611,10 @@ impl BuildRequest {
env_vars.extend(self.android_env_vars()?);
};
// Always bake the product name into the binary so bundled apps can find their assets
// at runtime regardless of build profile (the asset directory structure uses the product name).
env_vars.push((PRODUCT_NAME_ENV.into(), self.bundled_app_name().into()));
// If this is a release build, bake the base path and title into the binary with env vars.
// todo: should we even be doing this? might be better being a build.rs or something else.
if self.release {
@@ -3621,7 +3625,6 @@ impl BuildRequest {
APP_TITLE_ENV.into(),
self.config.web.app.title.clone().into(),
));
env_vars.push((PRODUCT_NAME_ENV.into(), self.bundled_app_name().into()));
}
// Assemble the rustflags by peering into the `.cargo/config.toml` file
@@ -3739,7 +3742,6 @@ impl BuildRequest {
let java_home = tools.java_home();
let ndk_home = tools.ndk.clone();
let sdk_root = tools.sdk();
let artifact_dir = self.android_artifact_dir()?;
tracing::debug!(
r#"Using android:
min_sdk_version: {min_sdk_version}
@@ -3749,7 +3751,6 @@ impl BuildRequest {
target_cxx: {target_cxx:?}
java_home: {java_home:?}
sdk_root: {sdk_root:?}
artifact_dir: {artifact_dir:?}
"#
);
@@ -3762,10 +3763,6 @@ impl BuildRequest {
));
}
env_vars.push((
"DX_ANDROID_ARTIFACT_DIR".into(),
artifact_dir.into_os_string(),
));
env_vars.push((
"DX_ANDROID_NDK_HOME".into(),
ndk_home.clone().into_os_string(),
@@ -3917,7 +3914,7 @@ impl BuildRequest {
),
(
"WRY_ANDROID_LIBRARY".to_string(),
"dioxusmain".to_string().into(),
self.android_lib_name().into(),
),
("WRY_ANDROID_KOTLIN_FILES_OUT_DIR".to_string(), {
let kotlin_dir = self.wry_android_kotlin_files_out_dir();
@@ -3951,17 +3948,6 @@ impl BuildRequest {
Ok(env_vars)
}
fn android_artifact_dir(&self) -> Result<PathBuf> {
let dir = self
.internal_out_dir()
.join(&self.main_target)
.join(if self.release { "release" } else { "debug" })
.join("android-artifacts")
.join(self.triple.to_string());
std::fs::create_dir_all(&dir)?;
Ok(dir)
}
/// Get an estimate of the number of units in the crate. If nightly rustc is not available, this
/// will return an estimate of the number of units in the crate based on cargo metadata.
///
@@ -4092,15 +4078,24 @@ impl BuildRequest {
// mac/ios are unixy and dont have an exe extension
BundleFormat::MacOS | BundleFormat::Ios => self.executable_name().to_string(),
// "server" and windows can be the same
BundleFormat::Server | BundleFormat::Windows => match self.triple.operating_system {
// the server binary is always called "server" to avoid antivirus issues when the
// binary name changes between builds (the folder name already identifies the project)
BundleFormat::Server => match self.triple.operating_system {
OperatingSystem::Windows => "server.exe".to_string(),
_ => "server".to_string(),
},
BundleFormat::Windows => match self.triple.operating_system {
OperatingSystem::Windows => format!("{}.exe", self.executable_name()),
_ => self.executable_name().to_string(),
},
// from the apk spec, the root exe is a shared library
// we include the user's rust code as a shared library with a fixed namespace
BundleFormat::Android => "libdioxusmain.so".to_string(),
// defaults to "main" (libmain.so) per NativeActivity convention, overridable in Dioxus.toml
BundleFormat::Android => {
let lib_name = self.android_lib_name();
format!("lib{lib_name}.so")
}
// this will be wrong, I think, but not important?
BundleFormat::Web => format!("{}_bg.wasm", self.executable_name()),
@@ -4183,6 +4178,8 @@ impl BuildRequest {
app_theme: Option<String>,
supports_rtl: Option<bool>,
large_heap: Option<bool>,
/// Native library name (without lib prefix and .so extension)
lib_name: String,
}
// Get permission mapper from config
@@ -4231,6 +4228,7 @@ impl BuildRequest {
app_theme: self.config.android.application.theme.clone(),
supports_rtl: self.config.android.application.supports_rtl,
large_heap: self.config.android.application.large_heap,
lib_name: self.android_lib_name(),
};
let hbs = handlebars::Handlebars::new();
@@ -4534,6 +4532,16 @@ impl BuildRequest {
&self.crate_target.name
}
/// Android native library name (without `lib` prefix and `.so` extension).
/// Defaults to `"main"` per NativeActivity convention, overridable via `[android] lib_name`.
fn android_lib_name(&self) -> String {
self.config
.android
.lib_name
.clone()
.unwrap_or_else(|| "main".to_string())
}
/// Get the type of executable we are compiling
pub(crate) fn executable_type(&self) -> TargetKind {
self.crate_target.kind[0].clone()