Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Revert "Use track-widget-creation transformer included in the sdk. (#9085)" #9134

Merged

Conversation

jason-simmons
Copy link
Member

This reverts commit 651c904.

With this change applied, test/widgets/widget_inspector_test.dart is failing
when run by the dev/bots/test.dart script in the framework tree.

…lutter#9085)"

This reverts commit 651c904.

With this change applied, test/widgets/widget_inspector_test.dart is failing
when run by the dev/bots/test.dart script in the framework tree.
@jason-simmons jason-simmons requested a review from aam May 29, 2019 23:45
@jason-simmons
Copy link
Member Author

The change to the track-widget-creation transformer was causing failures in the framework test suite.
(example: https://api.cirrus-ci.com/v1/task/5921277928275968/logs/test.log)

To reproduce:

  • update bin/internal/engine.version to a commit that includes 651c904
  • delete packages/flutter/build/testfile.dill.track.dill if it exists from a previous run of the test suite
  • run dart --enable-asserts dev/bots/test.dart

test/widgets/widget_inspector_test.dart will show errors.

Interestingly, if you run dev/bots/test.dart again (with the testfile.dill.track.dill left over from the previous run) the test will succeed.

The test also runs as expected if you just run flutter test --track-widget-creation test/widgets/widget_inspector_test.dart instead of the full suite.

@terrylucas @jacob314 @aam

@jason-simmons jason-simmons merged commit 44f1b44 into flutter:master May 30, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 30, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 30, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request May 30, 2019
flutter/engine@8dc3a4c...4c4c0f8

git log 8dc3a4c..4c4c0f8 --no-merges --oneline
4c4c0f8 Add plugin shim to facilitate old plugins in new embedding (#33478). (flutter/engine#9120)
e8c2b17 Added support for transparent FlutterActivitys (#32740). (flutter/engine#9115)
19c5029 Roll src/third_party/skia 29e013deb476..1013ecfb3421 (3 commits) (flutter/engine#9130)
45d39e1 Revert "Roll src/third_party/dart fee615c5a5..d5405d06f4 (21 commits) (#9127)" (flutter/engine#9135)
44f1b44 Revert "Use track-widget-creation transformer included in the sdk. (#9085)" (flutter/engine#9134)
ae14c5a Roll src/third_party/dart fee615c5a5..d5405d06f4 (21 commits) (flutter/engine#9127)
3ea7ac8 Roll src/third_party/skia 633db4db7672..29e013deb476 (3 commits) (flutter/engine#9128)
8ad0e2f Roll src/third_party/skia 25b63f91b3b4..633db4db7672 (4 commits) (flutter/engine#9125)
37e6e0c Roll src/third_party/skia 8f88b2da05d5..25b63f91b3b4 (2 commits) (flutter/engine#9121)
37b367e Allow specifying both Dart and non-Dart fixtures in engine unit-tests. (flutter/engine#9113)
28f2c05 Roll src/third_party/skia 1f02e8488551..8f88b2da05d5 (3 commits) (flutter/engine#9116)
0932008 Remove outdated TODOs (flutter/engine#9114)
c880ca2 Roll src/third_party/dart 50b0d85804..fee615c5a5 (4 commits)
6e51513 Removing unused imports (flutter/engine#9108)
9ee2697 Roll src/third_party/skia d04aaa3a841a..1f02e8488551 (8 commits) (flutter/engine#9109)
fa2e2d9 Add checks to constructors and add missing constructor members (flutter/engine#9106)
7e1788a Fix unopt variants of profile and release builds. (flutter/engine#9107)
867120c Better help message. (flutter/engine#9097)
e27c6e8 Forward custom IDE flags to GN. (flutter/engine#9023)
6b4ca8d Roll src/third_party/skia 176b214f91bc..d04aaa3a841a (7 commits) (flutter/engine#9105)
a207318 Roll src/third_party/dart ec4d48e241..50b0d85804 (87 commits)
0a6aeb3 Roll src/third_party/skia 213aa46af167..176b214f91bc (2 commits) (flutter/engine#9100)
f2e22aa Roll src/third_party/skia 7730d7cb8fb2..213aa46af167 (3 commits) (flutter/engine#9098)
557db42 Roll src/third_party/skia de7e074e8190..7730d7cb8fb2 (2 commits) (flutter/engine#9096)
64a4a0e Roll src/third_party/skia f06b6d5469a5..de7e074e8190 (1 commits) (flutter/engine#9094)
fdee625 Roll src/third_party/skia 7e5a64f517e4..f06b6d5469a5 (2 commits) (flutter/engine#9093)
daf47f0 Roll src/third_party/skia dc01a84ae098..7e5a64f517e4 (1 commits) (flutter/engine#9092)
41e10f0 Fix internal break since listing contents can return null (flutter/engine#9078)
cf1b203 Roll src/third_party/skia f33c95cd6f55..dc01a84ae098 (3 commits) (flutter/engine#9091)
2404cdc Rename macOS FLEPlugin* to FlutterPlugin* (flutter/engine#9074)
509a43f Apply minor cleanups to Android embedding (flutter/engine#9088)
0a0f330 Removed outdated deprecation comments (flutter/engine#9087)
a44cbbf Delete BSDiff sources (flutter/engine#9086)
0f1ff3b Correct typos, adopt US spellings (flutter/engine#9081)
651c904 Use track-widget-creation transformer included in the sdk. (flutter/engine#9085)
cfa524f New Plugin API PR4: Adds Lifecycle support to the new plugin system. (flutter/engine#9049)
6b8ac18 Roll src/third_party/skia d9430297e74a..f33c95cd6f55 (5 commits) (flutter/engine#9082)
11408ef Update macOS podspec version requirement (flutter/engine#9077)
66c6ae4 Roll src/third_party/skia a4b837971c4b..d9430297e74a (30 commits) (flutter/engine#9080)
9151b37 Roll src/third_party/skia 9339a8a61af0..a4b837971c4b (34 commits) (flutter/engine#9076)
ee6a9c4 Fix unchecked operation warnings in FlutterMain (flutter/engine#9073)
333042c Roll third_party/dart/tools/sdks to 2.3.0 (flutter/engine#9072)
01b8c07 Roll src/third_party/skia f77dbd04b926..9339a8a61af0 (12 commits) (flutter/engine#9065)
26b4fb5 Roll src/third_party/dart e3edfd36b2..ec4d48e241 (7 commits)
9d2d58a Add mouse button support to the macOS shell (flutter/engine#9054)
...
@jacob314
Copy link
Contributor

Fyi @askeksa-google. I thought Terry landed this change 5 days ago. Did something change on the dart:sdk side that is causing it to fail now?
For example, did the flag to enable const canonicalization turn on?

@jacob314
Copy link
Contributor

Try removing the const
at
line 799 of widget_inspector_test.dart
and 859 of widget_inspector_test.dart
if removing those const fixes the two tests then that means something is not quite right with the kernel transformer running before the const evaluation assuming const evaluation was turned on in the cfe.

@jason-simmons
Copy link
Member Author

I believe the affected test started failing as soon as 651c904 landed. However, we didn't notice for a few days due to the weekend and because the engine->framework roller was failing earlier this week due to some unrelated CI errors.

@jason-simmons
Copy link
Member Author

The widget_inspector_test error still occurs if I remove const on those lines

@terrylucas
Copy link
Contributor

terrylucas commented May 31, 2019 via email

@jason-simmons
Copy link
Member Author

You can set bin/internal/engine.version to 651c90409ee7b8f43da7d1c60fcb172f1ad51901 to download an engine that includes that patch.

bin/internal/engine.version can be set locally to any commit from https://github.com/flutter/engine where an engine build completed successfully and was posted to cloud storage. Updates to bin/internal/engine.version will only be rolled into https://github.com/flutter/flutter if they passed the CI test suite. In this case, 651c90409ee7b8f43da7d1c60fcb172f1ad51901 was not committed to https://github.com/flutter/flutter because the widget_inspector_test failed.

@askeksa-google
Copy link

From the test failures it looks like the widget objects are not properly transformed. Is the track-widget-creation / trackWidgetCreation flag correctly passed when the front end is run from the widget inspector test?

Maybe the Flutter change did not account for this SDK change: dart-lang/sdk@b08397c

@jacob314
Copy link
Contributor

jacob314 commented Jun 4, 2019

@askeksa-google that patch from @mraleph should only apply to flutter engine b48c8b1 so I don't think that is it.
Additionally, the widget_inspector.dart test determines that --track-widget-creation is enabled by checking whether class Widget. Thus the test failure described suggests that package:flutter was compiled with --track-widget-creation enabled but the specific test case for some reason wasn't compiled with --track-widget-creation

Code used to determine whether to run tests that require --track-widget-creaiton.

  /// Returns whether [Widget] creation locations are available.
  ///
  /// [Widget] creation locations are only available for debug mode builds when
  /// the `--track-widget-creation` flag is passed to `flutter_tool`. Dart 2.0
  /// is required as injecting creation locations requires a
  /// [Dart Kernel Transformer](https://github.com/dart-lang/sdk/wiki/Kernel-Documentation).
  bool isWidgetCreationTracked() {
    _widgetCreationTracked ??= _WidgetForTypeTests() is _HasCreationLocation;
    return _widgetCreationTracked;
  }

That patch shouldn't

@terrylucas
Copy link
Contributor

Aske is there anything in the CFE/kernel transformer AST that might be in the dill file (or something that's not computed until there is a dill file?
As I run the failing test (first time the dill file is deleted) the tests will fail. After this failure all tests pass. As I debug the tests, when there's success, the location object is the file name of the widget that was created.

Vijay mentioned there a dill dump tool - I'm going to look at the dump. If you think it's interesting to see this dill file I'll attach it too.

@terrylucas
Copy link
Contributor

====================================
Run #1

Flutter test run w/o --track-widget-creation
cd flutter/packages/flutter
flutter test

inside of widget_inspector_test.dart the WidgetInspectorService's isWidgetCreationTracked() is false therefore this test is not compiled w/ track-widget-creation from the kernel transformer point of view.

====================================
Run #2

flutter test --track-widget-creation

inside of the widget_inspector_test.dart the WidgetInspectorService's isWidgetCreationTracked() is true so this test should have been compiled w/ track-widget-creation

There is a dill file generated testfile.dill.track.dill however the test fails because no creationLocation entry can be found (at the top-level same level as children) the getSelectedWidget JSON payload is:

  description: Text,
  type: _DiagnosticableTreeNode,
  style: dense,
  hasChildren: true,
  allowWrap: false,
  objectId: inspector-0,
  valueId: inspector-1,
  widgetRuntimeType: Text,
  children: [
    {description: RichText,
    type: _DiagnosticableTreeNode,
    style: dense,
    allowWrap: false,
    objectId: inspector-2,
    valueId: inspector-3,
    widgetRuntimeType: RichText,
    locationId: 1,
    creationLocation: {
      file: file:///Users/terry/flutter-engine2-git/flutter/packages/flutter/lib/src/widgets/text.dart,
      line: 386,
      column: 21,
      parameterLocations: [
        {file: null, line: 387, column: 7, name: textAlign},
        {file: null, line: 388, column: 7, name: textDirection},
        {file: null, line: 389, column: 7, name: locale},
        {file: null, line: 390, column: 7, name: softWrap},
        {file: null, line: 391, column: 7, name: overflow},
        {file: null, line: 392, column: 7, name: textScaleFactor},
        {file: null, line: 393, column: 7, name: maxLines},
        {file: null, line: 394, column: 7, name: strutStyle},
        {file: null, line: 395, column: 7, name: textWidthBasis},
        {file: null, line: 396, column: 7, name: text}]},
        children: []}
      ]}

====================================
Run #3

When the dill file is generated all run with --track-widget-creation works, a dump of the dill file shows that creationLocation field exist so the tests all run successfully e.g.,

  final wid::_Location creationLocation = wid::_getCreationLocation(value);

Notice after the dill is generated there is a creationLocation (at the same level as children prefix with **)

description: Text,
type: _DiagnosticableTreeNode,
style: dense,
hasChildren: true,
allowWrap: false,
objectId: inspector-0, 
valueId: inspector-1, 
widgetRuntimeType: Text, 
locationId: 10, 
** creationLocation: {file: file:///Users/terry/flutter-engine2-git/flutter/packages/flutter/test/widgets/widget_inspector_test.dart,
  line: 803,
  column: 15, 
  parameterLocations: [
    {file: null,
     line: 803, 
     column: 20, 
     name: data}
  ]
},
children: [
  {description: RichText, 
  type: _DiagnosticableTreeNode,
  style: dense,
  allowWrap: false,
  objectId: inspector-2,
  valueId: inspector-3,
  widgetRuntimeType: RichText,
  locationId: 4,
  creationLocation: {
    file: file:///Users/terry/flutter-engine2-git/flutter/packages/flutter/lib/src/widgets/text.dart,
    line: 386,
    column: 21,
    parameterLocations: [
      {file: null, line: 387, column: 7, name: textAlign},
      {file: null, line: 388, column: 7, name: textDirection},
      {file: null, line: 389, column: 7, name: locale},
      {file: null, line: 390, column: 7, name: softWrap},
      {file: null, line: 391, column: 7, name: overflow},
      {file: null, line: 392, column: 7, name: textScaleFactor},
      {file: null, line: 393, column: 7, name: maxLines},
      {file: null, line: 394, column: 7, name: strutStyle},
      {file: null, line: 395, column: 7, name: textWidthBasis},
      {file: null, line: 396, column: 7, name: text}]}, children: []}
    ]}

huqiuser pushed a commit to huqiuser/engine that referenced this pull request Jun 12, 2019
…lutter#9085)" (flutter#9134)

This reverts commit 651c904.

With this change applied, test/widgets/widget_inspector_test.dart is failing
when run by the dev/bots/test.dart script in the framework tree.
@askeksa-google
Copy link

Is there a plan to re-land this, now that the SDK issue is fixed by https://dart-review.googlesource.com/c/sdk/+/105661 ?

@terrylucas
Copy link
Contributor

terrylucas commented Jun 14, 2019 via email

kiku-jw pushed a commit to kiku-jw/flutter that referenced this pull request Jun 14, 2019
flutter/engine@8dc3a4c...4c4c0f8

git log 8dc3a4c..4c4c0f8 --no-merges --oneline
4c4c0f8 Add plugin shim to facilitate old plugins in new embedding (flutter#33478). (flutter/engine#9120)
e8c2b17 Added support for transparent FlutterActivitys (flutter#32740). (flutter/engine#9115)
19c5029 Roll src/third_party/skia 29e013deb476..1013ecfb3421 (3 commits) (flutter/engine#9130)
45d39e1 Revert &flutter#34;Roll src/third_party/dart fee615c5a5..d5405d06f4 (21 commits) (flutter#9127)&flutter#34; (flutter/engine#9135)
44f1b44 Revert &flutter#34;Use track-widget-creation transformer included in the sdk. (flutter#9085)&flutter#34; (flutter/engine#9134)
ae14c5a Roll src/third_party/dart fee615c5a5..d5405d06f4 (21 commits) (flutter/engine#9127)
3ea7ac8 Roll src/third_party/skia 633db4db7672..29e013deb476 (3 commits) (flutter/engine#9128)
8ad0e2f Roll src/third_party/skia 25b63f91b3b4..633db4db7672 (4 commits) (flutter/engine#9125)
37e6e0c Roll src/third_party/skia 8f88b2da05d5..25b63f91b3b4 (2 commits) (flutter/engine#9121)
37b367e Allow specifying both Dart and non-Dart fixtures in engine unit-tests. (flutter/engine#9113)
28f2c05 Roll src/third_party/skia 1f02e8488551..8f88b2da05d5 (3 commits) (flutter/engine#9116)
0932008 Remove outdated TODOs (flutter/engine#9114)
c880ca2 Roll src/third_party/dart 50b0d85804..fee615c5a5 (4 commits)
6e51513 Removing unused imports (flutter/engine#9108)
9ee2697 Roll src/third_party/skia d04aaa3a841a..1f02e8488551 (8 commits) (flutter/engine#9109)
fa2e2d9 Add checks to constructors and add missing constructor members (flutter/engine#9106)
7e1788a Fix unopt variants of profile and release builds. (flutter/engine#9107)
867120c Better help message. (flutter/engine#9097)
e27c6e8 Forward custom IDE flags to GN. (flutter/engine#9023)
6b4ca8d Roll src/third_party/skia 176b214f91bc..d04aaa3a841a (7 commits) (flutter/engine#9105)
a207318 Roll src/third_party/dart ec4d48e241..50b0d85804 (87 commits)
0a6aeb3 Roll src/third_party/skia 213aa46af167..176b214f91bc (2 commits) (flutter/engine#9100)
f2e22aa Roll src/third_party/skia 7730d7cb8fb2..213aa46af167 (3 commits) (flutter/engine#9098)
557db42 Roll src/third_party/skia de7e074e8190..7730d7cb8fb2 (2 commits) (flutter/engine#9096)
64a4a0e Roll src/third_party/skia f06b6d5469a5..de7e074e8190 (1 commits) (flutter/engine#9094)
fdee625 Roll src/third_party/skia 7e5a64f517e4..f06b6d5469a5 (2 commits) (flutter/engine#9093)
daf47f0 Roll src/third_party/skia dc01a84ae098..7e5a64f517e4 (1 commits) (flutter/engine#9092)
41e10f0 Fix internal break since listing contents can return null (flutter/engine#9078)
cf1b203 Roll src/third_party/skia f33c95cd6f55..dc01a84ae098 (3 commits) (flutter/engine#9091)
2404cdc Rename macOS FLEPlugin* to FlutterPlugin* (flutter/engine#9074)
509a43f Apply minor cleanups to Android embedding (flutter/engine#9088)
0a0f330 Removed outdated deprecation comments (flutter/engine#9087)
a44cbbf Delete BSDiff sources (flutter/engine#9086)
0f1ff3b Correct typos, adopt US spellings (flutter/engine#9081)
651c904 Use track-widget-creation transformer included in the sdk. (flutter/engine#9085)
cfa524f New Plugin API PR4: Adds Lifecycle support to the new plugin system. (flutter/engine#9049)
6b8ac18 Roll src/third_party/skia d9430297e74a..f33c95cd6f55 (5 commits) (flutter/engine#9082)
11408ef Update macOS podspec version requirement (flutter/engine#9077)
66c6ae4 Roll src/third_party/skia a4b837971c4b..d9430297e74a (30 commits) (flutter/engine#9080)
9151b37 Roll src/third_party/skia 9339a8a61af0..a4b837971c4b (34 commits) (flutter/engine#9076)
ee6a9c4 Fix unchecked operation warnings in FlutterMain (flutter/engine#9073)
333042c Roll third_party/dart/tools/sdks to 2.3.0 (flutter/engine#9072)
01b8c07 Roll src/third_party/skia f77dbd04b926..9339a8a61af0 (12 commits) (flutter/engine#9065)
26b4fb5 Roll src/third_party/dart e3edfd36b2..ec4d48e241 (7 commits)
9d2d58a Add mouse button support to the macOS shell (flutter/engine#9054)
...
terrylucas added a commit to terrylucas/engine that referenced this pull request Jul 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants