diff --git a/script/redirect-cc.py b/script/redirect-cc.py index d9c9af31d43b..5d442986ec3f 100755 --- a/script/redirect-cc.py +++ b/script/redirect-cc.py @@ -55,10 +55,16 @@ def replace_cc_arg(args): # Filter away out and out_x86 # Maybe this dir can be queried from env variable instead of hardcoding OUT_DIR_NAMES = ['out', 'out_x86'] - rel_path_parts = rel_path.split(os.sep, 3) + rel_path_parts = rel_path.split(os.sep, 4) if rel_path_parts[0] in OUT_DIR_NAMES: if rel_path_parts[2] == 'gen': - rel_path = rel_path_parts[3] + rel_path = os.path.join(rel_path_parts[3], rel_path_parts[4]) + elif rel_path_parts[3] == 'gen': + # In addition to the regular gen location above, 64-bit builds may + # have the directory stucture like out//android_clang_arm or + # out//android_clang_x86 on Android, or + # out//clang_x64_v8_arm64 on MacOS + rel_path = rel_path_parts[4] else: # Don't even try to substitute path for other auto-generated cc return