@@ -3,7 +3,7 @@ use anyhow::{bail, ensure, Result};
33use clap:: { Args , Subcommand } ;
44use duct:: cmd;
55use std:: ffi:: OsStr ;
6- use std:: path:: { Path , PathBuf } ;
6+ use std:: path:: Path ;
77use std:: process:: { Command , Stdio } ;
88use std:: { env, fs} ;
99
@@ -36,9 +36,6 @@ pub struct SmoketestsArgs {
3636
3737#[ derive( Subcommand ) ]
3838enum SmoketestCmd {
39- /// Build smoketest artifacts without running tests
40- BuildArtifacts ,
41-
4239 /// Only build binaries without running tests
4340 ///
4441 /// Use this before running `cargo test --all` to ensure binaries are built.
@@ -48,13 +45,8 @@ enum SmoketestCmd {
4845
4946pub fn run ( args : SmoketestsArgs ) -> Result < ( ) > {
5047 match args. cmd {
51- Some ( SmoketestCmd :: BuildArtifacts ) => {
52- build_artifacts ( ) ?;
53- eprintln ! ( "Smoketest artifacts ready." ) ;
54- Ok ( ( ) )
55- }
5648 Some ( SmoketestCmd :: Prepare ) => {
57- build_artifacts ( ) ?;
49+ build_binaries ( ) ?;
5850 eprintln ! ( "Binaries ready. You can now run `cargo test --all`." ) ;
5951 Ok ( ( ) )
6052 }
@@ -67,12 +59,6 @@ pub fn run(args: SmoketestsArgs) -> Result<()> {
6759 }
6860}
6961
70- fn build_artifacts ( ) -> Result < ( ) > {
71- build_binaries ( ) ?;
72- build_precompiled_modules ( ) ?;
73- Ok ( ( ) )
74- }
75-
7662fn build_binaries ( ) -> Result < ( ) > {
7763 eprintln ! ( "Building spacetimedb-cli and spacetimedb-standalone (release)..." ) ;
7864
@@ -111,9 +97,6 @@ fn build_binaries() -> Result<()> {
11197fn build_precompiled_modules ( ) -> Result < ( ) > {
11298 let workspace_root = env:: current_dir ( ) ?;
11399 let modules_dir = workspace_root. join ( "crates/smoketests/modules" ) ;
114- let target_dir = env:: var_os ( "SPACETIME_SMOKETEST_MODULE_TARGET_DIR" )
115- . map ( PathBuf :: from)
116- . unwrap_or_else ( || modules_dir. join ( "target" ) ) ;
117100
118101 // Check if the modules workspace exists
119102 if !modules_dir. join ( "Cargo.toml" ) . exists ( ) {
@@ -132,7 +115,6 @@ fn build_precompiled_modules() -> Result<()> {
132115 "wasm32-unknown-unknown" ,
133116 ] )
134117 . current_dir ( & modules_dir)
135- . env ( "CARGO_TARGET_DIR" , & target_dir)
136118 . status ( ) ?;
137119
138120 ensure ! ( status. success( ) , "Failed to build pre-compiled modules" ) ;
@@ -145,8 +127,11 @@ fn build_precompiled_modules() -> Result<()> {
145127const DEFAULT_PARALLELISM : & str = "16" ;
146128
147129fn run_smoketest ( server : Option < String > , dotnet : bool , args : Vec < String > ) -> Result < ( ) > {
148- // 1. Build artifacts first (single process, no race)
149- build_artifacts ( ) ?;
130+ // 1. Build binaries first (single process, no race)
131+ build_binaries ( ) ?;
132+
133+ // 2. Build pre-compiled modules (this also warms the WASM dependency cache)
134+ build_precompiled_modules ( ) ?;
150135
151136 // 4. Detect whether to use nextest or cargo test
152137 let use_nextest = Command :: new ( "cargo" )
0 commit comments