11use api_model:: buck2:: {
2- api:: { TaskBuildRequest , TaskBuildResult } ,
3- ws:: WSMessage ,
2+ api:: TaskBuildResult , status:: Status , types:: ProjectRelativePath , ws:: WSMessage ,
43} ;
54use tokio:: sync:: mpsc:: UnboundedSender ;
65use uuid:: Uuid ;
@@ -46,7 +45,9 @@ use crate::buck_controller;
4645/// Immediate acknowledgment that the build task has been queued and started
4746pub async fn buck_build (
4847 id : Uuid ,
49- req : TaskBuildRequest ,
48+ cl_link : String ,
49+ repo : String ,
50+ changes : Vec < Status < ProjectRelativePath > > ,
5051 sender : UnboundedSender < WSMessage > ,
5152) -> TaskBuildResult {
5253 let id_str = id. to_string ( ) ;
@@ -55,48 +56,43 @@ pub async fn buck_build(
5556 // Spawn background task to handle the actual build process
5657 tokio:: spawn ( async move {
5758 // Execute the build operation via buck_controller
58- let build_result = match buck_controller:: build (
59- id_str. clone ( ) ,
60- req. repo ,
61- req. cl_link ,
62- sender. clone ( ) ,
63- req. changes ,
64- )
65- . await
66- {
67- Ok ( status) => {
68- let message = format ! (
69- "Build {}" ,
70- if status. success( ) {
71- "succeeded"
72- } else {
73- "failed"
59+ let build_result =
60+ match buck_controller:: build ( id_str. clone ( ) , repo, cl_link, sender. clone ( ) , changes)
61+ . await
62+ {
63+ Ok ( status) => {
64+ let message = format ! (
65+ "Build {}" ,
66+ if status. success( ) {
67+ "succeeded"
68+ } else {
69+ "failed"
70+ }
71+ ) ;
72+ tracing:: info!(
73+ "[Task {}] {}; Exit code: {:?}" ,
74+ id_str,
75+ message,
76+ status. code( )
77+ ) ;
78+ TaskBuildResult {
79+ success : status. success ( ) ,
80+ id : id_str. clone ( ) ,
81+ exit_code : status. code ( ) ,
82+ message,
7483 }
75- ) ;
76- tracing:: info!(
77- "[Task {}] {}; Exit code: {:?}" ,
78- id_str,
79- message,
80- status. code( )
81- ) ;
82- TaskBuildResult {
83- success : status. success ( ) ,
84- id : id_str. clone ( ) ,
85- exit_code : status. code ( ) ,
86- message,
8784 }
88- }
89- Err ( e ) => {
90- let error_msg = format ! ( "Build execution failed: {e}" ) ;
91- tracing :: error! ( "[Task {}] {}" , id_str , error_msg ) ;
92- TaskBuildResult {
93- success : false ,
94- id : id_str . clone ( ) ,
95- exit_code : None ,
96- message : error_msg ,
85+ Err ( e ) => {
86+ let error_msg = format ! ( "Build execution failed: {e}" ) ;
87+ tracing :: error !( "[Task {}] {}" , id_str , error_msg ) ;
88+ TaskBuildResult {
89+ success : false ,
90+ id : id_str . clone ( ) ,
91+ exit_code : None ,
92+ message : error_msg ,
93+ }
9794 }
98- }
99- } ;
95+ } ;
10096
10197 // Send build completion notification via WebSocket
10298 let complete_msg = WSMessage :: TaskBuildComplete {
0 commit comments