@@ -253,7 +253,7 @@ fn build_file_1(path: &Path, ctx: &CompCtx, opts: &BuildOptions, force_build: bo
253
253
let code = path. as_absolute_path ( ) . unwrap ( ) . read_to_string_anyhow ( ) ?;
254
254
let ( mut ast, errs) = cobalt_parser:: parse_tl ( & code) ;
255
255
let file = FILES . add_file ( 0 , name. to_string ( ) , code. clone ( ) ) ;
256
- for err in errs { fail |= err. is_err ( ) ; eprintln ! ( "{}" , Report :: from( err) . with_source_code( file) ) ; }
256
+ for err in errs { fail |= err. is_err ( ) ; eprintln ! ( "{:? }" , Report :: from( err) . with_source_code( file) ) ; }
257
257
ast. file = Some ( file) ;
258
258
if fail && !opts. continue_comp { anyhow:: bail!( CompileErrors ) }
259
259
ast. run_passes ( ctx) ;
@@ -263,7 +263,7 @@ fn build_file_1(path: &Path, ctx: &CompCtx, opts: &BuildOptions, force_build: bo
263
263
/// This picks up where `build_file_1` left off
264
264
fn build_file_2 ( ast : TopLevelAST , ctx : & CompCtx , opts : & BuildOptions , ( out_path, head_path) : ( & Path , & Path ) , mut fail : bool ) -> anyhow:: Result < ( ) > {
265
265
let ( _, errs) = ast. codegen ( ctx) ;
266
- for err in errs { fail |= err. is_err ( ) ; eprintln ! ( "{}" , err. with_file( ast. file. unwrap( ) ) ) ; }
266
+ for err in errs { fail |= err. is_err ( ) ; eprintln ! ( "{:? }" , err. with_file( ast. file. unwrap( ) ) ) ; }
267
267
if fail && !opts. continue_comp {
268
268
ctx. with_vars ( |v| clear_mod ( & mut v. symbols ) ) ;
269
269
anyhow:: bail!( CompileErrors )
@@ -446,18 +446,20 @@ fn resolve_deps(ctx: &CompCtx, t: &Target, targets: &HashMap<String, (Target, Ce
446
446
Dependency :: Package ( PkgDepSpec { version, targets} ) => to_install. push ( pkg:: InstallSpec { name : target. clone ( ) , version : version. clone ( ) , targets : targets. clone ( ) } )
447
447
}
448
448
}
449
- let plan = pkg:: install ( to_install. iter ( ) . cloned ( ) , & pkg:: InstallOptions { target : opts. triple . as_str ( ) . to_str ( ) . unwrap ( ) . to_string ( ) , ..Default :: default ( ) } ) ?;
450
- let mut installed_path = cobalt_dir ( ) ?;
451
- installed_path. push ( "installed" ) ;
452
- to_install. into_iter ( ) . try_for_each ( |pkg:: InstallSpec { name, targets, ..} | targets. unwrap_or_else ( || vec ! [ "default" . to_string( ) ] ) . into_iter ( ) . try_for_each ( |target| {
453
- let mut path = installed_path. clone ( ) ;
454
- path. push ( & name) ;
455
- path. push ( plan[ & ( name. as_str ( ) , target. as_str ( ) ) ] . to_string ( ) ) ;
456
- path. push ( & target) ;
457
- conflicts. append ( & mut libs:: load_lib ( & path, ctx) ?) ;
458
- out. push ( path) ;
459
- anyhow:: Ok ( ( ) )
460
- } ) ) ?;
449
+ if !to_install. is_empty ( ) {
450
+ let plan = pkg:: install ( to_install. iter ( ) . cloned ( ) , & pkg:: InstallOptions { target : opts. triple . as_str ( ) . to_str ( ) . unwrap ( ) . to_string ( ) , ..Default :: default ( ) } ) ?;
451
+ let mut installed_path = cobalt_dir ( ) ?;
452
+ installed_path. push ( "installed" ) ;
453
+ to_install. into_iter ( ) . try_for_each ( |pkg:: InstallSpec { name, targets, ..} | targets. unwrap_or_else ( || vec ! [ "default" . to_string( ) ] ) . into_iter ( ) . try_for_each ( |target| {
454
+ let mut path = installed_path. clone ( ) ;
455
+ path. push ( & name) ;
456
+ path. push ( plan[ & ( name. as_str ( ) , target. as_str ( ) ) ] . to_string ( ) ) ;
457
+ path. push ( & target) ;
458
+ conflicts. append ( & mut libs:: load_lib ( & path, ctx) ?) ;
459
+ out. push ( path) ;
460
+ anyhow:: Ok ( ( ) )
461
+ } ) ) ?;
462
+ }
461
463
if !conflicts. is_empty ( ) { anyhow:: bail!( libs:: ConflictingDefs ( conflicts) ) }
462
464
let ( libs, notfound) = libs:: find_libs ( libs, & opts. link_dirs , Some ( ctx) ) ?;
463
465
for lib in notfound { anyhow:: bail!( "couldn't find {lib}" ) }
0 commit comments