Fix some CI (windows + nasm, core-macro error) (#2676)

* Moves index.html creation until after wasm creation so the webserver doesn't prematurely serve the page
* sets up nasm for windows builds (to be superseded by Remove Dioxus CLI NASM dependency #2666 #2682)
* puts magnanis-cli-support in a blocking task to prevent threadlocking during sequential builds
* changes order of client/server builds such that the client is built before the server so the webserver doesn't prematurely serve invalid client code
* declobbers "serve" such that each project gets a different dir in the target folder
* uses nest_service instead of fallback so the router doesn't respond with fallback codes
* reincorporates doge's fix from Fix hot-reloading on Windows #2544
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-07-23 09:58:13 -07:00
1 parent 40f936d56a
commit 8b5ad5d925
13 files changed
+55 -40

No files matched your search

+11 -5
View File
@@ -150,11 +150,17 @@ impl BuildRequest {
// Start Manganis linker intercept.
let linker_args = vec![format!("{}", self.dioxus_crate.out_dir().display())];
manganis_cli_support::start_linker_intercept(
&LinkCommand::command_name(),
cargo_args,
Some(linker_args),
)?;
// Don't block the main thread - magnanis should not be running its own std process but it's
// fine to wrap it here at the top
tokio::task::spawn_blocking(move || {
manganis_cli_support::start_linker_intercept(
&LinkCommand::command_name(),
cargo_args,
Some(linker_args),
)
})
.await
.unwrap()?;
let file_name = self.dioxus_crate.executable_name();
+1 -1
View File
@@ -44,8 +44,8 @@ impl BuildRequest {
serve: bool,
) -> Vec<Self> {
vec![
Self::new_server(serve, &config, &build_arguments),
Self::new_client(serve, &config, &build_arguments),
Self::new_server(serve, &config, &build_arguments),
]
}
+8 -5
View File
@@ -120,11 +120,6 @@ impl BuildRequest {
update: UpdateStage::Start,
});
// Create the index.html file
let html = self.prepare_html(assets)?;
let html_path = self.dioxus_crate.out_dir().join("index.html");
std::fs::write(&html_path, html)?;
// Find the wasm file
let output_location = build_result.executable.clone();
let input_path = output_location.with_extension("wasm");
@@ -177,6 +172,14 @@ impl BuildRequest {
.await
.unwrap()?;
// Create the index.html file
// Note that we do this last since the webserver will attempt to serve the index.html file
// If we do this too early, the wasm won't be ready but the index.html will be served, leading
// to test failures and broken pages.
let html = self.prepare_html(assets)?;
let html_path = self.dioxus_crate.out_dir().join("index.html");
std::fs::write(html_path, html)?;
Ok(())
}
}