File tree Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -2883,9 +2883,33 @@ static NEW_STANDALONE_ANDROID_COMPILERS: [&str; 4] = [
28832883// So to construct proper command line check if
28842884// `--target` argument would be passed or not to clang
28852885fn android_clang_compiler_uses_target_arg_internally ( clang_path : & Path ) -> bool {
2886- NEW_STANDALONE_ANDROID_COMPILERS
2887- . iter ( )
2888- . any ( |x| Some ( x. as_ref ( ) ) == clang_path. file_name ( ) )
2886+ if let Some ( filename) = clang_path. file_name ( ) {
2887+ if let Some ( filename_str) = filename. to_str ( ) {
2888+ filename_str. contains ( "android" )
2889+ } else {
2890+ false
2891+ }
2892+ } else {
2893+ false
2894+ }
2895+ }
2896+
2897+ #[ test]
2898+ fn test_android_clang_compiler_uses_target_arg_internally ( ) {
2899+ for version in 16 ..21 {
2900+ assert ! ( android_clang_compiler_uses_target_arg_internally(
2901+ & PathBuf :: from( format!( "armv7a-linux-androideabi{}-clang" , version) )
2902+ ) ) ;
2903+ assert ! ( android_clang_compiler_uses_target_arg_internally(
2904+ & PathBuf :: from( format!( "armv7a-linux-androideabi{}-clang++" , version) )
2905+ ) ) ;
2906+ }
2907+ assert ! ( !android_clang_compiler_uses_target_arg_internally(
2908+ & PathBuf :: from( "clang" )
2909+ ) ) ;
2910+ assert ! ( !android_clang_compiler_uses_target_arg_internally(
2911+ & PathBuf :: from( "clang++" )
2912+ ) ) ;
28892913}
28902914
28912915fn autodetect_android_compiler ( target : & str , host : & str , gnu : & str , clang : & str ) -> String {
You can’t perform that action at this time.
0 commit comments