fix manganis support for dioxus desktop
This commit is contained in:
1 parent
ef101dd876
commit
3270f7341a
9 files changed
+63
-58
No files matched your search
@@ -37,9 +37,9 @@ pub(crate) fn process_assets(config: &CrateConfig, manifest: &AssetManifest) ->
|
||||
}
|
||||
|
||||
/// A guard that sets up the environment for the web renderer to compile in. This guard sets the location that assets will be served from
|
||||
pub(crate) struct WebAssetConfigDropGuard;
|
||||
pub(crate) struct AssetConfigDropGuard;
|
||||
|
||||
impl WebAssetConfigDropGuard {
|
||||
impl AssetConfigDropGuard {
|
||||
pub fn new() -> Self {
|
||||
// Set up the collect asset config
|
||||
manganis_cli_support::Config::default()
|
||||
@@ -49,7 +49,7 @@ impl WebAssetConfigDropGuard {
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for WebAssetConfigDropGuard {
|
||||
impl Drop for AssetConfigDropGuard {
|
||||
fn drop(&mut self) {
|
||||
// Reset the config
|
||||
manganis_cli_support::Config::default().save();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
assets::{asset_manifest, create_assets_head, process_assets, WebAssetConfigDropGuard},
|
||||
assets::{asset_manifest, create_assets_head, process_assets, AssetConfigDropGuard},
|
||||
error::{Error, Result},
|
||||
tools::Tool,
|
||||
};
|
||||
@@ -87,7 +87,7 @@ pub fn build(
|
||||
let out_dir = config.out_dir();
|
||||
let asset_dir = config.asset_dir();
|
||||
|
||||
let _guard = WebAssetConfigDropGuard::new();
|
||||
let _guard = AssetConfigDropGuard::new();
|
||||
let _manganis_support = ManganisSupportGuard::default();
|
||||
|
||||
// start to build the assets
|
||||
@@ -339,6 +339,7 @@ pub fn build_desktop(
|
||||
let ignore_files = build_assets(config)?;
|
||||
let _guard = dioxus_cli_config::__private::save_config(config);
|
||||
let _manganis_support = ManganisSupportGuard::default();
|
||||
let _guard = AssetConfigDropGuard::new();
|
||||
|
||||
let mut cmd = subprocess::Exec::cmd("cargo")
|
||||
.set_rust_flags(rust_flags)
|
||||
@@ -535,7 +536,7 @@ fn prettier_build(cmd: subprocess::Exec) -> anyhow::Result<Vec<Diagnostic>> {
|
||||
}
|
||||
|
||||
pub fn gen_page(config: &CrateConfig, manifest: Option<&AssetManifest>, serve: bool) -> String {
|
||||
let _gaurd = WebAssetConfigDropGuard::new();
|
||||
let _guard = AssetConfigDropGuard::new();
|
||||
|
||||
let crate_root = crate_root().unwrap();
|
||||
let custom_html_file = crate_root.join("index.html");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::assets::AssetConfigDropGuard;
|
||||
#[cfg(feature = "plugin")]
|
||||
use crate::plugin::PluginManager;
|
||||
use crate::{assets::WebAssetConfigDropGuard, server::fullstack};
|
||||
use crate::server::fullstack;
|
||||
use dioxus_cli_config::Platform;
|
||||
|
||||
use super::*;
|
||||
@@ -69,7 +70,7 @@ impl Build {
|
||||
Platform::Fullstack => {
|
||||
// Fullstack mode must be built with web configs on the desktop
|
||||
// (server) binary as well as the web binary
|
||||
let _config = WebAssetConfigDropGuard::new();
|
||||
let _config = AssetConfigDropGuard::new();
|
||||
let client_rust_flags = fullstack::client_rust_flags(&self.build);
|
||||
let server_rust_flags = fullstack::server_rust_flags(&self.build);
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user