From 65e8ec214023f74153d38058e7dfb5c8770becf3 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 12 Apr 2024 13:07:11 -0700 Subject: [PATCH] Update gen_keycodes templates (#146481) 1. Change chromium default branch from master (404) to main. 2. When I migrated the template to ARC is triggered a `-Wobjc-redundant-literal-use` error, so fix that. Engine PR is https://github.com/flutter/engine/pull/51981 3. Update to `FLUTTER_SHELL_PLATFORM_EMBEDDER_TEST_UTILS_KEY_CODES_G_H_` to match https://github.com/flutter/engine/pull/49006 This only updates the template and the script--I ran the script to validate it worked and built in the engine, but did not check in the actual generated key code changes (filed https://github.com/flutter/flutter/issues/146480 for that). --- dev/tools/gen_keycodes/bin/gen_keycodes.dart | 4 ++-- dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl | 4 ++-- dev/tools/gen_keycodes/data/key_codes_h.tmpl | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dev/tools/gen_keycodes/bin/gen_keycodes.dart b/dev/tools/gen_keycodes/bin/gen_keycodes.dart index dd04a7087edb5..e715bd1a08840 100644 --- a/dev/tools/gen_keycodes/bin/gen_keycodes.dart +++ b/dev/tools/gen_keycodes/bin/gen_keycodes.dart @@ -26,14 +26,14 @@ import 'package:path/path.dart' as path; /// Get contents of the file that contains the physical key mapping in Chromium /// source. Future getChromiumCodes() async { - final Uri keyCodesUri = Uri.parse('https://chromium.googlesource.com/codesearch/chromium/src/+/refs/heads/master/ui/events/keycodes/dom/dom_code_data.inc?format=TEXT'); + final Uri keyCodesUri = Uri.parse('https://chromium.googlesource.com/codesearch/chromium/src/+/refs/heads/main/ui/events/keycodes/dom/dom_code_data.inc?format=TEXT'); return utf8.decode(base64.decode(await http.read(keyCodesUri))); } /// Get contents of the file that contains the logical key mapping in Chromium /// source. Future getChromiumKeys() async { - final Uri keyCodesUri = Uri.parse('https://chromium.googlesource.com/codesearch/chromium/src/+/refs/heads/master/ui/events/keycodes/dom/dom_key_data.inc?format=TEXT'); + final Uri keyCodesUri = Uri.parse('https://chromium.googlesource.com/codesearch/chromium/src/+/refs/heads/main/ui/events/keycodes/dom/dom_key_data.inc?format=TEXT'); return utf8.decode(base64.decode(await http.read(keyCodesUri))); } diff --git a/dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl b/dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl index da621f4bc39d0..1c3aa81c4992a 100644 --- a/dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl +++ b/dev/tools/gen_keycodes/data/ios_key_code_map_mm.tmpl @@ -49,8 +49,8 @@ const std::set functionKeyCodes = { }; API_AVAILABLE(ios(13.4)) -NSDictionary* specialKeyMapping = [[NSDictionary alloc] initWithDictionary:@{ +NSDictionary* specialKeyMapping = @{ @@@SPECIAL_KEY_MAPPING@@@ -}]; +}; @@@SPECIAL_KEY_CONSTANTS@@@ diff --git a/dev/tools/gen_keycodes/data/key_codes_h.tmpl b/dev/tools/gen_keycodes/data/key_codes_h.tmpl index f8a35f32bf554..aa24cd8b678e7 100644 --- a/dev/tools/gen_keycodes/data/key_codes_h.tmpl +++ b/dev/tools/gen_keycodes/data/key_codes_h.tmpl @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_PLATFORM_COMMON_TESTING_KEY_CODES_H_ -#define FLUTTER_SHELL_PLATFORM_COMMON_TESTING_KEY_CODES_H_ +#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_TEST_UTILS_KEY_CODES_G_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TEST_UTILS_KEY_CODES_G_H_ #include @@ -37,4 +37,4 @@ namespace keycodes { } // namespace flutter -#endif // FLUTTER_SHELL_PLATFORM_COMMON_TESTING_KEY_CODES_H_ +#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TEST_UTILS_KEY_CODES_G_H_