@@ -24,6 +24,10 @@ Cargo will get invoked with `CARGO_ARGS` and the specified target. All output
2424`compiler_builtins*.rlib` files will be checked.
2525
2626If TARGET is not specified, the host target is used.
27+
28+ check ARCHIVE_PATHS ...
29+
30+ Run the same checks on the given set of paths, without invoking Cargo.
2731" ;
2832
2933fn main ( ) {
@@ -33,12 +37,14 @@ fn main() {
3337
3438 match & args_ref[ 1 ..] {
3539 [ "build-and-check" , target, "--" , args @ ..] if !args. is_empty ( ) => {
36- check_cargo_args ( args) ;
3740 run_build_and_check ( target, args) ;
3841 }
3942 [ "build-and-check" , "--" , args @ ..] if !args. is_empty ( ) => {
40- check_cargo_args ( args) ;
41- run_build_and_check ( & host_target ( ) , args) ;
43+ let target = & host_target ( ) ;
44+ run_build_and_check ( target, args) ;
45+ }
46+ [ "check" , paths @ ..] if !paths. is_empty ( ) => {
47+ check_paths ( paths) ;
4248 }
4349 _ => {
4450 println ! ( "{USAGE}" ) ;
@@ -47,22 +53,25 @@ fn main() {
4753 }
4854}
4955
50- /// Make sure `-- target` isn't passed to avoid confusion (since it should be proivded only once,
51- /// positionally).
52- fn check_cargo_args ( args : & [ & str ] ) {
56+ fn run_build_and_check ( target : & str , args : & [ & str ] ) {
57+ // Make sure `--target` isn't passed to avoid confusion (since it should be
58+ // proivded only once, positionally).
5359 for arg in args {
5460 assert ! (
5561 !arg. contains( "--target" ) ,
5662 "target must be passed positionally. {USAGE}"
5763 ) ;
5864 }
59- }
6065
61- fn run_build_and_check ( target : & str , args : & [ & str ] ) {
6266 let paths = exec_cargo_with_args ( target, args) ;
67+ check_paths ( & paths) ;
68+ }
69+
70+ fn check_paths < P : AsRef < Path > > ( paths : & [ P ] ) {
6371 for path in paths {
72+ let path = path. as_ref ( ) ;
6473 println ! ( "Checking {}" , path. display( ) ) ;
65- let archive = Archive :: from_path ( & path) ;
74+ let archive = Archive :: from_path ( path) ;
6675
6776 verify_no_duplicates ( & archive) ;
6877 verify_core_symbols ( & archive) ;
0 commit comments