File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ edition = "2018"
19
19
20
20
[dependencies ]
21
21
jobserver = { version = " 0.1.16" , optional = true }
22
+ regex = " 1.3.9"
22
23
23
24
[features ]
24
25
parallel = [" jobserver" ]
Original file line number Diff line number Diff line change 56
56
#![ allow( deprecated) ]
57
57
#![ deny( missing_docs) ]
58
58
59
+ use regex:: Regex ;
59
60
use std:: collections:: HashMap ;
60
61
use std:: env;
61
62
use std:: ffi:: { OsStr , OsString } ;
@@ -2839,9 +2840,26 @@ static NEW_STANDALONE_ANDROID_COMPILERS: [&str; 4] = [
2839
2840
// So to construct proper command line check if
2840
2841
// `--target` argument would be passed or not to clang
2841
2842
fn android_clang_compiler_uses_target_arg_internally ( clang_path : & Path ) -> bool {
2842
- NEW_STANDALONE_ANDROID_COMPILERS
2843
- . iter ( )
2844
- . any ( |x| Some ( x. as_ref ( ) ) == clang_path. file_name ( ) )
2843
+ let re = Regex :: new ( r"^.*\d{2}-clang(\+\+)?$" ) . unwrap ( ) ;
2844
+ re. is_match ( clang_path. to_str ( ) . unwrap ( ) )
2845
+ }
2846
+
2847
+ #[ test]
2848
+ fn test_android_clang_compiler_uses_target_arg_internally ( ) {
2849
+ for version in 16 ..21 {
2850
+ assert ! ( android_clang_compiler_uses_target_arg_internally(
2851
+ & PathBuf :: from( format!( "armv7a-linux-androideabi{}-clang" , version) )
2852
+ ) ) ;
2853
+ assert ! ( android_clang_compiler_uses_target_arg_internally(
2854
+ & PathBuf :: from( format!( "armv7a-linux-androideabi{}-clang++" , version) )
2855
+ ) ) ;
2856
+ }
2857
+ assert ! ( !android_clang_compiler_uses_target_arg_internally(
2858
+ & PathBuf :: from( "clang" )
2859
+ ) ) ;
2860
+ assert ! ( !android_clang_compiler_uses_target_arg_internally(
2861
+ & PathBuf :: from( "clang++" )
2862
+ ) ) ;
2845
2863
}
2846
2864
2847
2865
fn autodetect_android_compiler ( target : & str , host : & str , gnu : & str , clang : & str ) -> String {
You can’t perform that action at this time.
0 commit comments