From 895e046c7a8d57a853950e31889cbd51fe02af79 Mon Sep 17 00:00:00 2001 From: Matej Knopp Date: Mon, 28 Sep 2026 15:58:03 +0200 Subject: [PATCH 1/2] Update dependencies. --- DEPS | 56 +-- engine/src/flutter/BUILD.gn | 1 - engine/src/flutter/pubspec.yaml | 5 +- engine/src/flutter/testing/run_tests.py | 1 - .../src/flutter/tools/const_finder/.gitignore | 5 - .../src/flutter/tools/const_finder/BUILD.gn | 16 - .../src/flutter/tools/const_finder/README.md | 11 - .../flutter/tools/const_finder/bin/main.dart | 114 ------ .../flutter/tools/const_finder/pubspec.yaml | 23 -- .../const_finder/test/const_finder_test.dart | 332 ------------------ .../fixtures/.dart_tool/package_config.json | 15 - .../const_finder/test/fixtures/.packages | 3 - .../const_finder/test/fixtures/lib/box.dart | 231 ------------ .../test/fixtures/lib/consts.dart | 76 ---- .../test/fixtures/lib/consts_and_non.dart | 44 --- .../fixtures/lib/static_icon_provider.dart | 31 -- .../test/fixtures/lib/target.dart | 50 --- .../test/fixtures/pkg/package.dart | 16 - engine/src/flutter/tools/font_subset/BUILD.gn | 5 - engine/src/flutter/tools/gn | 5 - examples/hello_world/analysis_options.yaml | 9 + 21 files changed, 40 insertions(+), 1009 deletions(-) delete mode 100644 engine/src/flutter/tools/const_finder/.gitignore delete mode 100644 engine/src/flutter/tools/const_finder/BUILD.gn delete mode 100644 engine/src/flutter/tools/const_finder/README.md delete mode 100644 engine/src/flutter/tools/const_finder/bin/main.dart delete mode 100644 engine/src/flutter/tools/const_finder/pubspec.yaml delete mode 100644 engine/src/flutter/tools/const_finder/test/const_finder_test.dart delete mode 100644 engine/src/flutter/tools/const_finder/test/fixtures/.dart_tool/package_config.json delete mode 100644 engine/src/flutter/tools/const_finder/test/fixtures/.packages delete mode 100644 engine/src/flutter/tools/const_finder/test/fixtures/lib/box.dart delete mode 100644 engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart delete mode 100644 engine/src/flutter/tools/const_finder/test/fixtures/lib/consts_and_non.dart delete mode 100644 engine/src/flutter/tools/const_finder/test/fixtures/lib/static_icon_provider.dart delete mode 100644 engine/src/flutter/tools/const_finder/test/fixtures/lib/target.dart delete mode 100644 engine/src/flutter/tools/const_finder/test/fixtures/pkg/package.dart diff --git a/DEPS b/DEPS index aea8df8f..bd6e3899 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # updates to Clang Tidy will not turn the tree red. # # See https://github.com/flutter/flutter/wiki/Engine-pre‐submits-and-post‐submits#post-submit - 'clang_version': 'git_revision:80743bd43fd5b38fedc503308e7a652e23d3ec93', + 'clang_version': 'git_revision:07d67299a15ce03b053736e2d31a668ee0576987', 'reclient_version': 're_client_version:0.185.0.db415f21-gomaip', @@ -47,25 +47,25 @@ vars = { # updated revision list of existing dependencies. You will need to # gclient sync before and after update deps to ensure all deps are updated. # updated revision list of existing dependencies. - 'dart_revision': 'bb17f25f176f5209179b23d51aab9725ffb5146d', + 'dart_revision': '0e7642b85457515cfac6ffda9e0e10906a5e5356', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py 'dart_binaryen_rev': '9926156a583cec3d22d521232b31c70fa9a87dc1', - 'dart_boringssl_rev': '7515be5ccd601ae0433d3682ba7737592b402014', - 'dart_core_rev': 'fe516ee1b38cc60e7a8c6e082c337037a043d782', - 'dart_devtools_rev': '21f1838f3a9b138ac377efb953ca5a53c8832e75', - 'dart_ecosystem_rev': 'edfdb3b4063b9034b708144633a700204f865f43', - 'dart_http_rev': '5d94ef52582867e077bf41c3fa20fb8b1d1d834e', - 'dart_i18n_rev': 'e1b5a798f8922bb27bbc6d858748ece6f9a19f02', + 'dart_boringssl_rev': '1097261733d85c85147a5c96ff6ee835c90f5951', + 'dart_core_rev': '08e4022160c465780690c43ffdbce60812975d2c', + 'dart_devtools_rev': 'fd39ed6deeed50104b5262d8228f5ae3ceab7bfd', + 'dart_ecosystem_rev': '16dca7ae5d3ff896a4db47e1ed6cd50f7ebbf115', + 'dart_http_rev': 'd8e8e9cd1ae6ed0f0339cfa0f47f92e837a786f5', + 'dart_i18n_rev': '1f5ea2fb2381bdf7bab054a43c0d69771f104561', 'dart_perfetto_rev': '13ce0c9e13b0940d2476cd0cff2301708a9a2e2b', - 'dart_protobuf_rev': '91efb90f437bb6a30e6726c3369a2fcb9bba06e7', - 'dart_pub_rev': 'ec276d10a7fa0f6c6ec005340fb9ad29f3b012d0', + 'dart_protobuf_rev': 'a73edc98c98fb25152aa3f12c1b9db91594c1369', + 'dart_pub_rev': '0382a52acba89ff0080d559bb22f4017962bbd1d', 'dart_sync_http_rev': '6666fff944221891182e1f80bf56569338164d72', - 'dart_tools_rev': 'b827a6e38b934232c7f7b8728a5aef6165e7df2d', + 'dart_tools_rev': '3614ce064ae452a15e83de3531236f5f89dfa526', 'dart_vector_math_rev': 'cf3b5db7340d317dd3489e5a35434b408020a852', - 'dart_web_rev': '12a9ca2ebc08f5a6f2d69aebc7daa1f5a2e6a431', - 'dart_webdriver_rev': '3a711ebb36871eac997c5d5d2429f7414873dc63', + 'dart_web_rev': 'e5c6c028da66688a2295557757850a1599ec392e', + 'dart_webdriver_rev': '8e5c611ea242efdc9f597a8a37c38a9c586120ee', 'dart_webkit_inspection_protocol_rev': '762115a971d1968bc940454ad1e88d506d8c5640', 'ocmock_rev': 'c4ec0e3a7a9f56cfdbd0aa01f4f97bb4b75c5ef8', # v3.7.1 @@ -181,11 +181,11 @@ vars = { # The version / instance id of the cipd:chromium/fuchsia/test-scripts which # will be used altogether with fuchsia-sdk to setup the build / test # environment. - 'fuchsia_test_scripts_version': 'vcANVO8VIDQHasH1X_XRoSYLvx7fNwvTbDM1NT9TwA4C', + 'fuchsia_test_scripts_version': 'whZAV1mfT-Rdc0rQ81s_IEef2L7kbGPFtiQPitjf_akC', # The version / instance id of the cipd:chromium/fuchsia/gn-sdk which will be # used altogether with fuchsia-sdk to generate gn based build rules. - 'fuchsia_gn_sdk_version': 'a87CbQSWEjkPUK1ZY_zsy8aZ9W-3Z2v73ohzhrWbDQ4C', + 'fuchsia_gn_sdk_version': 'PDJz3b3CL31uoLOkDb0mm8FidqJ1eCJryoRFd9iVmbIC', } gclient_gn_args_file = 'engine/src/flutter/third_party/dart/build/config/gclient_args.gni' @@ -225,7 +225,7 @@ deps = { Var('llvm_git') + '/llvm-project/libc' + '@' + '5af39a19a1ad51ce93972cdab206dcd3ff9b6afa', 'engine/src/flutter/third_party/icu': - Var('chromium_git') + '/chromium/deps/icu.git' + '@' + 'd578f2e8b7bd5938e21cfb6bf15c079e0aa5b738', + Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '6ebb40c594776cc2c21ea14df85a2a89a328b364', 'engine/src/flutter/third_party/gtest-parallel': Var('chromium_git') + '/external/github.com/google/gtest-parallel' + '@' + '38191e2733d7cbaeaef6a3f1a942ddeb38a2ad14', @@ -257,7 +257,7 @@ deps = { Var('chromium_git') + '/external/github.com/WebAssembly/binaryen.git' + '@' + Var('dart_binaryen_rev'), 'engine/src/flutter/third_party/dart/third_party/devtools': - {'dep_type': 'cipd', 'packages': [{'package': 'dart/third_party/flutter/devtools', 'version': 'git_revision:21f1838f3a9b138ac377efb953ca5a53c8832e75'}]}, + {'dep_type': 'cipd', 'packages': [{'package': 'dart/third_party/flutter/devtools', 'version': 'git_revision:fd39ed6deeed50104b5262d8228f5ae3ceab7bfd'}]}, 'engine/src/flutter/third_party/dart/third_party/perfetto/src': Var('chromium_git') + '/external/github.com/google/perfetto' + '@' + Var('dart_perfetto_rev'), @@ -266,10 +266,10 @@ deps = { Var('dart_git') + '/core.git' + '@' + Var('dart_core_rev'), 'engine/src/flutter/third_party/dart/third_party/pkg/dart_style': - Var('dart_git') + '/dart_style.git@dfdf6420c7ea923d28edef3f11e89b4ff23d03bf', + Var('dart_git') + '/dart_style.git@5a9534fad9ff2faba89596a70323d2b1f1bcf163', 'engine/src/flutter/third_party/dart/third_party/pkg/dartdoc': - Var('dart_git') + '/dartdoc.git@ac96918074974dcd4ea20f764f17090f58c1e428', + Var('dart_git') + '/dartdoc.git@c68debcb5636ba8d66210110092d39d5b06f8225', 'engine/src/flutter/third_party/dart/third_party/pkg/ecosystem': Var('dart_git') + '/ecosystem.git' + '@' + Var('dart_ecosystem_rev'), @@ -284,7 +284,7 @@ deps = { Var('dart_git') + '/leak_tracker.git@f5620600a5ce1c44f65ddaa02001e200b096e14c', 'engine/src/flutter/third_party/dart/third_party/pkg/native': - Var('dart_git') + '/native.git@046f63d1d89cd9954623bfa2df9c69d1a395375e', + Var('dart_git') + '/native.git@f628b26f039c3824d83c352c489fd1a4496780d0', 'engine/src/flutter/third_party/dart/third_party/pkg/protobuf': Var('dart_git') + '/protobuf.git' + '@' + Var('dart_protobuf_rev'), @@ -293,7 +293,7 @@ deps = { Var('dart_git') + '/pub.git' + '@' + Var('dart_pub_rev'), 'engine/src/flutter/third_party/dart/third_party/pkg/shelf': - Var('dart_git') + '/shelf.git@6918a7690946044b4098e9f6735439044c676e13', + Var('dart_git') + '/shelf.git@e5c8dc663bf1325ad8f997c4a2387923d37a90d9', 'engine/src/flutter/third_party/dart/third_party/pkg/sync_http': Var('dart_git') + '/sync_http.git' + '@' + Var('dart_sync_http_rev'), @@ -302,7 +302,7 @@ deps = { Var('dart_git') + '/external/github.com/simolus3/tar.git@13479f7c2a18f499e840ad470cfcca8c579f6909', 'engine/src/flutter/third_party/dart/third_party/pkg/test': - Var('dart_git') + '/test.git@bd92e633e7f05edc3301865bdc00d1ae181cb1f1', + Var('dart_git') + '/test.git@9946c9551ddaffd6092c22372b7e146600aa3264', 'engine/src/flutter/third_party/dart/third_party/pkg/tools': Var('dart_git') + '/tools.git' + '@' + Var('dart_tools_rev'), @@ -320,7 +320,7 @@ deps = { Var('dart_git') + '/external/github.com/google/webkit_inspection_protocol.dart.git' + '@' + Var('dart_webkit_inspection_protocol_rev'), 'engine/src/flutter/third_party/dart/tools/sdks/dart-sdk': - {'dep_type': 'cipd', 'packages': [{'package': 'dart/dart-sdk/${{platform}}', 'version': 'version:3.14.0-75.0.dev'}]}, + {'dep_type': 'cipd', 'packages': [{'package': 'dart/dart-sdk/${{platform}}', 'version': 'version:3.14.0-226.0.dev'}]}, # WARNING: end of dart dependencies list that is cleaned up automatically - see create_updated_flutter_deps.py. @@ -432,13 +432,13 @@ deps = { Var('chromium_git') + '/external/github.com/libexpat/libexpat.git' + '@' + '8e49998f003d693213b538ef765814c7d21abada', 'engine/src/flutter/third_party/freetype2': - Var('flutter_git') + '/third_party/freetype2' + '@' + 'be4bcb57914154fc1b9e2900bf8e4b516057e2b8', + Var('flutter_git') + '/third_party/freetype2' + '@' + 'db7276fd53cda30c7f0fcd6b11e2e8f43b4b5e82', 'engine/src/flutter/third_party/ocmock': Var('flutter_git') + '/third_party/ocmock' + '@' + Var('ocmock_rev'), 'engine/src/flutter/third_party/libpng': - Var('flutter_git') + '/third_party/libpng' + '@' + 'b6004397d2ab98f0250376d9b357337b7f422d13', + Var('flutter_git') + '/third_party/libpng' + '@' + 'ced6b6c0c1e24716423a417b399d3c7d4623890d', 'engine/src/flutter/third_party/zlib': Var('chromium_git') + '/chromium/src/third_party/zlib.git' + '@' + '7eda07b1e067ef3fd7eea0419c88b5af45c9a776', @@ -497,7 +497,7 @@ deps = { { # See tools/gradle/README.md for update instructions. # Version here means the CIPD tag. - 'version': 'version:9.3.1', + 'version': 'version:9.5.0', 'package': 'flutter/gradle' } ], @@ -693,7 +693,7 @@ deps = { 'packages': [ { 'package': 'flutter_internal/rbe/reclient_cfgs', - 'version': '0vARzGeIZgIhW7zVfWuqIPQ_HXMLDccjAstykWZKjaEC', + 'version': 'Vk7WiSKwQdBHbCrZ9PtRl3po2WpRFQZSag9M6-sxF_0C', } ], 'condition': 'use_rbe', @@ -729,7 +729,7 @@ deps = { 'packages': [ { 'package': 'fuchsia/sdk/core/linux-amd64', - 'version': '_J8wM3kyQpLN9wvRD5upBr9L1g5TCYF3Oc8P0m3QeZMC' + 'version': 'ukukV5lEkKabtOATkSbVa6yIaU7g4nfmCcVvWNxfMQMC' } ], 'condition': 'download_fuchsia_deps and not download_fuchsia_sdk', diff --git a/engine/src/flutter/BUILD.gn b/engine/src/flutter/BUILD.gn index 325fa4c4..77b676ac 100644 --- a/engine/src/flutter/BUILD.gn +++ b/engine/src/flutter/BUILD.gn @@ -124,7 +124,6 @@ group("flutter") { "//flutter/build/dart/test:gen_dartcli_call", "//flutter/build/dart/test:gen_executable_call", "//flutter/shell/testing", - "//flutter/tools/const_finder", "//flutter/tools/engine_tool:tests", "//flutter/tools/font_subset", ] diff --git a/engine/src/flutter/pubspec.yaml b/engine/src/flutter/pubspec.yaml index 33035ca0..99888fbe 100644 --- a/engine/src/flutter/pubspec.yaml +++ b/engine/src/flutter/pubspec.yaml @@ -76,7 +76,7 @@ name: _engine_workspace # Required for workspace support. environment: - sdk: ^3.9.0-0 + sdk: ^3.13.0-0 # Declare all packages that are part of the workspace. workspace: @@ -93,7 +93,6 @@ workspace: - tools/build_bucket_golden_scraper - tools/clang_tidy - tools/clangd_check - - tools/const_finder - tools/engine_tool - tools/header_guard_check - tools/gen_web_locale_keymap @@ -174,6 +173,8 @@ dependency_overrides: path: ./third_party/dart/third_party/pkg/tools/pkgs/boolean_selector cli_config: path: ./third_party/dart/third_party/pkg/tools/pkgs/cli_config + cli_util: + path: ./third_party/dart/third_party/pkg/tools/pkgs/cli_util collection: path: ./third_party/dart/third_party/pkg/core/pkgs/collection convert: diff --git a/engine/src/flutter/testing/run_tests.py b/engine/src/flutter/testing/run_tests.py index a67a1b2c..78a1fd7d 100755 --- a/engine/src/flutter/testing/run_tests.py +++ b/engine/src/flutter/testing/run_tests.py @@ -889,7 +889,6 @@ def build_dart_host_test_list(): os.path.join('flutter', 'tools', 'api_check'), os.path.join('flutter', 'tools', 'build_bucket_golden_scraper'), os.path.join('flutter', 'tools', 'clang_tidy'), - os.path.join('flutter', 'tools', 'const_finder'), os.path.join('flutter', 'tools', 'engine_tool'), os.path.join('flutter', 'tools', 'githooks'), os.path.join('flutter', 'tools', 'header_guard_check'), diff --git a/engine/src/flutter/tools/const_finder/.gitignore b/engine/src/flutter/tools/const_finder/.gitignore deleted file mode 100644 index fb0d5a5d..00000000 --- a/engine/src/flutter/tools/const_finder/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.dill - -!test/fixtures/.dart_tool -!test/fixtures/.dart_tool/package_config.json -!test/fixtures/.packages diff --git a/engine/src/flutter/tools/const_finder/BUILD.gn b/engine/src/flutter/tools/const_finder/BUILD.gn deleted file mode 100644 index 09be6591..00000000 --- a/engine/src/flutter/tools/const_finder/BUILD.gn +++ /dev/null @@ -1,16 +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. - -import("//flutter/build/dart/rules.gni") - -application_snapshot("const_finder") { - main_dart = "bin/main.dart" - snapshot_kind = "kernel" - - training_args = [ "--help" ] - - inputs = [ "bin/main.dart" ] - - deps = [ "//flutter/flutter_frontend_server:frontend_server" ] -} diff --git a/engine/src/flutter/tools/const_finder/README.md b/engine/src/flutter/tools/const_finder/README.md deleted file mode 100644 index dce32b80..00000000 --- a/engine/src/flutter/tools/const_finder/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Const Finder - -This program uses package:kernel from the Dart SDK in //third_party. - -A snapshot is created via the build rules in BUILD.gn. This is then vended -to the Flutter tool, which uses it to find `const` creations of `IconData` -classes. The information from this can then be passed to the `font-subset` tool -to create a smaller icon font file specific to the application. - -Once [flutter/flutter#47162](https://github.com/flutter/flutter/issues/47162) is -resolved, this package should be moved to the flutter tool. diff --git a/engine/src/flutter/tools/const_finder/bin/main.dart b/engine/src/flutter/tools/const_finder/bin/main.dart deleted file mode 100644 index 25c14249..00000000 --- a/engine/src/flutter/tools/const_finder/bin/main.dart +++ /dev/null @@ -1,114 +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. - -import 'dart:convert'; -import 'dart:io'; - -import 'package:args/args.dart'; -import 'package:kernel/const_finder.dart'; - -void main(List args) { - final parser = ArgParser(); - parser - ..addSeparator( - 'Finds constant instances of a specified class from the\n' - 'specified package, and outputs JSON like the following:', - ) - ..addSeparator(''' - { - "constantInstances": [ - { - "codePoint": 59470, - "fontFamily": "MaterialIcons", - "fontPackage": null, - "matchTextDirection": false - } - ], - "nonConstantInstances": [ - { - "file": "file:///Path/to/hello_world/lib/file.dart", - "line": 19, - "column": 11 - } - ] - }''') - ..addSeparator( - 'Where the "constantInstances" is a list of objects containing\n' - 'the properties passed to the const constructor of the class, and\n' - '"nonConstantInstances" is a list of source locations of non-constant\n' - 'creation of the specified class. Non-constant creation cannot be\n' - 'statically evaluated by this tool, and callers may wish to treat them\n' - 'as errors. The non-constant creation may include entries that are not\n' - 'reachable at runtime.', - ) - ..addSeparator('Required arguments:') - ..addOption( - 'kernel-file', - valueHelp: 'path/to/main.dill', - help: - 'The path to a kernel file to parse, which was created from the ' - 'main-package-uri library.', - mandatory: true, - ) - ..addOption( - 'class-library-uri', - mandatory: true, - help: 'The package: URI of the class to find.', - valueHelp: 'package:flutter/src/widgets/icon_data.dart', - ) - ..addOption( - 'class-name', - help: 'The class name for the class to find.', - valueHelp: 'IconData', - mandatory: true, - ) - ..addSeparator('Optional arguments:') - ..addFlag('pretty', negatable: false, help: 'Pretty print JSON output (defaults to false).') - ..addFlag('help', abbr: 'h', negatable: false, help: 'Print usage and exit') - ..addOption( - 'annotation-class-name', - help: - 'The class name of the annotation for classes that should be ' - 'ignored.', - valueHelp: 'StaticIconProvider', - ) - ..addOption( - 'annotation-class-library-uri', - help: - 'The package: URI of the class of the annotation for classes ' - 'that should be ignored.', - valueHelp: 'package:flutter/src/material/icons.dart', - ); - - final ArgResults argResults = parser.parse(args); - T getArg(String name) => argResults[name] as T; - - final String? annotationClassName = getArg('annotation-class-name'); - final String? annotationClassLibraryUri = getArg('annotation-class-library-uri'); - - final annotationClassNameProvided = annotationClassName != null; - final annotationClassLibraryUriProvided = annotationClassLibraryUri != null; - if (annotationClassNameProvided != annotationClassLibraryUriProvided) { - throw StateError( - 'If either "--annotation-class-name" or "--annotation-class-library-uri" are provided they both must be', - ); - } - - if (getArg('help')) { - stdout.writeln(parser.usage); - exit(0); - } - - final finder = ConstFinder( - kernelFilePath: getArg('kernel-file'), - classLibraryUri: getArg('class-library-uri'), - className: getArg('class-name'), - annotationClassName: annotationClassName, - annotationClassLibraryUri: annotationClassLibraryUri, - ); - - final encoder = getArg('pretty') ? const JsonEncoder.withIndent(' ') : const JsonEncoder(); - - stdout.writeln(encoder.convert(finder.findInstances())); -} diff --git a/engine/src/flutter/tools/const_finder/pubspec.yaml b/engine/src/flutter/tools/const_finder/pubspec.yaml deleted file mode 100644 index d19a5b16..00000000 --- a/engine/src/flutter/tools/const_finder/pubspec.yaml +++ /dev/null @@ -1,23 +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. - -name: const_finder -publish_to: none - -# Required for workspace support. -environment: - sdk: ^3.9.0-0 - -# This package is managed as part of the engine workspace. -resolution: workspace - -dependencies: - args: any - kernel: any - -dev_dependencies: - collection: any - engine_repo_tools: any - path: any - test: any diff --git a/engine/src/flutter/tools/const_finder/test/const_finder_test.dart b/engine/src/flutter/tools/const_finder/test/const_finder_test.dart deleted file mode 100644 index aeb28388..00000000 --- a/engine/src/flutter/tools/const_finder/test/const_finder_test.dart +++ /dev/null @@ -1,332 +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. - -import 'dart:convert'; -import 'dart:io' as io; - -import 'package:engine_repo_tools/engine_repo_tools.dart'; -import 'package:kernel/const_finder.dart'; -import 'package:path/path.dart' as path; -import 'package:test/test.dart'; - -void main() { - final engine = Engine.findWithin(); - String? buildDir = io.Platform.environment['FLUTTER_BUILD_DIRECTORY']; - buildDir ??= engine.latestOutput()?.path.path; - if (buildDir == null) { - fail('No build directory found. Set FLUTTER_BUILD_DIRECTORY'); - } - - final String fixturesPath = path.join( - engine.flutterDir.path, - 'tools', - 'const_finder', - 'test', - 'fixtures', - ); - final String fixturesUrl = io.Platform.isWindows - ? '/$fixturesPath'.replaceAll(io.Platform.pathSeparator, '/') - : fixturesPath; - - final String frontendServerSnapshot = path.join( - buildDir, - 'gen', - 'frontend_server_aot.dart.snapshot', - ); - final String flutterPatchedSdk = path.join(buildDir, 'flutter_patched_sdk'); - final String librariesDotJson = path.join(flutterPatchedSdk, 'lib', 'libraries.json'); - final String packageConfig = path.join(fixturesPath, '.dart_tool', 'package_config.json'); - - final String dart = io.Platform.resolvedExecutable; - final String dartaotruntime = path.join( - path.dirname(io.Platform.resolvedExecutable), - 'dartaotruntime', - ); - - void compileAOTDill({required String sourcePath, required String dillPath}) { - final io.ProcessResult result = io.Process.runSync(dartaotruntime, [ - frontendServerSnapshot, - '--sdk-root=$flutterPatchedSdk', - '--target=flutter', - '--aot', - '--tfa', - '--packages=$packageConfig', - '--output-dill=$dillPath', - sourcePath, - ]); - printOnFailure(result.stdout.toString()); - printOnFailure(result.stderr.toString()); - if (result.exitCode != 0) { - fail('Failed to compile AOT dill'); - } - addTearDown(() => io.File(dillPath).deleteSync()); - } - - void compileDart2JSDill({required String sourcePath, required String dillPath}) { - final io.ProcessResult result = io.Process.runSync(dart, [ - 'compile', - 'js', - '--libraries-spec=$librariesDotJson', - '-Ddart.vm.product=true', - '-o', - dillPath, - '--packages=$packageConfig', - '--cfe-only', - sourcePath, - ]); - printOnFailure(result.stdout.toString()); - printOnFailure(result.stderr.toString()); - if (result.exitCode != 0) { - fail('Failed to compile Dart2JS dill'); - } - addTearDown(() => io.File(dillPath).deleteSync()); - } - - test('box_frontend (aot)', () { - final String sourcePath = path.join(fixturesPath, 'lib', 'box.dart'); - final String dillPath = path.join(fixturesPath, 'box_frontend.dill'); - compileAOTDill(sourcePath: sourcePath, dillPath: dillPath); - final finder = ConstFinder( - kernelFilePath: dillPath, - classLibraryUri: 'package:const_finder_fixtures/box.dart', - className: 'Box', - ); - - // Will timeout if we did things wrong. - jsonEncode(finder.findInstances()); - }); - - test('box_web (dart2js)', () { - final String sourcePath = path.join(fixturesPath, 'lib', 'box.dart'); - final String dillPath = path.join(fixturesPath, 'box_web.dill'); - compileDart2JSDill(sourcePath: sourcePath, dillPath: dillPath); - final finder = ConstFinder( - kernelFilePath: dillPath, - classLibraryUri: 'package:const_finder_fixtures/box.dart', - className: 'Box', - ); - - // Will timeout if we did things wrong. - jsonEncode(finder.findInstances()); - }); - - test('consts_frontend (aot)', () { - final String sourcePath = path.join(fixturesPath, 'lib', 'consts.dart'); - final String dillPath = path.join(fixturesPath, 'consts_frontend.dill'); - compileAOTDill(sourcePath: sourcePath, dillPath: dillPath); - - final { - 'constantInstances': List constantInstances, - 'nonConstantLocations': List nonConstantLocations, - } = ConstFinder( - kernelFilePath: dillPath, - classLibraryUri: 'package:const_finder_fixtures/target.dart', - className: 'Target', - ).findInstances(); - - expect( - constantInstances, - unorderedEquals([ - {'stringValue': '100', 'intValue': 100, 'targetValue': null}, - {'stringValue': '102', 'intValue': 102, 'targetValue': null}, - {'stringValue': '101', 'intValue': 101}, - {'stringValue': '103', 'intValue': 103, 'targetValue': null}, - {'stringValue': '105', 'intValue': 105, 'targetValue': null}, - {'stringValue': '104', 'intValue': 104}, - {'stringValue': '106', 'intValue': 106, 'targetValue': null}, - {'stringValue': '108', 'intValue': 108, 'targetValue': null}, - {'stringValue': '107', 'intValue': 107}, - {'stringValue': '1', 'intValue': 1, 'targetValue': null}, - {'stringValue': '4', 'intValue': 4, 'targetValue': null}, - {'stringValue': '2', 'intValue': 2}, - {'stringValue': '6', 'intValue': 6, 'targetValue': null}, - {'stringValue': '8', 'intValue': 8, 'targetValue': null}, - {'stringValue': '10', 'intValue': 10, 'targetValue': null}, - {'stringValue': '9', 'intValue': 9}, - {'stringValue': '7', 'intValue': 7, 'targetValue': null}, - {'stringValue': '11', 'intValue': 11, 'targetValue': null}, - {'stringValue': '12', 'intValue': 12, 'targetValue': null}, - {'stringValue': 'package', 'intValue': -1, 'targetValue': null}, - ]), - ); - expect(nonConstantLocations, isEmpty); - }); - - test('consts_web (dart2js)', () { - final String sourcePath = path.join(fixturesPath, 'lib', 'consts.dart'); - final String dillPath = path.join(fixturesPath, 'consts_web.dill'); - compileDart2JSDill(sourcePath: sourcePath, dillPath: dillPath); - - final { - 'constantInstances': List constantInstances, - 'nonConstantLocations': List nonConstantLocations, - } = ConstFinder( - kernelFilePath: dillPath, - classLibraryUri: 'package:const_finder_fixtures/target.dart', - className: 'Target', - ).findInstances(); - - expect( - constantInstances, - unorderedEquals([ - {'stringValue': '100', 'intValue': 100, 'targetValue': null}, - {'stringValue': '102', 'intValue': 102, 'targetValue': null}, - {'stringValue': '101', 'intValue': 101}, - {'stringValue': '103', 'intValue': 103, 'targetValue': null}, - {'stringValue': '105', 'intValue': 105, 'targetValue': null}, - {'stringValue': '104', 'intValue': 104}, - {'stringValue': '106', 'intValue': 106, 'targetValue': null}, - {'stringValue': '108', 'intValue': 108, 'targetValue': null}, - {'stringValue': '107', 'intValue': 107}, - {'stringValue': '1', 'intValue': 1, 'targetValue': null}, - {'stringValue': '4', 'intValue': 4, 'targetValue': null}, - {'stringValue': '2', 'intValue': 2}, - {'stringValue': '6', 'intValue': 6, 'targetValue': null}, - {'stringValue': '8', 'intValue': 8, 'targetValue': null}, - {'stringValue': '10', 'intValue': 10, 'targetValue': null}, - {'stringValue': '9', 'intValue': 9}, - {'stringValue': '7', 'intValue': 7, 'targetValue': null}, - {'stringValue': '11', 'intValue': 11, 'targetValue': null}, - {'stringValue': '12', 'intValue': 12, 'targetValue': null}, - {'stringValue': 'package', 'intValue': -1, 'targetValue': null}, - ]), - ); - - expect(nonConstantLocations, [ - {'file': 'file://$fixturesUrl/pkg/package.dart', 'line': 14, 'column': 18}, - ]); - }); - - test('consts_and_non_frontend (aot)', () { - final String sourcePath = path.join(fixturesPath, 'lib', 'consts_and_non.dart'); - final String dillPath = path.join(fixturesPath, 'consts_and_non_frontend.dill'); - compileAOTDill(sourcePath: sourcePath, dillPath: dillPath); - - final { - 'constantInstances': List constantInstances, - 'nonConstantLocations': List nonConstantLocations, - } = ConstFinder( - kernelFilePath: dillPath, - classLibraryUri: 'package:const_finder_fixtures/target.dart', - className: 'Target', - ).findInstances(); - - expect( - constantInstances, - unorderedEquals([ - {'stringValue': '1', 'intValue': 1, 'targetValue': null}, - {'stringValue': '4', 'intValue': 4, 'targetValue': null}, - {'stringValue': '6', 'intValue': 6, 'targetValue': null}, - {'stringValue': '8', 'intValue': 8, 'targetValue': null}, - {'stringValue': '10', 'intValue': 10, 'targetValue': null}, - {'stringValue': '9', 'intValue': 9}, - {'stringValue': '7', 'intValue': 7, 'targetValue': null}, - ]), - ); - expect(nonConstantLocations, [ - {'file': 'file://$fixturesUrl/lib/consts_and_non.dart', 'line': 14, 'column': 19}, - {'file': 'file://$fixturesUrl/lib/consts_and_non.dart', 'line': 16, 'column': 19}, - {'file': 'file://$fixturesUrl/lib/consts_and_non.dart', 'line': 16, 'column': 34}, - {'file': 'file://$fixturesUrl/lib/consts_and_non.dart', 'line': 17, 'column': 19}, - {'file': 'file://$fixturesUrl/pkg/package.dart', 'line': 14, 'column': 18}, - ]); - }); - - test('consts_and_non_web (dart2js)', () { - final String sourcePath = path.join(fixturesPath, 'lib', 'consts_and_non.dart'); - final String dillPath = path.join(fixturesPath, 'consts_and_non_web.dill'); - compileDart2JSDill(sourcePath: sourcePath, dillPath: dillPath); - - final { - 'constantInstances': List constantInstances, - 'nonConstantLocations': List nonConstantLocations, - } = ConstFinder( - kernelFilePath: dillPath, - classLibraryUri: 'package:const_finder_fixtures/target.dart', - className: 'Target', - ).findInstances(); - - expect( - constantInstances, - unorderedEquals([ - {'stringValue': '1', 'intValue': 1, 'targetValue': null}, - {'stringValue': '4', 'intValue': 4, 'targetValue': null}, - {'stringValue': '6', 'intValue': 6, 'targetValue': null}, - {'stringValue': '8', 'intValue': 8, 'targetValue': null}, - {'stringValue': '10', 'intValue': 10, 'targetValue': null}, - {'stringValue': '9', 'intValue': 9}, - {'stringValue': '7', 'intValue': 7, 'targetValue': null}, - {'stringValue': 'package', 'intValue': -1, 'targetValue': null}, - ]), - ); - - expect(nonConstantLocations, [ - {'file': 'file://$fixturesUrl/lib/consts_and_non.dart', 'line': 14, 'column': 19}, - {'file': 'file://$fixturesUrl/lib/consts_and_non.dart', 'line': 16, 'column': 19}, - {'file': 'file://$fixturesUrl/lib/consts_and_non.dart', 'line': 16, 'column': 34}, - {'file': 'file://$fixturesUrl/lib/consts_and_non.dart', 'line': 17, 'column': 19}, - {'file': 'file://$fixturesUrl/pkg/package.dart', 'line': 14, 'column': 18}, - ]); - }); - - test('static_icon_provider_frontend (aot)', () { - final String sourcePath = path.join(fixturesPath, 'lib', 'static_icon_provider.dart'); - final String dillPath = path.join(fixturesPath, 'static_icon_provider_frontend.dill'); - compileAOTDill(sourcePath: sourcePath, dillPath: dillPath); - final finder = ConstFinder( - kernelFilePath: dillPath, - classLibraryUri: 'package:const_finder_fixtures/target.dart', - className: 'Target', - annotationClassName: 'StaticIconProvider', - annotationClassLibraryUri: 'package:const_finder_fixtures/static_icon_provider.dart', - ); - - final { - 'constantInstances': List constantInstances, - 'nonConstantLocations': List nonConstantLocations, - } = finder - .findInstances(); - expect( - constantInstances, - unorderedEquals([ - {'stringValue': 'used1', 'intValue': 1, 'targetValue': null}, - {'stringValue': 'used2', 'intValue': 2, 'targetValue': null}, - ]), - ); - - // TODO(fujino): This should have non-constant locations from the use of - // a tear-off, see https://github.com/flutter/flutter/issues/116797 - expect(nonConstantLocations, isEmpty); - }); - - test('static_icon_provider_web (dart2js)', () { - final String sourcePath = path.join(fixturesPath, 'lib', 'static_icon_provider.dart'); - final String dillPath = path.join(fixturesPath, 'static_icon_provider_web.dill'); - compileDart2JSDill(sourcePath: sourcePath, dillPath: dillPath); - final finder = ConstFinder( - kernelFilePath: dillPath, - classLibraryUri: 'package:const_finder_fixtures/target.dart', - className: 'Target', - annotationClassName: 'StaticIconProvider', - annotationClassLibraryUri: 'package:const_finder_fixtures/static_icon_provider.dart', - ); - - final { - 'constantInstances': List constantInstances, - 'nonConstantLocations': List nonConstantLocations, - } = finder - .findInstances(); - expect( - constantInstances, - unorderedEquals([ - {'stringValue': 'used1', 'intValue': 1, 'targetValue': null}, - {'stringValue': 'used2', 'intValue': 2, 'targetValue': null}, - ]), - ); - - // TODO(fujino): This should have non-constant locations from the use of - // a tear-off, see https://github.com/flutter/flutter/issues/116797 - expect(nonConstantLocations, isEmpty); - }); -} diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/.dart_tool/package_config.json b/engine/src/flutter/tools/const_finder/test/fixtures/.dart_tool/package_config.json deleted file mode 100644 index b6392ddc..00000000 --- a/engine/src/flutter/tools/const_finder/test/fixtures/.dart_tool/package_config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "configVersion": 2, - "packages": [ - { - "name": "const_finder_fixtures", - "rootUri": "../lib/", - "languageVersion": "2.17" - }, - { - "name": "const_finder_fixtures_package", - "rootUri": "../pkg/", - "languageVersion": "2.17" - } - ] -} diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/.packages b/engine/src/flutter/tools/const_finder/test/fixtures/.packages deleted file mode 100644 index 0ef0f0b0..00000000 --- a/engine/src/flutter/tools/const_finder/test/fixtures/.packages +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by pub on 2020-01-15 10:08:29.776333. -const_finder_fixtures:lib/ -const_finder_fixtures_package:pkg/ \ No newline at end of file diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/lib/box.dart b/engine/src/flutter/tools/const_finder/test/fixtures/lib/box.dart deleted file mode 100644 index 51b2a5ed..00000000 --- a/engine/src/flutter/tools/const_finder/test/fixtures/lib/box.dart +++ /dev/null @@ -1,231 +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. - -// If canonicalization uses deep structural hashing without memoizing, this -// will exhibit superlinear time. - -// Compare with Dart version of this test at: -// https://github.com/dart-lang/sdk/blob/ca3ad264a64937d5d336cd04dbf2746d1b7d8fc4/tests/language_2/canonicalize/hashing_memoize_instance_test.dart - -class Box { - const Box(this.content1, this.content2); - final Object? content1; // ignore: unreachable_from_main - final Object? content2; // ignore: unreachable_from_main -} - -const Box box1_0 = Box(null, null); -const Box box1_1 = Box(box1_0, box1_0); -const Box box1_2 = Box(box1_1, box1_1); -const Box box1_3 = Box(box1_2, box1_2); -const Box box1_4 = Box(box1_3, box1_3); -const Box box1_5 = Box(box1_4, box1_4); -const Box box1_6 = Box(box1_5, box1_5); -const Box box1_7 = Box(box1_6, box1_6); -const Box box1_8 = Box(box1_7, box1_7); -const Box box1_9 = Box(box1_8, box1_8); -const Box box1_10 = Box(box1_9, box1_9); -const Box box1_11 = Box(box1_10, box1_10); -const Box box1_12 = Box(box1_11, box1_11); -const Box box1_13 = Box(box1_12, box1_12); -const Box box1_14 = Box(box1_13, box1_13); -const Box box1_15 = Box(box1_14, box1_14); -const Box box1_16 = Box(box1_15, box1_15); -const Box box1_17 = Box(box1_16, box1_16); -const Box box1_18 = Box(box1_17, box1_17); -const Box box1_19 = Box(box1_18, box1_18); -const Box box1_20 = Box(box1_19, box1_19); -const Box box1_21 = Box(box1_20, box1_20); -const Box box1_22 = Box(box1_21, box1_21); -const Box box1_23 = Box(box1_22, box1_22); -const Box box1_24 = Box(box1_23, box1_23); -const Box box1_25 = Box(box1_24, box1_24); -const Box box1_26 = Box(box1_25, box1_25); -const Box box1_27 = Box(box1_26, box1_26); -const Box box1_28 = Box(box1_27, box1_27); -const Box box1_29 = Box(box1_28, box1_28); -const Box box1_30 = Box(box1_29, box1_29); -const Box box1_31 = Box(box1_30, box1_30); -const Box box1_32 = Box(box1_31, box1_31); -const Box box1_33 = Box(box1_32, box1_32); -const Box box1_34 = Box(box1_33, box1_33); -const Box box1_35 = Box(box1_34, box1_34); -const Box box1_36 = Box(box1_35, box1_35); -const Box box1_37 = Box(box1_36, box1_36); -const Box box1_38 = Box(box1_37, box1_37); -const Box box1_39 = Box(box1_38, box1_38); -const Box box1_40 = Box(box1_39, box1_39); -const Box box1_41 = Box(box1_40, box1_40); -const Box box1_42 = Box(box1_41, box1_41); -const Box box1_43 = Box(box1_42, box1_42); -const Box box1_44 = Box(box1_43, box1_43); -const Box box1_45 = Box(box1_44, box1_44); -const Box box1_46 = Box(box1_45, box1_45); -const Box box1_47 = Box(box1_46, box1_46); -const Box box1_48 = Box(box1_47, box1_47); -const Box box1_49 = Box(box1_48, box1_48); -const Box box1_50 = Box(box1_49, box1_49); -const Box box1_51 = Box(box1_50, box1_50); -const Box box1_52 = Box(box1_51, box1_51); -const Box box1_53 = Box(box1_52, box1_52); -const Box box1_54 = Box(box1_53, box1_53); -const Box box1_55 = Box(box1_54, box1_54); -const Box box1_56 = Box(box1_55, box1_55); -const Box box1_57 = Box(box1_56, box1_56); -const Box box1_58 = Box(box1_57, box1_57); -const Box box1_59 = Box(box1_58, box1_58); -const Box box1_60 = Box(box1_59, box1_59); -const Box box1_61 = Box(box1_60, box1_60); -const Box box1_62 = Box(box1_61, box1_61); -const Box box1_63 = Box(box1_62, box1_62); -const Box box1_64 = Box(box1_63, box1_63); -const Box box1_65 = Box(box1_64, box1_64); -const Box box1_66 = Box(box1_65, box1_65); -const Box box1_67 = Box(box1_66, box1_66); -const Box box1_68 = Box(box1_67, box1_67); -const Box box1_69 = Box(box1_68, box1_68); -const Box box1_70 = Box(box1_69, box1_69); -const Box box1_71 = Box(box1_70, box1_70); -const Box box1_72 = Box(box1_71, box1_71); -const Box box1_73 = Box(box1_72, box1_72); -const Box box1_74 = Box(box1_73, box1_73); -const Box box1_75 = Box(box1_74, box1_74); -const Box box1_76 = Box(box1_75, box1_75); -const Box box1_77 = Box(box1_76, box1_76); -const Box box1_78 = Box(box1_77, box1_77); -const Box box1_79 = Box(box1_78, box1_78); -const Box box1_80 = Box(box1_79, box1_79); -const Box box1_81 = Box(box1_80, box1_80); -const Box box1_82 = Box(box1_81, box1_81); -const Box box1_83 = Box(box1_82, box1_82); -const Box box1_84 = Box(box1_83, box1_83); -const Box box1_85 = Box(box1_84, box1_84); -const Box box1_86 = Box(box1_85, box1_85); -const Box box1_87 = Box(box1_86, box1_86); -const Box box1_88 = Box(box1_87, box1_87); -const Box box1_89 = Box(box1_88, box1_88); -const Box box1_90 = Box(box1_89, box1_89); -const Box box1_91 = Box(box1_90, box1_90); -const Box box1_92 = Box(box1_91, box1_91); -const Box box1_93 = Box(box1_92, box1_92); -const Box box1_94 = Box(box1_93, box1_93); -const Box box1_95 = Box(box1_94, box1_94); -const Box box1_96 = Box(box1_95, box1_95); -const Box box1_97 = Box(box1_96, box1_96); -const Box box1_98 = Box(box1_97, box1_97); -const Box box1_99 = Box(box1_98, box1_98); - -const Box box2_0 = Box(null, null); -const Box box2_1 = Box(box2_0, box2_0); -const Box box2_2 = Box(box2_1, box2_1); -const Box box2_3 = Box(box2_2, box2_2); -const Box box2_4 = Box(box2_3, box2_3); -const Box box2_5 = Box(box2_4, box2_4); -const Box box2_6 = Box(box2_5, box2_5); -const Box box2_7 = Box(box2_6, box2_6); -const Box box2_8 = Box(box2_7, box2_7); -const Box box2_9 = Box(box2_8, box2_8); -const Box box2_10 = Box(box2_9, box2_9); -const Box box2_11 = Box(box2_10, box2_10); -const Box box2_12 = Box(box2_11, box2_11); -const Box box2_13 = Box(box2_12, box2_12); -const Box box2_14 = Box(box2_13, box2_13); -const Box box2_15 = Box(box2_14, box2_14); -const Box box2_16 = Box(box2_15, box2_15); -const Box box2_17 = Box(box2_16, box2_16); -const Box box2_18 = Box(box2_17, box2_17); -const Box box2_19 = Box(box2_18, box2_18); -const Box box2_20 = Box(box2_19, box2_19); -const Box box2_21 = Box(box2_20, box2_20); -const Box box2_22 = Box(box2_21, box2_21); -const Box box2_23 = Box(box2_22, box2_22); -const Box box2_24 = Box(box2_23, box2_23); -const Box box2_25 = Box(box2_24, box2_24); -const Box box2_26 = Box(box2_25, box2_25); -const Box box2_27 = Box(box2_26, box2_26); -const Box box2_28 = Box(box2_27, box2_27); -const Box box2_29 = Box(box2_28, box2_28); -const Box box2_30 = Box(box2_29, box2_29); -const Box box2_31 = Box(box2_30, box2_30); -const Box box2_32 = Box(box2_31, box2_31); -const Box box2_33 = Box(box2_32, box2_32); -const Box box2_34 = Box(box2_33, box2_33); -const Box box2_35 = Box(box2_34, box2_34); -const Box box2_36 = Box(box2_35, box2_35); -const Box box2_37 = Box(box2_36, box2_36); -const Box box2_38 = Box(box2_37, box2_37); -const Box box2_39 = Box(box2_38, box2_38); -const Box box2_40 = Box(box2_39, box2_39); -const Box box2_41 = Box(box2_40, box2_40); -const Box box2_42 = Box(box2_41, box2_41); -const Box box2_43 = Box(box2_42, box2_42); -const Box box2_44 = Box(box2_43, box2_43); -const Box box2_45 = Box(box2_44, box2_44); -const Box box2_46 = Box(box2_45, box2_45); -const Box box2_47 = Box(box2_46, box2_46); -const Box box2_48 = Box(box2_47, box2_47); -const Box box2_49 = Box(box2_48, box2_48); -const Box box2_50 = Box(box2_49, box2_49); -const Box box2_51 = Box(box2_50, box2_50); -const Box box2_52 = Box(box2_51, box2_51); -const Box box2_53 = Box(box2_52, box2_52); -const Box box2_54 = Box(box2_53, box2_53); -const Box box2_55 = Box(box2_54, box2_54); -const Box box2_56 = Box(box2_55, box2_55); -const Box box2_57 = Box(box2_56, box2_56); -const Box box2_58 = Box(box2_57, box2_57); -const Box box2_59 = Box(box2_58, box2_58); -const Box box2_60 = Box(box2_59, box2_59); -const Box box2_61 = Box(box2_60, box2_60); -const Box box2_62 = Box(box2_61, box2_61); -const Box box2_63 = Box(box2_62, box2_62); -const Box box2_64 = Box(box2_63, box2_63); -const Box box2_65 = Box(box2_64, box2_64); -const Box box2_66 = Box(box2_65, box2_65); -const Box box2_67 = Box(box2_66, box2_66); -const Box box2_68 = Box(box2_67, box2_67); -const Box box2_69 = Box(box2_68, box2_68); -const Box box2_70 = Box(box2_69, box2_69); -const Box box2_71 = Box(box2_70, box2_70); -const Box box2_72 = Box(box2_71, box2_71); -const Box box2_73 = Box(box2_72, box2_72); -const Box box2_74 = Box(box2_73, box2_73); -const Box box2_75 = Box(box2_74, box2_74); -const Box box2_76 = Box(box2_75, box2_75); -const Box box2_77 = Box(box2_76, box2_76); -const Box box2_78 = Box(box2_77, box2_77); -const Box box2_79 = Box(box2_78, box2_78); -const Box box2_80 = Box(box2_79, box2_79); -const Box box2_81 = Box(box2_80, box2_80); -const Box box2_82 = Box(box2_81, box2_81); -const Box box2_83 = Box(box2_82, box2_82); -const Box box2_84 = Box(box2_83, box2_83); -const Box box2_85 = Box(box2_84, box2_84); -const Box box2_86 = Box(box2_85, box2_85); -const Box box2_87 = Box(box2_86, box2_86); -const Box box2_88 = Box(box2_87, box2_87); -const Box box2_89 = Box(box2_88, box2_88); -const Box box2_90 = Box(box2_89, box2_89); -const Box box2_91 = Box(box2_90, box2_90); -const Box box2_92 = Box(box2_91, box2_91); -const Box box2_93 = Box(box2_92, box2_92); -const Box box2_94 = Box(box2_93, box2_93); -const Box box2_95 = Box(box2_94, box2_94); -const Box box2_96 = Box(box2_95, box2_95); -const Box box2_97 = Box(box2_96, box2_96); -const Box box2_98 = Box(box2_97, box2_97); -const Box box2_99 = Box(box2_98, box2_98); - -Object confuse(Box x) { - try { - throw x; // ignore: only_throw_errors - } catch (e) { - return e; - } -} - -void main() { - if (!identical(confuse(box1_99), confuse(box2_99))) { - throw Exception('box1_99 !== box2_99'); - } -} diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart b/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart deleted file mode 100644 index 2afa8ca5..00000000 --- a/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts.dart +++ /dev/null @@ -1,76 +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. - -// ignore_for_file: prefer_const_constructors, unused_local_variable -import 'dart:core'; - -import 'package:const_finder_fixtures_package/package.dart'; - -import 'target.dart'; - -void main() { - const target1 = Target('1', 1, null); - const target2 = Target('2', 2, Target('4', 4, null)); - const target3 = Target('3', 3, Target('5', 5, null)); // should be tree shaken out. - target1.hit(); - target2.hit(); - - blah(const Target('6', 6, null)); - - const ignoreMe = IgnoreMe(Target('7', 7, null)); // IgnoreMe is ignored but 7 is not. - final ignoreMe2 = IgnoreMe(const Target('8', 8, null)); - final ignoreMe3 = IgnoreMe(const Target('9', 9, Target('10', 10, null))); - print(ignoreMe); - print(ignoreMe2); - print(ignoreMe3); - - createTargetInPackage(); - - final staticConstMap = StaticConstInitializer(); - staticConstMap.useOne(1); - - const extendsTarget = ExtendsTarget('11', 11, null); - extendsTarget.hit(); - const implementsTarget = ImplementsTarget('12', 12, null); - implementsTarget.hit(); - - const mixedInTraget = MixedInTarget('13'); - mixedInTraget.hit(); -} - -class IgnoreMe { - const IgnoreMe(this.target); - - final Target target; - - @override - String toString() => target.toString(); -} - -class StaticConstInitializer { - static const List targets = [ - Target('100', 100, null), - Target('101', 101, Target('102', 102, null)), - ]; - - static const Set targetSet = { - Target('103', 103, null), - Target('104', 104, Target('105', 105, null)), - }; - - static const Map targetMap = { - 0: Target('106', 106, null), - 1: Target('107', 107, Target('108', 108, null)), - }; - - void useOne(int index) { - targets[index].hit(); - targetSet.skip(index).first.hit(); - targetMap[index]!.hit(); - } -} - -void blah(Target target) { - print(target); -} diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts_and_non.dart b/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts_and_non.dart deleted file mode 100644 index f06cae49..00000000 --- a/engine/src/flutter/tools/const_finder/test/fixtures/lib/consts_and_non.dart +++ /dev/null @@ -1,44 +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. - -// ignore_for_file: prefer_const_constructors, unused_local_variable -import 'dart:core'; - -import 'package:const_finder_fixtures_package/package.dart'; - -import 'target.dart'; - -void main() { - const target1 = Target('1', 1, null); - final target2 = Target('2', 2, const Target('4', 4, null)); - - final target3 = Target('3', 3, Target('5', 5, null)); // should be tree shaken out. - final target6 = Target('6', 6, null); // should be tree shaken out. - target1.hit(); - target2.hit(); - - blah(const Target('6', 6, null)); - - const ignoreMe = IgnoreMe(Target('7', 7, null)); // IgnoreMe is ignored but 7 is not. - final ignoreMe2 = IgnoreMe(const Target('8', 8, null)); - final ignoreMe3 = IgnoreMe(const Target('9', 9, Target('10', 10, null))); - print(ignoreMe); - print(ignoreMe2); - print(ignoreMe3); - - createNonConstTargetInPackage(); -} - -class IgnoreMe { - const IgnoreMe(this.target); - - final Target target; - - @override - String toString() => target.toString(); -} - -void blah(Target target) { - print(target); -} diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/lib/static_icon_provider.dart b/engine/src/flutter/tools/const_finder/test/fixtures/lib/static_icon_provider.dart deleted file mode 100644 index 11840397..00000000 --- a/engine/src/flutter/tools/const_finder/test/fixtures/lib/static_icon_provider.dart +++ /dev/null @@ -1,31 +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. - -import 'target.dart'; - -void main() { - Targets.used1.hit(); - Targets.used2.hit(); - final Target nonConstUsed3 = helper(Target.new); - nonConstUsed3.hit(); -} - -Target helper(Target Function(String, int, Target?) tearOff) { - return tearOff('from tear-off', 3, null); -} - -@staticIconProvider -class Targets { - static const Target used1 = Target('used1', 1, null); - static const Target used2 = Target('used2', 2, null); - static const Target unused1 = Target('unused1', 1, null); // ignore: unreachable_from_main -} - -// const_finder explicitly does not retain constants appearing within a class -// with this annotation. -class StaticIconProvider { - const StaticIconProvider(); -} - -const StaticIconProvider staticIconProvider = StaticIconProvider(); diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/lib/target.dart b/engine/src/flutter/tools/const_finder/test/fixtures/lib/target.dart deleted file mode 100644 index 821dade2..00000000 --- a/engine/src/flutter/tools/const_finder/test/fixtures/lib/target.dart +++ /dev/null @@ -1,50 +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. - -class Target { - const Target(this.stringValue, this.intValue, this.targetValue); - - final String stringValue; - final int intValue; - final Target? targetValue; - - void hit() { - print('$stringValue $intValue'); - } -} - -class ExtendsTarget extends Target { - const ExtendsTarget(super.stringValue, super.intValue, super.targetValue); -} - -class ImplementsTarget implements Target { - const ImplementsTarget(this.stringValue, this.intValue, this.targetValue); - - @override - final String stringValue; - @override - final int intValue; - @override - final Target? targetValue; - - @override - void hit() { - print('ImplementsTarget - $stringValue $intValue'); - } -} - -mixin MixableTarget { - String get val; - - void hit() { - print(val); - } -} - -class MixedInTarget with MixableTarget { - const MixedInTarget(this.val); - - @override - final String val; -} diff --git a/engine/src/flutter/tools/const_finder/test/fixtures/pkg/package.dart b/engine/src/flutter/tools/const_finder/test/fixtures/pkg/package.dart deleted file mode 100644 index 6a9011f8..00000000 --- a/engine/src/flutter/tools/const_finder/test/fixtures/pkg/package.dart +++ /dev/null @@ -1,16 +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. - -// ignore_for_file: prefer_const_constructors -import 'package:const_finder_fixtures/target.dart'; - -void createTargetInPackage() { - const target = Target('package', -1, null); - target.hit(); -} - -void createNonConstTargetInPackage() { - final target = Target('package_non', -2, null); - target.hit(); -} diff --git a/engine/src/flutter/tools/font_subset/BUILD.gn b/engine/src/flutter/tools/font_subset/BUILD.gn index 14d23cf6..37c3719d 100644 --- a/engine/src/flutter/tools/font_subset/BUILD.gn +++ b/engine/src/flutter/tools/font_subset/BUILD.gn @@ -54,15 +54,10 @@ zip_bundle("font_subset") { source = "$root_build_dir/$font_subset_bin" destination = font_subset_bin }, - { - source = "$root_gen_dir/const_finder.dart.snapshot" - destination = "const_finder.dart.snapshot" - }, ] deps = [ ":_font-subset", - "//flutter/tools/const_finder", ] if (is_mac) { deps += [ ":font_entitlement_config" ] diff --git a/engine/src/flutter/tools/gn b/engine/src/flutter/tools/gn index bb2bfb14..f26cbb74 100755 --- a/engine/src/flutter/tools/gn +++ b/engine/src/flutter/tools/gn @@ -562,11 +562,6 @@ def to_gn_args(args): gn_args['concurrent_toolchain_jobs'] = get_concurrent_jobs('1GB', '100MB') - # Hardcoding this avoids invoking a relatively expensive python script from - # GN, but removes the ability to use git-worktrees in the Dart checkout from - # within the Engine repo, but it's unlikely anyone is using that. - gn_args['default_git_folder'] = os.path.join(get_dart_path(), '.git') - # By default, the Dart GN build will invoke a relatively expensive python # script to calculate an SDK "hash" that ensures compatibility between the # Dart VM and the Dart front-end. This default hash calculation allows some diff --git a/examples/hello_world/analysis_options.yaml b/examples/hello_world/analysis_options.yaml index f9b30346..743e05ad 100644 --- a/examples/hello_world/analysis_options.yaml +++ b/examples/hello_world/analysis_options.yaml @@ -1 +1,10 @@ +analyzer: + exclude: + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml From 512315a944f91dd19eef5976b904ff9dd27827c1 Mon Sep 17 00:00:00 2001 From: Matej Knopp Date: Fri, 2 Oct 2026 21:16:02 +0200 Subject: [PATCH 2/2] Remove const_finder from pub_get_offline --- engine/src/flutter/tools/pub_get_offline.py | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/src/flutter/tools/pub_get_offline.py b/engine/src/flutter/tools/pub_get_offline.py index 2bc0f920..59e6e9e2 100644 --- a/engine/src/flutter/tools/pub_get_offline.py +++ b/engine/src/flutter/tools/pub_get_offline.py @@ -36,7 +36,6 @@ os.path.join(ENGINE_DIR, 'tools', 'build_bucket_golden_scraper'), os.path.join(ENGINE_DIR, 'tools', 'clang_tidy'), os.path.join(ENGINE_DIR, 'tools', 'clangd_check'), - os.path.join(ENGINE_DIR, 'tools', 'const_finder'), os.path.join(ENGINE_DIR, 'tools', 'engine_tool'), os.path.join(ENGINE_DIR, 'tools', 'gen_web_locale_keymap'), os.path.join(ENGINE_DIR, 'tools', 'githooks'),