From 1324bac660114cb1967da9e6c773387a894f8923 Mon Sep 17 00:00:00 2001 From: Chase Latta <638538+chaselatta@users.noreply.github.com> Date: Tue, 30 Nov 2021 11:40:44 -0800 Subject: [PATCH] Stamp fuchsia packages with api level (flutter/engine#29998) BUG: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=87813 As part of the fuchsia platform versioning we are stamping all of our packages with a target api level which can be read by our assembly tools. We would like to be able to update the target api level with a roller so I added a file which can is read by the gn tool. I am open to suggestions about how to change this is we do not want to add file read calls to our gn script. --- engine/src/flutter/tools/fuchsia/fuchsia_archive.gni | 2 ++ engine/src/flutter/tools/fuchsia/target_api_level | 1 + engine/src/flutter/tools/gn | 4 ++++ 3 files changed, 7 insertions(+) create mode 100644 engine/src/flutter/tools/fuchsia/target_api_level diff --git a/engine/src/flutter/tools/fuchsia/fuchsia_archive.gni b/engine/src/flutter/tools/fuchsia/fuchsia_archive.gni index f2dc3d6485..aae9b8fefc 100644 --- a/engine/src/flutter/tools/fuchsia/fuchsia_archive.gni +++ b/engine/src/flutter/tools/fuchsia/fuchsia_archive.gni @@ -151,6 +151,8 @@ template("_fuchsia_archive") { rebase_path(manifest_json_file, root_build_dir), ] + assert(fuchsia_target_api_level != -1, + "Must set a target api level when creating an archive") if (fuchsia_target_api_level != -1) { args += [ "--api-level", diff --git a/engine/src/flutter/tools/fuchsia/target_api_level b/engine/src/flutter/tools/fuchsia/target_api_level new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/engine/src/flutter/tools/fuchsia/target_api_level @@ -0,0 +1 @@ +7 diff --git a/engine/src/flutter/tools/gn b/engine/src/flutter/tools/gn index af169d388c..f4ed6e6e29 100755 --- a/engine/src/flutter/tools/gn +++ b/engine/src/flutter/tools/gn @@ -406,6 +406,10 @@ def to_gn_args(args): if args.fuchsia_target_api_level is not None: gn_args['fuchsia_target_api_level'] = args.fuchsia_target_api_level + elif args.target_os == 'fuchsia': + # Read the default target api level from a file so we can update it with a roller + with open(os.path.join(os.path.dirname(__file__), 'fuchsia/target_api_level')) as f: + gn_args['fuchsia_target_api_level'] = int(f.read().strip()) return gn_args