@@ -24,6 +24,10 @@ Cargo will get invoked with `CARGO_ARGS` and the specified target. All output
24
24
`compiler_builtins*.rlib` files will be checked.
25
25
26
26
If 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.
27
31
" ;
28
32
29
33
fn main ( ) {
@@ -33,12 +37,14 @@ fn main() {
33
37
34
38
match & args_ref[ 1 ..] {
35
39
[ "build-and-check" , target, "--" , args @ ..] if !args. is_empty ( ) => {
36
- check_cargo_args ( args) ;
37
40
run_build_and_check ( target, args) ;
38
41
}
39
42
[ "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) ;
42
48
}
43
49
_ => {
44
50
println ! ( "{USAGE}" ) ;
@@ -47,22 +53,25 @@ fn main() {
47
53
}
48
54
}
49
55
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).
53
59
for arg in args {
54
60
assert ! (
55
61
!arg. contains( "--target" ) ,
56
62
"target must be passed positionally. {USAGE}"
57
63
) ;
58
64
}
59
- }
60
65
61
- fn run_build_and_check ( target : & str , args : & [ & str ] ) {
62
66
let paths = exec_cargo_with_args ( target, args) ;
67
+ check_paths ( & paths) ;
68
+ }
69
+
70
+ fn check_paths < P : AsRef < Path > > ( paths : & [ P ] ) {
63
71
for path in paths {
72
+ let path = path. as_ref ( ) ;
64
73
println ! ( "Checking {}" , path. display( ) ) ;
65
- let archive = Archive :: from_path ( & path) ;
74
+ let archive = Archive :: from_path ( path) ;
66
75
67
76
verify_no_duplicates ( & archive) ;
68
77
verify_core_symbols ( & archive) ;
0 commit comments