forge
Explore
Log in

Don't you dare go Hollow

Build & publish runs two lanes at once, This machine (Linux v1 → v3) and Windows VM (prepare → v1 → v3), so one lane's single-core LTO tail overlaps the other's parallel compile

Browse files at this commit

526a1a8acfe29f595b5e5f7cd12452cb1eaaa570Ahmet Kaan GümüşParent: d911f94
  • perf
    • Build & publish runs two lanes at once, This machine (Linux v1 → v3) and Windows VM (prepare → v1 → v3), so one lane's single-core LTO tail overlaps the other's parallel compile
    • cancel kills both. 💄 style: build rows grouped under lane headers, VM start step reads Prepare
Show full message
⚡ perf: Build & publish runs two lanes at once, This machine (Linux v1 → v3) and Windows VM (prepare → v1 → v3), so one lane's single-core LTO tail overlaps the other's parallel compile; cancel kills both. 💄 style: build rows grouped under lane headers, VM start step reads Prepare
crates/client/lang/en/builder_release.txtmodified+2 -0
@@ -19,5 +19,7 @@ failed = Failed
19 linux_v1 = Linux v119 linux_v1 = Linux v1
20 linux_v3 = Linux v320 linux_v3 = Linux v3
21 windows_vm = Windows VM21 windows_vm = Windows VM
22+this_machine = This machine
23+prepare = Prepare
22 windows_v1 = Windows v124 windows_v1 = Windows v1
23 windows_v3 = Windows v325 windows_v3 = Windows v3
crates/client/lang/tr/builder_release.txtmodified+2 -0
@@ -19,5 +19,7 @@ failed = Başarısız
19 linux_v1 = Linux v119 linux_v1 = Linux v1
20 linux_v3 = Linux v320 linux_v3 = Linux v3
21 windows_vm = Windows VM21 windows_vm = Windows VM
22+this_machine = Bu makine
23+prepare = Hazırlık
22 windows_v1 = Windows v124 windows_v1 = Windows v1
23 windows_v3 = Windows v325 windows_v3 = Windows v3
crates/client/src/gui/builder/releases.rsmodified+33 -8
@@ -17,7 +17,7 @@ use crate::gui::{
17 text,17 text,
18 };18 };
19 use crate::lang::w;19 use crate::lang::w;
20-use crate::release::{Build, Event, Job, Level, PLAN, is_source};20+use crate::release::{Build, Event, Job, LANES, Lane, Level, is_source};
21 21
22 const METER: f32 = 140.;22 const METER: f32 = 140.;
23 23
@@ -95,12 +95,20 @@ fn job_label(job: Job) -> &'static str {
95 match job {95 match job {
96 Job::Linux(Level::V1) => w.linux_v1,96 Job::Linux(Level::V1) => w.linux_v1,
97 Job::Linux(Level::V3) => w.linux_v3,97 Job::Linux(Level::V3) => w.linux_v3,
98- Job::WindowsStart => w.windows_vm,98+ Job::WindowsStart => w.prepare,
99 Job::Windows(Level::V1) => w.windows_v1,99 Job::Windows(Level::V1) => w.windows_v1,
100 Job::Windows(Level::V3) => w.windows_v3,100 Job::Windows(Level::V3) => w.windows_v3,
101 }101 }
102 }102 }
103 103
104+fn lane_label(lane: Lane) -> &'static str {
105+ let w = &w().builder_release;
106+ match lane {
107+ Lane::Host => w.this_machine,
108+ Lane::Vm => w.windows_vm,
109+ }
110+}
111+
104 pub(super) fn caption_text(value: impl Into<String>, color: Hsla) -> Div {112 pub(super) fn caption_text(value: impl Into<String>, color: Hsla) -> Div {
105 div()113 div()
106 .text_size(text(text::CAPTION))114 .text_size(text(text::CAPTION))
@@ -346,11 +354,27 @@ impl Yumush {
346 cx.notify();354 cx.notify();
347 }),355 }),
348 );356 );
349- let rows: Vec<Div> = self357+ let lanes: Vec<Div> = LANES
350- .desk
351- .jobs
352 .iter()358 .iter()
353- .map(|row| job_row(row, palette))359+ .filter(|(_, jobs)| self.desk.jobs.iter().any(|row| jobs.contains(&row.job)))
360+ .map(|(lane, jobs)| {
361+ div()
362+ .flex()
363+ .flex_col()
364+ .child(
365+ list_row()
366+ .text_size(text(text::LABEL))
367+ .text_color(palette.muted)
368+ .child(lane_label(*lane)),
369+ )
370+ .children(
371+ self.desk
372+ .jobs
373+ .iter()
374+ .filter(|row| jobs.contains(&row.job))
375+ .map(|row| job_row(row, palette).pl(px(space::XL))),
376+ )
377+ })
354 .collect();378 .collect();
355 379
356 card(palette)380 card(palette)
@@ -368,7 +392,7 @@ impl Yumush {
368 )392 )
369 .child(choose),393 .child(choose),
370 )394 )
371- .child(div().flex().flex_col().children(rows))395+ .child(div().flex().flex_col().children(lanes))
372 .child(396 .child(
373 list_row().justify_between().child(required).child(397 list_row().justify_between().child(required).child(
374 div()398 div()
@@ -483,8 +507,9 @@ impl Yumush {
483 }507 }
484 let (build, mut events) = Build::start(source);508 let (build, mut events) = Build::start(source);
485 self.desk.build = Some(build);509 self.desk.build = Some(build);
486- self.desk.jobs = PLAN510+ self.desk.jobs = LANES
487 .iter()511 .iter()
512+ .flat_map(|(_, jobs)| jobs.iter())
488 .map(|&job| Row {513 .map(|&job| Row {
489 job,514 job,
490 phase: Phase::Waiting,515 phase: Phase::Waiting,
crates/client/src/release.rsmodified+54 -26
@@ -22,14 +22,26 @@ pub enum Job {
22 Windows(Level),22 Windows(Level),
23 }23 }
24 24
25-pub const PLAN: [Job; 5] = [25+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
26- Job::Linux(Level::V1),26+pub enum Lane {
27- Job::Linux(Level::V3),27+ Host,
28- Job::WindowsStart,28+ Vm,
29- Job::Windows(Level::V1),29+}
30- Job::Windows(Level::V3),30+
31+pub const LANES: [(Lane, &[Job]); 2] = [
32+ (Lane::Host, &[Job::Linux(Level::V1), Job::Linux(Level::V3)]),
33+ (
34+ Lane::Vm,
35+ &[
36+ Job::WindowsStart,
37+ Job::Windows(Level::V1),
38+ Job::Windows(Level::V3),
39+ ],
40+ ),
31 ];41 ];
32 42
43+type Slot = Arc<Mutex<Option<Child>>>;
44+
33 #[derive(Debug, Clone, PartialEq)]45 #[derive(Debug, Clone, PartialEq)]
34 pub enum Event {46 pub enum Event {
35 Started(Job),47 Started(Job),
@@ -76,7 +88,7 @@ pub fn is_source(path: &Path) -> bool {
76 88
77 pub struct Build {89 pub struct Build {
78 cancel: Arc<AtomicBool>,90 cancel: Arc<AtomicBool>,
79- child: Arc<Mutex<Option<Child>>>,91+ children: Vec<Slot>,
80 }92 }
81 93
82 impl Build {94 impl Build {
@@ -84,25 +96,31 @@ impl Build {
84 let (tx, rx) = unbounded_channel();96 let (tx, rx) = unbounded_channel();
85 let build = Self {97 let build = Self {
86 cancel: Arc::default(),98 cancel: Arc::default(),
87- child: Arc::default(),99+ children: LANES.iter().map(|_| Slot::default()).collect(),
88- };
89- let cx = Cx {
90- tx,
91- cancel: build.cancel.clone(),
92- child: build.child.clone(),
93 };100 };
101+ let lanes: Vec<Cx> = build
102+ .children
103+ .iter()
104+ .map(|child| Cx {
105+ tx: tx.clone(),
106+ cancel: build.cancel.clone(),
107+ child: child.clone(),
108+ })
109+ .collect();
94 let running = Running::new();110 let running = Running::new();
95 thread::spawn(move || {111 thread::spawn(move || {
96 let _running = running;112 let _running = running;
97- run(&source, &cx);113+ run(&source, &lanes);
98 });114 });
99 (build, rx)115 (build, rx)
100 }116 }
101 117
102 pub fn cancel(&self) {118 pub fn cancel(&self) {
103 self.cancel.store(true, Ordering::SeqCst);119 self.cancel.store(true, Ordering::SeqCst);
104- if let Some(child) = self.child.lock().unwrap().as_mut() {120+ for slot in &self.children {
105- let _ = child.kill();121+ if let Some(child) = slot.lock().unwrap().as_mut() {
122+ let _ = child.kill();
123+ }
106 }124 }
107 }125 }
108 }126 }
@@ -111,7 +129,7 @@ impl Build {
111 struct Cx {129 struct Cx {
112 tx: UnboundedSender<Event>,130 tx: UnboundedSender<Event>,
113 cancel: Arc<AtomicBool>,131 cancel: Arc<AtomicBool>,
114- child: Arc<Mutex<Option<Child>>>,132+ child: Slot,
115 }133 }
116 134
117 impl Cx {135 impl Cx {
@@ -131,23 +149,37 @@ enum Vm {
131 Broken(String),149 Broken(String),
132 }150 }
133 151
134-fn run(source: &Path, cx: &Cx) {152+fn run(source: &Path, lanes: &[Cx]) {
135 let key = dirs::home_dir()153 let key = dirs::home_dir()
136 .unwrap_or_default()154 .unwrap_or_default()
137 .join("vm/yumush-win/id_ed25519");155 .join("vm/yumush-win/id_ed25519");
156+ let first = &lanes[0];
138 let vm = match preflight(source) {157 let vm = match preflight(source) {
139 Ok(vm) => vm,158 Ok(vm) => vm,
140 Err(e) => {159 Err(e) => {
141- cx.send(Event::Failed(PLAN[0], e));160+ first.send(Event::Failed(LANES[0].1[0], e));
142- cx.send(Event::Done);161+ first.send(Event::Done);
143 return;162 return;
144 }163 }
145 };164 };
146- for job in PLAN {165+ thread::scope(|scope| {
166+ for ((_, jobs), cx) in LANES.iter().zip(lanes) {
167+ let (key, vm) = (&key, &vm);
168+ scope.spawn(move || run_lane(jobs, source, key, cx, vm));
169+ }
170+ });
171+ if let Vm::Started = vm {
172+ podman_ok(&["stop", VM]);
173+ }
174+ first.send(Event::Done);
175+}
176+
177+fn run_lane(jobs: &[Job], source: &Path, key: &Path, cx: &Cx, vm: &Vm) {
178+ for &job in jobs {
147 let result = if cx.cancelled() {179 let result = if cx.cancelled() {
148 Err("cancelled".to_string())180 Err("cancelled".to_string())
149 } else {181 } else {
150- run_job(job, source, &key, cx, &vm)182+ run_job(job, source, key, cx, vm)
151 };183 };
152 if let Err(e) = result {184 if let Err(e) = result {
153 let e = if cx.cancelled() {185 let e = if cx.cancelled() {
@@ -159,10 +191,6 @@ fn run(source: &Path, cx: &Cx) {
159 break;191 break;
160 }192 }
161 }193 }
162- if let Vm::Started = vm {
163- podman_ok(&["stop", VM]);
164- }
165- cx.send(Event::Done);
166 }194 }
167 195
168 fn preflight(source: &Path) -> Result<Vm, String> {196 fn preflight(source: &Path) -> Result<Vm, String> {