1- use std:: path:: PathBuf ;
2-
31#[ derive( Clone ) ]
42pub struct CompilationCommandBuilder {
53 compiler : String ,
@@ -9,7 +7,6 @@ pub struct CompilationCommandBuilder {
97 optimization : String ,
108 include_paths : Vec < String > ,
119 project_root : Option < String > ,
12- output : String ,
1310 linker : Option < String > ,
1411 extra_flags : Vec < String > ,
1512}
@@ -24,7 +21,6 @@ impl CompilationCommandBuilder {
2421 optimization : "2" . to_string ( ) ,
2522 include_paths : Vec :: new ( ) ,
2623 project_root : None ,
27- output : String :: new ( ) ,
2824 linker : None ,
2925 extra_flags : Vec :: new ( ) ,
3026 }
@@ -91,10 +87,10 @@ impl CompilationCommandBuilder {
9187#[ allow( clippy:: large_enum_variant) ]
9288pub enum CompilationCommand {
9389 Simple ( std:: process:: Command ) ,
90+ #[ allow( unused) ]
9491 CustomLinker {
9592 cmd : std:: process:: Command ,
9693 linker : std:: process:: Command ,
97- cleanup : PathBuf ,
9894 } ,
9995}
10096
@@ -112,12 +108,9 @@ impl CompilationCommand {
112108 CompilationCommand :: CustomLinker {
113109 mut cmd,
114110 mut linker,
115- cleanup,
116111 } => {
117112 let output = cmd. output ( ) ?;
118113
119- linker. current_dir ( "c_programs" ) ;
120-
121114 if log:: log_enabled!( log:: Level :: Trace ) {
122115 linker. stdout ( std:: process:: Stdio :: inherit ( ) ) ;
123116 linker. stderr ( std:: process:: Stdio :: inherit ( ) ) ;
@@ -129,9 +122,9 @@ impl CompilationCommand {
129122 linker. get_program( ) ,
130123 ) ;
131124 }
132- if cleanup. exists ( ) {
133- std:: fs:: remove_file ( cleanup) ?;
134- }
125+ // if cleanup.exists() {
126+ // std::fs::remove_file(cleanup)?;
127+ // }
135128
136129 Ok ( output)
137130 }
@@ -141,8 +134,8 @@ impl CompilationCommand {
141134
142135impl CompilationCommandBuilder {
143136 pub fn into_command ( self ) -> CompilationCommand {
144- let project_root = self . project_root . unwrap_or_default ( ) ;
145- let project_root_str = project_root. as_str ( ) ;
137+ // let project_root = self.project_root.unwrap_or_default();
138+ // let project_root_str = project_root.as_str();
146139
147140 let mut cmd = std:: process:: Command :: new ( self . compiler ) ;
148141
@@ -159,28 +152,27 @@ impl CompilationCommandBuilder {
159152 cmd. arg ( format ! ( "--target={target}" ) ) ;
160153 }
161154
162- if let ( Some ( linker ) , Some ( cxx_toolchain_dir) ) = ( & self . linker , & self . cxx_toolchain_dir ) {
155+ if let ( Some ( _linker ) , Some ( cxx_toolchain_dir) ) = ( & self . linker , & self . cxx_toolchain_dir ) {
163156 cmd. arg ( "-c" ) ;
164157 cmd. args (
165158 self . include_paths
166159 . iter ( )
167160 . map ( |path| "--include-directory=" . to_string ( ) + cxx_toolchain_dir + path) ,
168161 ) ;
169162
170- let output = "dummy_value" ;
171- let mut linker_cmd = std:: process:: Command :: new ( linker) ;
172- linker_cmd. arg ( format ! ( "{project_root_str}/{output}" ) ) ;
163+ // let linker_cmd = std::process::Command::new(linker);
164+ // linker_cmd.arg(format!("{project_root_str}/{output}"));
173165
174- linker_cmd . arg ( "-o" ) ;
175- linker_cmd . arg ( format ! ( "{project_root_str}/{}" , self . output ) ) ;
166+ // let remove_path = PathBuf::new( );
167+ // PathBuf::from (format!("{project_root_str}/{output}" ));
176168
177- let remove_path = PathBuf :: from ( format ! ( "{project_root_str}/{output}" ) ) ;
169+ // CompilationCommand::CustomLinker {
170+ // cmd,
171+ // linker: linker_cmd,
172+ // // cleanup: remove_path,
173+ // }
178174
179- CompilationCommand :: CustomLinker {
180- cmd,
181- linker : linker_cmd,
182- cleanup : remove_path,
183- }
175+ CompilationCommand :: Simple ( cmd)
184176 } else {
185177 CompilationCommand :: Simple ( cmd)
186178 }
0 commit comments