|
| 1 | +diff --git a/ci/analyze.sh b/ci/analyze.sh |
| 2 | +index 9ee12a913..33d930238 100755 |
| 3 | +--- a/ci/analyze.sh |
| 4 | ++++ b/ci/analyze.sh |
| 5 | +@@ -32,6 +32,20 @@ if [ -n "$RESULTS" ]; then |
| 6 | + exit 1; |
| 7 | + fi |
| 8 | + |
| 9 | ++echo "Analyzing flutter_kernel_transformers..." |
| 10 | ++RESULTS=`dartanalyzer \ |
| 11 | ++ --packages=flutter/flutter_kernel_transformers/.packages \ |
| 12 | ++ --options flutter/analysis_options.yaml \ |
| 13 | ++ flutter/flutter_kernel_transformers \ |
| 14 | ++ 2>&1 \ |
| 15 | ++ | grep -Ev "No issues found!" \ |
| 16 | ++ | grep -Ev "Analyzing.+flutter_kernel_transformers"` |
| 17 | ++echo "$RESULTS" |
| 18 | ++if [ -n "$RESULTS" ]; then |
| 19 | ++ echo "Failed." |
| 20 | ++ exit 1; |
| 21 | ++fi |
| 22 | ++ |
| 23 | + echo "Analyzing tools/licenses..." |
| 24 | + (cd flutter/tools/licenses && pub get) |
| 25 | + RESULTS=`dartanalyzer \ |
| 26 | +diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter |
| 27 | +index ee13f32a1..b20158634 100644 |
| 28 | +--- a/ci/licenses_golden/licenses_flutter |
| 29 | ++++ b/ci/licenses_golden/licenses_flutter |
| 30 | +@@ -88,6 +88,7 @@ FILE: ../../../flutter/flow/texture.cc |
| 31 | + FILE: ../../../flutter/flow/texture.h |
| 32 | + FILE: ../../../flutter/flow/view_holder.cc |
| 33 | + FILE: ../../../flutter/flow/view_holder.h |
| 34 | ++FILE: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart |
| 35 | + FILE: ../../../flutter/fml/base32.cc |
| 36 | + FILE: ../../../flutter/fml/base32.h |
| 37 | + FILE: ../../../flutter/fml/base32_unittest.cc |
| 38 | +diff --git a/frontend_server/BUILD.gn b/frontend_server/BUILD.gn |
| 39 | +index 7d3dfd5f6..21660d297 100644 |
| 40 | +--- a/frontend_server/BUILD.gn |
| 41 | ++++ b/frontend_server/BUILD.gn |
| 42 | +@@ -22,6 +22,7 @@ if (is_fuchsia_host || is_fuchsia) { |
| 43 | + "//third_party/dart/pkg/front_end", |
| 44 | + "//third_party/dart/pkg/kernel", |
| 45 | + "//third_party/dart/pkg/vm", |
| 46 | ++ "//third_party/flutter/flutter_kernel_transformers", |
| 47 | + ] |
| 48 | + } |
| 49 | + |
| 50 | +@@ -60,6 +61,14 @@ if (is_fuchsia_host || is_fuchsia) { |
| 51 | + ], |
| 52 | + "list lines") |
| 53 | + |
| 54 | ++ frontend_server_files += |
| 55 | ++ exec_script("//third_party/dart/tools/list_dart_files.py", |
| 56 | ++ [ |
| 57 | ++ "absolute", |
| 58 | ++ rebase_path("../flutter_kernel_transformers"), |
| 59 | ++ ], |
| 60 | ++ "list lines") |
| 61 | ++ |
| 62 | + frontend_server_files += |
| 63 | + exec_script("//third_party/dart/tools/list_dart_files.py", |
| 64 | + [ |
| 65 | +diff --git a/frontend_server/lib/server.dart b/frontend_server/lib/server.dart |
| 66 | +index b3a61f181..9620a5de0 100644 |
| 67 | +--- a/frontend_server/lib/server.dart |
| 68 | ++++ b/frontend_server/lib/server.dart |
| 69 | +@@ -10,6 +10,7 @@ import 'dart:io' hide FileSystemEntity; |
| 70 | + import 'package:args/args.dart'; |
| 71 | + import 'package:path/path.dart' as path; |
| 72 | + |
| 73 | ++import 'package:flutter_kernel_transformers/track_widget_constructor_locations.dart'; |
| 74 | + import 'package:vm/incremental_compiler.dart'; |
| 75 | + import 'package:vm/frontend_server.dart' as frontend show FrontendCompiler, |
| 76 | + CompilerInterface, listenAndCompile, argParser, usage; |
| 77 | +@@ -20,8 +21,9 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface{ |
| 78 | + final frontend.CompilerInterface _compiler; |
| 79 | + |
| 80 | + _FlutterFrontendCompiler(StringSink output, |
| 81 | +- {bool unsafePackageSerialization}) : |
| 82 | ++ {bool trackWidgetCreation = false, bool unsafePackageSerialization}) : |
| 83 | + _compiler = frontend.FrontendCompiler(output, |
| 84 | ++ transformer: trackWidgetCreation ? WidgetCreatorTracker() : null, |
| 85 | + unsafePackageSerialization: unsafePackageSerialization); |
| 86 | + |
| 87 | + @override |
| 88 | +@@ -100,10 +102,8 @@ Future<int> starter( |
| 89 | + '--incremental', |
| 90 | + '--sdk-root=$sdkRoot', |
| 91 | + '--output-dill=$outputTrainingDill', |
| 92 | +- '--target=flutter', |
| 93 | +- '--track-widget-creation', |
| 94 | +- ]); |
| 95 | +- compiler ??= _FlutterFrontendCompiler(output); |
| 96 | ++ '--target=flutter']); |
| 97 | ++ compiler ??= _FlutterFrontendCompiler(output, trackWidgetCreation: true); |
| 98 | + |
| 99 | + await compiler.compile(Platform.script.toFilePath(), options); |
| 100 | + compiler.acceptLastDelta(); |
| 101 | +@@ -121,6 +121,7 @@ Future<int> starter( |
| 102 | + } |
| 103 | + |
| 104 | + compiler ??= _FlutterFrontendCompiler(output, |
| 105 | ++ trackWidgetCreation: options['track-widget-creation'], |
| 106 | + unsafePackageSerialization: options['unsafe-package-serialization']); |
| 107 | + |
| 108 | + if (options.rest.isNotEmpty) { |
| 109 | +diff --git a/frontend_server/pubspec.yaml b/frontend_server/pubspec.yaml |
| 110 | +index badc50e49..de6263ccd 100644 |
| 111 | +--- a/frontend_server/pubspec.yaml |
| 112 | ++++ b/frontend_server/pubspec.yaml |
| 113 | +@@ -12,6 +12,7 @@ dependencies: |
| 114 | + convert: any |
| 115 | + crypto: any |
| 116 | + front_end: any |
| 117 | ++ flutter_kernel_transformers: any |
| 118 | + kernel: any |
| 119 | + logging: any |
| 120 | + meta: any |
| 121 | +diff --git a/tools/generate_package_files.py b/tools/generate_package_files.py |
| 122 | +index 13399b126..39dc60d20 100644 |
| 123 | +--- a/tools/generate_package_files.py |
| 124 | ++++ b/tools/generate_package_files.py |
| 125 | +@@ -3,14 +3,16 @@ |
| 126 | + # Use of this source code is governed by a BSD-style license that can be |
| 127 | + # found in the LICENSE file. |
| 128 | + |
| 129 | +-# This script generates .packages file for frontend_server from Dart SDKs |
| 130 | +-# .packages file located in third_party/dart/.packages |
| 131 | ++# This script generates .packages file for frontend_server and |
| 132 | ++# flutter_kernel_transformers from Dart SDKs .packages file located in |
| 133 | ++# third_party/dart/.packages |
| 134 | + |
| 135 | + import os |
| 136 | + import shutil |
| 137 | + |
| 138 | + ALL_PACKAGES = { |
| 139 | +- 'frontend_server': [], |
| 140 | ++ 'frontend_server': ['flutter_kernel_transformers'], |
| 141 | ++ 'flutter_kernel_transformers': [], |
| 142 | + } |
| 143 | + |
| 144 | + SRC_DIR = os.getcwd() |
0 commit comments