@@ -148,6 +148,27 @@ impl InspectArgs {
148
148
} ;
149
149
print_json ( & standard_json) ?;
150
150
}
151
+ ContractArtifactField :: Libraries => {
152
+ let all_libs: Vec < String > = artifact
153
+ . all_link_references ( )
154
+ . into_iter ( )
155
+ . flat_map ( |( path, libs) | {
156
+ libs. into_keys ( ) . map ( move |lib| format ! ( "{path}:{lib}" ) )
157
+ } )
158
+ . collect ( ) ;
159
+ if shell:: is_json ( ) {
160
+ return print_json ( & all_libs) ;
161
+ } else {
162
+ sh_println ! (
163
+ "Dynamically linked libraries:\n {}" ,
164
+ all_libs
165
+ . iter( )
166
+ . map( |v| format!( " {v}" ) )
167
+ . collect:: <Vec <String >>( )
168
+ . join( "\n " )
169
+ ) ?;
170
+ }
171
+ }
151
172
} ;
152
173
153
174
Ok ( ( ) )
@@ -406,6 +427,7 @@ pub enum ContractArtifactField {
406
427
Errors ,
407
428
Events ,
408
429
StandardJson ,
430
+ Libraries ,
409
431
}
410
432
411
433
macro_rules! impl_value_enum {
@@ -489,6 +511,7 @@ impl_value_enum! {
489
511
Errors => "errors" | "er" ,
490
512
Events => "events" | "ev" ,
491
513
StandardJson => "standardJson" | "standard-json" | "standard_json" ,
514
+ Libraries => "libraries" | "lib" | "libs" ,
492
515
}
493
516
}
494
517
@@ -521,6 +544,7 @@ impl TryFrom<ContractArtifactField> for ContractOutputSelection {
521
544
Caf :: StandardJson => {
522
545
Err ( eyre ! ( "StandardJson is not supported for ContractOutputSelection" ) )
523
546
}
547
+ Caf :: Libraries => Err ( eyre ! ( "Libraries is not supported for ContractOutputSelection" ) ) ,
524
548
}
525
549
}
526
550
}
@@ -559,7 +583,10 @@ impl fmt::Display for ContractArtifactField {
559
583
impl ContractArtifactField {
560
584
/// Returns true if this field does not need to be passed to the compiler.
561
585
pub const fn can_skip_field ( & self ) -> bool {
562
- matches ! ( self , Self :: Bytecode | Self :: DeployedBytecode | Self :: StandardJson )
586
+ matches ! (
587
+ self ,
588
+ Self :: Bytecode | Self :: DeployedBytecode | Self :: StandardJson | Self :: Libraries
589
+ )
563
590
}
564
591
}
565
592
@@ -627,6 +654,14 @@ mod tests {
627
654
. to_string( )
628
655
. eq( "StandardJson is not supported for ContractOutputSelection" )
629
656
) ;
657
+ } else if field == ContractArtifactField :: Libraries {
658
+ let selection: Result < ContractOutputSelection , _ > = field. try_into ( ) ;
659
+ assert ! (
660
+ selection
661
+ . unwrap_err( )
662
+ . to_string( )
663
+ . eq( "Libraries is not supported for ContractOutputSelection" )
664
+ ) ;
630
665
} else {
631
666
let selection: ContractOutputSelection = field. try_into ( ) . unwrap ( ) ;
632
667
assert_eq ! ( field, selection) ;
0 commit comments