@@ -5,6 +5,8 @@ use std::sync::Arc;
5
5
use mako_core:: anyhow:: Result ;
6
6
use mako_core:: clap:: Parser ;
7
7
use mako_core:: tokio;
8
+ #[ cfg( feature = "profile" ) ]
9
+ use mako_core:: tokio:: sync:: Notify ;
8
10
use mako_core:: tracing:: debug;
9
11
10
12
use crate :: compiler:: Args ;
@@ -91,23 +93,39 @@ async fn main() -> Result<()> {
91
93
92
94
#[ cfg( feature = "profile" ) ]
93
95
{
96
+ let notify = Arc :: new ( Notify :: new ( ) ) ;
97
+ let to_be_notify = notify. clone ( ) ;
98
+
99
+ tokio:: spawn ( async move {
100
+ let compiler = compiler. clone ( ) ;
101
+
102
+ to_be_notify. notified ( ) . await ;
103
+
104
+ compiler. compile ( ) . unwrap ( ) ;
105
+
106
+ if cli. watch {
107
+ let d = crate :: dev:: DevServer :: new ( root. clone ( ) , compiler. clone ( ) ) ;
108
+ d. serve ( ) . await ;
109
+ }
110
+ } ) ;
111
+
94
112
mako_core:: puffin:: set_scopes_on ( true ) ;
95
113
let native_options = Default :: default ( ) ;
96
- let compiler = compiler. clone ( ) ;
97
114
let _ = mako_core:: eframe:: run_native (
98
115
"puffin egui eframe" ,
99
116
native_options,
100
- Box :: new ( move |_cc| Box :: new ( ProfileApp :: new ( compiler ) ) ) ,
117
+ Box :: new ( move |_cc| Box :: new ( ProfileApp :: new ( notify ) ) ) ,
101
118
) ;
102
119
}
103
120
104
121
#[ cfg( not( feature = "profile" ) ) ]
105
- compiler. compile ( ) ?;
106
-
107
- if cli. watch {
108
- let d = crate :: dev:: DevServer :: new ( root. clone ( ) , compiler) ;
109
- // TODO: when in Dev Mode, Dev Server should start asap, and provider a loading while in first compiling
110
- d. serve ( ) . await ;
122
+ {
123
+ compiler. compile ( ) ?;
124
+ if cli. watch {
125
+ let d = crate :: dev:: DevServer :: new ( root. clone ( ) , compiler) ;
126
+ // TODO: when in Dev Mode, Dev Server should start asap, and provider a loading while in first compiling
127
+ d. serve ( ) . await ;
128
+ }
111
129
}
112
130
Ok ( ( ) )
113
131
}
0 commit comments