From 74850ce8c50c5afbf161d916210bcead7b5c0710 Mon Sep 17 00:00:00 2001 From: "zijiehe@" <68449066+zijiehe-google-com@users.noreply.github.com> Date: Wed, 28 Aug 2024 09:39:22 -0700 Subject: [PATCH] [fuchsia] use the api-level from gn-sdk (flutter/engine#54740) https://crrev.com/c/5805927 provides the default api-level in gn-sdk, so as long as we have the latest gn-sdk / skia setup, the api-level would be updated automatically. Bug: [347373793](http://b/347373793) ## 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 and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [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 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [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 --- engine/src/flutter/build/config/fuchsia/gn_configs.gni | 6 ------ engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py | 5 +++-- .../flutter/tools/fuchsia/build_fuchsia_artifacts_test.py | 5 +---- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/engine/src/flutter/build/config/fuchsia/gn_configs.gni b/engine/src/flutter/build/config/fuchsia/gn_configs.gni index 7cf672c278..ff981de991 100644 --- a/engine/src/flutter/build/config/fuchsia/gn_configs.gni +++ b/engine/src/flutter/build/config/fuchsia/gn_configs.gni @@ -21,12 +21,6 @@ declare_args() { # TODO(zijiehe): Remove the override and move it into declare_args once the one # in //build/config/sdk.gni being removed. - b/40935282 -# The target API level for this repository. Embedders should override this -# value to specify the API level the packages produced from this repository -# should be targeting, e.g. in their top-level //.gn file. A value of -1 -# means that no API level will be passed to the tools that consumes it. -fuchsia_target_api_level = 22 - # The SDK manifest file. This is useful to include as a dependency # for some targets in order to cause a rebuild when the version of the # SDK is changed. diff --git a/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py b/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py index 3e25325308..5258466145 100755 --- a/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py +++ b/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts.py @@ -178,12 +178,13 @@ def CopyToBucket(src, dst, product=False): def ReadTargetAPILevel(): - filename = os.path.join(os.path.dirname(__file__), '../../build/config/fuchsia/gn_configs.gni') + filename = os.path.join(os.path.dirname(__file__), 'gn-sdk/src/gn_configs.gni') with open(filename) as f: for line in f: + line = line.strip() if line.startswith('fuchsia_target_api_level'): return line.split('=')[-1].strip() - assert False, 'No fuchsia_target_api_level found in //flutter/build/config/fuchsia/gn_configs.gni' + assert False, 'No fuchsia_target_api_level found in ' + filename def CopyVulkanDepsToBucket(src, dst, arch): diff --git a/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts_test.py b/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts_test.py index 9c536a6d15..3ad93f21c6 100755 --- a/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts_test.py +++ b/engine/src/flutter/tools/fuchsia/build_fuchsia_artifacts_test.py @@ -8,10 +8,7 @@ import build_fuchsia_artifacts class BuildFuchsiaArtifactsTest(unittest.TestCase): def test_read_fuchsia_target_api_level(self): - # It's expected to update this test each time the fuchsia_target_api_level - # in //flutter/build/config/fuchsia/gn_configs.gni is changed, so we don't - # accidentally publish the artifacts with an incorrect api level suffix. - self.assertEqual(build_fuchsia_artifacts.ReadTargetAPILevel(), '22') + self.assertGreater(int(build_fuchsia_artifacts.ReadTargetAPILevel()), 21) if __name__ == '__main__':