From d2ecff7969f64b01928e0c1fac69b389251ee33d Mon Sep 17 00:00:00 2001 From: Chase Latta Date: Wed, 13 Jan 2021 13:46:52 -0800 Subject: [PATCH] Reland - bump fuchsia toolchain to clang 12 (flutter/engine#23656) --- DEPS | 18 ++++++------- engine/src/flutter/tools/fuchsia/clang.gni | 7 +++-- .../flutter/tools/fuchsia/fuchsia_libs.gni | 6 ++--- .../flutter/tools/fuchsia/parse_manifest.py | 27 ++++++++++++------- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/DEPS b/DEPS index e6e4c978d75..7b51690f9c7 100644 --- a/DEPS +++ b/DEPS @@ -98,7 +98,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '3d37855508a4de2481ad0fead8e15563f0210c2c', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '9d2c731ba05432878cc5187329c66b70983d914b', # Fuchsia compatibility # @@ -535,8 +535,8 @@ deps = { 'src/fuchsia/toolchain/mac': { 'packages': [ { - 'package': 'fuchsia/clang/mac-amd64', - 'version': 'OzTZOKkICT0yD82Dbx0jvVn5hN5eOSi6ByVTDseE7i0C' + 'package': 'fuchsia/third_party/clang/mac-amd64', + 'version': 'git_revision:2c0536b76b35fa592ac7b4a0e4bb176eaf55af75' } ], 'condition': 'host_os == "mac"', @@ -555,13 +555,13 @@ deps = { 'src/fuchsia/toolchain/linux': { 'packages': [ { - 'package': 'fuchsia/clang/linux-amd64', - 'version': 'OT6p30bQQhyCzRSy7xPsSbZ88J3PWOnneenkMZ0j7kIC' + 'package': 'fuchsia/third_party/clang/linux-amd64', + 'version': 'git_revision:2c0536b76b35fa592ac7b4a0e4bb176eaf55af75' } - ], - 'condition': 'host_os == "linux"', - 'dep_type': 'cipd', - }, + ], + 'condition': 'host_os == "linux"', + 'dep_type': 'cipd', + }, } hooks = [ diff --git a/engine/src/flutter/tools/fuchsia/clang.gni b/engine/src/flutter/tools/fuchsia/clang.gni index 010915d5515..df9eb45d42a 100644 --- a/engine/src/flutter/tools/fuchsia/clang.gni +++ b/engine/src/flutter/tools/fuchsia/clang.gni @@ -26,7 +26,10 @@ if (is_fuchsia) { assert(false, "OS not supported") } -clang_manifest = rebase_path("$clang_base/${clang_target}.manifest") +clang_manifest = rebase_path("$clang_base/runtime.json") clang_manifest_json = exec_script("//flutter/tools/fuchsia/parse_manifest.py", - [ "--input=${clang_manifest}" ], + [ + "--input=${clang_manifest}", + "--clang-cpu=${clang_cpu}", + ], "json") diff --git a/engine/src/flutter/tools/fuchsia/fuchsia_libs.gni b/engine/src/flutter/tools/fuchsia/fuchsia_libs.gni index 795cc3c117d..aadd693dbf0 100644 --- a/engine/src/flutter/tools/fuchsia/fuchsia_libs.gni +++ b/engine/src/flutter/tools/fuchsia/fuchsia_libs.gni @@ -48,17 +48,17 @@ common_libs = [ { name = "libc++.so.2" path = rebase_path( - "$clang_base/${clang_manifest_json.md5_33bfe15b05ada4ed326fbc33adb39b95}") + "$clang_base/${clang_manifest_json.md5_19df03aecdc9eb27bc8b4038352f2b27}") }, { name = "libc++abi.so.1" path = rebase_path( - "$clang_base/${clang_manifest_json.md5_916c01a85e3353f124776599819ecb1c}") + "$clang_base/${clang_manifest_json.md5_6aff1b5f218d4a9278d85d63d0695af8}") }, { name = "libunwind.so.1" path = rebase_path( - "$clang_base/${clang_manifest_json.md5_beb70f40d525448b39ea87d9f5811e56}") + "$clang_base/${clang_manifest_json.md5_fb2bd871885ef42c2cf3138655f901ed}") }, ] diff --git a/engine/src/flutter/tools/fuchsia/parse_manifest.py b/engine/src/flutter/tools/fuchsia/parse_manifest.py index af45d5005ae..bb7e4917e38 100755 --- a/engine/src/flutter/tools/fuchsia/parse_manifest.py +++ b/engine/src/flutter/tools/fuchsia/parse_manifest.py @@ -12,27 +12,34 @@ import os import sys import hashlib - def main(): parser = argparse.ArgumentParser() parser.add_argument( '--input', dest='file_path', action='store', required=True) + parser.add_argument( + '--clang-cpu', dest='clang_cpu', action='store', required=True) args = parser.parse_args() - files = open(args.file_path, 'r') - lines = files.read().split() + with open(args.file_path) as f: + data = json.load(f) output = {} + target = args.clang_cpu + '-fuchsia' - for line in lines: - key, val = line.strip().split('=') - md5 = hashlib.md5(key.encode()).hexdigest() - hash_key = 'md5_%s' % md5 - # Uncomment this line to get the hash keys - # print val, hash_key - output[hash_key] = os.path.dirname(val) + for d in data: + if target in d['target']: + for runtime in d['runtime']: + # key contains the soname and the cflags used to compile it. + # this allows us to distinguish between different sanitizers + # and experiments + key = runtime['soname'] + ''.join(d['cflags']) + md5 = hashlib.md5(key.encode()).hexdigest() + hash_key = 'md5_%s' % md5 + # Uncomment this line to get the hash keys + # print runtime['dist'], d['cflags'], hash_key + output[hash_key] = os.path.dirname(runtime['dist']) print(json.dumps(output))