@@ -85,6 +85,7 @@ impl CCompilerImpl for Cicc {
8585 cwd : & Path ,
8686 env_vars : & [ ( OsString , OsString ) ] ,
8787 _rewrite_includes_only : bool ,
88+ _hash_key : & str ,
8889 ) -> Result < (
8990 Box < dyn CompileCommand < T > > ,
9091 Option < dist:: CompileCommand > ,
@@ -118,7 +119,6 @@ where
118119 let mut take_next = false ;
119120 let mut outputs = HashMap :: new ( ) ;
120121 let mut extra_dist_files = vec ! [ ] ;
121- let mut gen_module_id_file = false ;
122122 let mut module_id_file_name = Option :: < PathBuf > :: None ;
123123
124124 let mut common_args = vec ! [ ] ;
@@ -128,6 +128,20 @@ where
128128 match arg {
129129 Ok ( arg) => {
130130 let args = match arg. get_data ( ) {
131+ Some ( ExtraOutput ( o) ) => {
132+ take_next = false ;
133+ let path = cwd. join ( o) ;
134+ if let Some ( flag) = arg. flag_str ( ) {
135+ outputs. insert (
136+ flag,
137+ ArtifactDescriptor {
138+ path,
139+ optional : false ,
140+ } ,
141+ ) ;
142+ }
143+ & mut common_args
144+ }
131145 Some ( PassThrough ( _) ) => {
132146 take_next = false ;
133147 & mut common_args
@@ -146,7 +160,6 @@ where
146160 }
147161 Some ( GenModuleIdFileFlag ) => {
148162 take_next = false ;
149- gen_module_id_file = true ;
150163 & mut common_args
151164 }
152165 Some ( ModuleIdFileName ( o) ) => {
@@ -158,24 +171,6 @@ where
158171 take_next = false ;
159172 & mut unhashed_args
160173 }
161- Some ( UnhashedOutput ( o) ) => {
162- take_next = false ;
163- let path = cwd. join ( o) ;
164- if let Some ( flag) = arg. flag_str ( ) {
165- outputs. insert (
166- flag,
167- ArtifactDescriptor {
168- path,
169- optional : false ,
170- } ,
171- ) ;
172- }
173- & mut unhashed_args
174- }
175- Some ( UnhashedFlag ) => {
176- take_next = false ;
177- & mut unhashed_args
178- }
179174 None => match arg {
180175 Argument :: Raw ( ref p) => {
181176 if take_next {
@@ -200,17 +195,16 @@ where
200195 }
201196
202197 if let Some ( module_id_path) = module_id_file_name {
203- if gen_module_id_file {
204- outputs. insert (
205- "--module_id_file_name" ,
206- ArtifactDescriptor {
207- path : module_id_path,
208- optional : true ,
209- } ,
210- ) ;
211- } else {
212- extra_dist_files. push ( module_id_path) ;
198+ if module_id_path. exists ( ) {
199+ extra_dist_files. push ( module_id_path. clone ( ) ) ;
213200 }
201+ outputs. insert (
202+ "--module_id_file_name" ,
203+ ArtifactDescriptor {
204+ path : module_id_path,
205+ optional : false ,
206+ } ,
207+ ) ;
214208 }
215209
216210 CompilerArguments :: Ok ( ParsedArguments {
@@ -236,13 +230,7 @@ where
236230}
237231
238232pub async fn preprocess ( cwd : & Path , parsed_args : & ParsedArguments ) -> Result < process:: Output > {
239- // cicc and ptxas expect input to be an absolute path
240- let input = if parsed_args. input . is_absolute ( ) {
241- parsed_args. input . clone ( )
242- } else {
243- cwd. join ( & parsed_args. input )
244- } ;
245- std:: fs:: read ( input)
233+ std:: fs:: read ( cwd. join ( & parsed_args. input ) )
246234 . map_err ( anyhow:: Error :: new)
247235 . map ( |s| process:: Output {
248236 status : process:: ExitStatus :: default ( ) ,
@@ -329,23 +317,22 @@ pub fn generate_compile_commands(
329317}
330318
331319ArgData ! { pub
332- Output ( PathBuf ) ,
333- PassThrough ( OsString ) ,
334- UnhashedFlag ,
320+ ExtraOutput ( PathBuf ) ,
335321 GenModuleIdFileFlag ,
336322 ModuleIdFileName ( PathBuf ) ,
323+ Output ( PathBuf ) ,
324+ PassThrough ( OsString ) ,
337325 UnhashedPassThrough ( OsString ) ,
338- UnhashedOutput ( PathBuf ) ,
339326}
340327
341328use self :: ArgData :: * ;
342329
343330counted_array ! ( pub static ARGS : [ ArgInfo <ArgData >; _] = [
344- take_arg!( "--gen_c_file_name" , PathBuf , Separated , UnhashedOutput ) ,
345- take_arg!( "--gen_device_file_name" , PathBuf , Separated , UnhashedOutput ) ,
331+ take_arg!( "--gen_c_file_name" , PathBuf , Separated , ExtraOutput ) ,
332+ take_arg!( "--gen_device_file_name" , PathBuf , Separated , ExtraOutput ) ,
346333 flag!( "--gen_module_id_file" , GenModuleIdFileFlag ) ,
347334 take_arg!( "--include_file_name" , OsString , Separated , PassThrough ) ,
348335 take_arg!( "--module_id_file_name" , PathBuf , Separated , ModuleIdFileName ) ,
349- take_arg!( "--stub_file_name" , PathBuf , Separated , UnhashedOutput ) ,
336+ take_arg!( "--stub_file_name" , PathBuf , Separated , ExtraOutput ) ,
350337 take_arg!( "-o" , PathBuf , Separated , Output ) ,
351338] ) ;
0 commit comments