From bce07474ce354afc8ea6bb1b695cc86ef376260d Mon Sep 17 00:00:00 2001 From: "zijiehe@" <68449066+zijiehe-google-com@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:19:16 -0700 Subject: [PATCH] [Fuchsia] remove build/fuchsia (#839) After https://github.com/flutter/engine/pull/51072, this folder is obsolete and can be removed. The change is locally tested. Bug: http://b/40935282 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat --------- Co-authored-by: Jason Simmons --- build/config/compiler/BUILD.gn | 10 ++-- build/fuchsia/BUILD.gn | 13 ----- build/fuchsia/config.gni | 9 --- build/fuchsia/fidl/BUILD.gn | 11 ---- build/fuchsia/fidl_gen_cpp.py | 99 --------------------------------- build/fuchsia/fuchsia.cipd.yaml | 6 -- build/fuchsia/pave_device.py | 73 ------------------------ build/fuchsia/pkg/BUILD.gn | 14 ----- build/fuchsia/sysroot/BUILD.gn | 11 ---- 9 files changed, 6 insertions(+), 240 deletions(-) delete mode 100644 build/fuchsia/BUILD.gn delete mode 100644 build/fuchsia/config.gni delete mode 100644 build/fuchsia/fidl/BUILD.gn delete mode 100755 build/fuchsia/fidl_gen_cpp.py delete mode 100644 build/fuchsia/fuchsia.cipd.yaml delete mode 100755 build/fuchsia/pave_device.py delete mode 100644 build/fuchsia/pkg/BUILD.gn delete mode 100644 build/fuchsia/sysroot/BUILD.gn diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 30b98408b4..51d0b97b27 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -17,7 +17,6 @@ if (is_win) { import("//build/config/c++/c++.gni") import("//build/config/profiler.gni") import("//build/config/sanitizers/sanitizers.gni") -import("//build/fuchsia/config.gni") import("//build/toolchain/ccache.gni") import("//build/toolchain/clang.gni") import("//build/toolchain/toolchain.gni") @@ -427,9 +426,7 @@ config("compiler") { # Fuchsia-specific flags setup. # ----------------------------- if (is_fuchsia) { - if (fuchsia_target_api_level != -1) { - cflags += [ "-ffuchsia-api-level=${fuchsia_target_api_level}" ] - } + configs = ["//flutter/tools/fuchsia/gn-sdk/src/config:compiler"] } asmflags = cflags @@ -582,6 +579,11 @@ config("runtime_library") { libs += [ "gcc" ] } } + + # Fuchsia standard library setup. + if (is_fuchsia) { + configs = ["//flutter/tools/fuchsia/gn-sdk/src/config:runtime_library"] + } } # default_warning_flags collects all warning flags that are used by default. diff --git a/build/fuchsia/BUILD.gn b/build/fuchsia/BUILD.gn deleted file mode 100644 index bfedb7090c..0000000000 --- a/build/fuchsia/BUILD.gn +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_fuchsia) - -group("fuchsia") { - deps = [ - "fidl", - "pkg", - "sysroot", - ] -} diff --git a/build/fuchsia/config.gni b/build/fuchsia/config.gni deleted file mode 100644 index 69c6aa33fc..0000000000 --- a/build/fuchsia/config.gni +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -declare_args() { - # The target API level for this repository. A value of -1 - # means that no API level will be passed to the tools that consume it. - fuchsia_target_api_level = -1 -} diff --git a/build/fuchsia/fidl/BUILD.gn b/build/fuchsia/fidl/BUILD.gn deleted file mode 100644 index 9042bc3ebc..0000000000 --- a/build/fuchsia/fidl/BUILD.gn +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_fuchsia) -import("//build/fuchsia/sdk.gni") - -fuchsia_sdk("fidl") { - meta = "$fuchsia_sdk_path/meta/manifest.json" - enabled_parts = [ "fidl_library" ] -} diff --git a/build/fuchsia/fidl_gen_cpp.py b/build/fuchsia/fidl_gen_cpp.py deleted file mode 100755 index add4d9fc81..0000000000 --- a/build/fuchsia/fidl_gen_cpp.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" Generate C/C++ headers and source files from the set of FIDL files specified -in the meta.json manifest. -""" - - -import argparse -import collections -import json -import os -import subprocess -import sys - -def GetFIDLFilesRecursive(libraries, sdk_base, path): - with open(path) as json_file: - parsed = json.load(json_file) - result = [] - deps = parsed['deps'] - for dep in deps: - dep_meta_json = os.path.abspath('%s/fidl/%s/meta.json' % (sdk_base, dep)) - GetFIDLFilesRecursive(libraries, sdk_base, dep_meta_json) - libraries[parsed['name']] = result + parsed['sources'] - -def GetFIDLFilesByLibraryName(sdk_base, root): - libraries = collections.OrderedDict() - GetFIDLFilesRecursive(libraries, sdk_base, root) - return libraries - -def main(): - parser = argparse.ArgumentParser(); - - parser.add_argument('--fidlc-bin', dest='fidlc_bin', action='store', required=True) - parser.add_argument('--fidlgen-bin', dest='fidlgen_bin', action='append', required=False) - - parser.add_argument('--sdk-base', dest='sdk_base', action='store', required=True) - parser.add_argument('--root', dest='root', action='store', required=True) - parser.add_argument('--json', dest='json', action='store', required=True) - parser.add_argument('--fidlgen-output-root', dest='fidlgen_output_root', action='store', required=False) - parser.add_argument('--target-api-level', dest='target_api_level', action='store', required=False) - - args = parser.parse_args() - - assert os.path.exists(args.fidlc_bin) - - fidl_files_by_name = GetFIDLFilesByLibraryName(args.sdk_base, args.root) - - fidlc_command = [ - args.fidlc_bin, - '--json', - args.json - ] - - if args.target_api_level: - fidlc_command += [ - '--available', - 'fuchsia:{api_level}'.format(api_level=args.target_api_level), - ] - - # Create an iterator that works on both python3 and python2 - try: - fidl_files_by_name_iter = list(fidl_files_by_name.items()) - except AttributeError: - fidl_files_by_name_iter = iter(fidl_files_by_name.items()) - - for _, fidl_files in fidl_files_by_name_iter: - fidlc_command.append('--files') - for fidl_file in fidl_files: - fidl_abspath = os.path.abspath('%s/%s' % (args.sdk_base, fidl_file)) - fidlc_command.append(fidl_abspath) - - subprocess.check_call(fidlc_command) - - if args.fidlgen_output_root: - assert os.path.exists(args.json) - for fidlgen_bin in args.fidlgen_bin: - assert os.path.exists(fidlgen_bin) - - fidlgen_command = [ - fidlgen_bin, - '-json', - args.json, - '-root', - args.fidlgen_output_root - ] - - subprocess.check_call(fidlgen_command) - else: - # --fidlgen-bin and --fidlgen-output-root should be passed in together. - assert not args.fidlgen_bin - - return 0 - -if __name__ == '__main__': - sys.exit(main()) diff --git a/build/fuchsia/fuchsia.cipd.yaml b/build/fuchsia/fuchsia.cipd.yaml deleted file mode 100644 index db20acd772..0000000000 --- a/build/fuchsia/fuchsia.cipd.yaml +++ /dev/null @@ -1,6 +0,0 @@ -package: flutter/fuchsia -description: Flutter Fuchsia Artifacts -install_mode: copy -data: - # Don't modify this! This is where the build script put all bucket artifacts. - - dir: flutter/ diff --git a/build/fuchsia/pave_device.py b/build/fuchsia/pave_device.py deleted file mode 100755 index 865ceddc10..0000000000 --- a/build/fuchsia/pave_device.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -'''Pave and boot one of the known target types with the images in the Fuchsia -SDK. -''' - -import argparse -import collections -import json -import os -import subprocess -import sys -import tempfile - -def SDKSubDirectory(): - if sys.platform == 'darwin': - return 'mac' - elif sys.platform.startswith('linux'): - return 'linux' - else: - raise Error('Unsupported platform.') - -def main(): - parser = argparse.ArgumentParser(); - - parser.add_argument('--target', - type=str, dest='target', choices=['chromebook'], default='chromebook') - - args = parser.parse_args() - - sdk_dir = os.path.join(os.path.dirname(sys.argv[0]), - "..", "..", "fuchsia", "sdk", SDKSubDirectory()) - sdk_dir = os.path.abspath(sdk_dir) - - assert os.path.exists(sdk_dir) - - # TODO(chinmaygarde): This will be patched in the future for arm64. - target_dir = os.path.join(sdk_dir, "target", "x64") - target_dir = os.path.abspath(target_dir) - assert os.path.exists(target_dir) - - with tempfile.NamedTemporaryFile() as ssh_keys_file: - ssh_keys = subprocess.check_output(['ssh-add', '-L']) - ssh_keys_file.write(ssh_keys) - ssh_keys_file.flush() - - if args.target == 'chromebook': - bootserver_command = [ - os.path.join(sdk_dir, "tools", "bootserver"), - "--boot", - os.path.join(target_dir, "fuchsia.zbi"), - "--fvm", - os.path.join(target_dir, "fvm.sparse.blk"), - "--zircona", - os.path.join(target_dir, "fuchsia.zbi"), - "--zirconr", - os.path.join(target_dir, "zircon.vboot"), - "--authorized-keys", - ssh_keys_file.name - ] - else: - raise Error('Target not specified.') - - subprocess.check_call(bootserver_command) - - return 0 - -if __name__ == '__main__': - sys.exit(main()) diff --git a/build/fuchsia/pkg/BUILD.gn b/build/fuchsia/pkg/BUILD.gn deleted file mode 100644 index 35c3c7a12a..0000000000 --- a/build/fuchsia/pkg/BUILD.gn +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_fuchsia) -import("//build/fuchsia/sdk.gni") - -fuchsia_sdk("pkg") { - meta = "$fuchsia_sdk_path/meta/manifest.json" - enabled_parts = [ - "cc_source_library", - "cc_prebuilt_library", - ] -} diff --git a/build/fuchsia/sysroot/BUILD.gn b/build/fuchsia/sysroot/BUILD.gn deleted file mode 100644 index 7c3ce59d04..0000000000 --- a/build/fuchsia/sysroot/BUILD.gn +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -assert(is_fuchsia) -import("//build/fuchsia/sdk.gni") - -fuchsia_sdk("sdk_sysroot") { - meta = "$fuchsia_sdk_path/meta/manifest.json" - enabled_parts = [ "sysroot" ] -}