Commit graph

137 commits

Author SHA1 Message Date
Lau Ching Jun 2acd0007d6
Refactor CustomDimensions in analytics to be type safe (#82531) 2021-05-18 20:29:03 -07:00
Jonah Williams 9218f09db7
[flutter_tools] remove some mocks from web resident runner tests (#82522) 2021-05-14 13:04:11 -07:00
Phil Quitslund 61c30c41b2
fix sort_directives violations (#80817) 2021-04-21 13:49:03 -07:00
Jonah Williams c09ace2724
[flutter_tools] Remove web specific vm_service handlers, move handler tests to single location (#80440) 2021-04-18 09:24:02 -07:00
Jonah Williams 9904a7f472
Refactor core resident runner logic (#80462) 2021-04-16 17:27:35 -07:00
Jenn Magder 16c73829a6
Migrate reporting library to null safety (#80320) 2021-04-15 17:01:34 -07:00
Jenn Magder a2f67720ef
Migrate test/src/common to null safety (#79907) 2021-04-06 22:55:03 -07:00
Sam Rawlins 68492c5b69
Remove "unnecessary" imports. (#78664) 2021-04-06 11:19:02 -07:00
Ben Konyi 75a44a29ad
[ Web ] Register service extensions with DDS, not DWDS (#79479) 2021-04-02 18:19:04 -07:00
Jonah Williams 430626d0f3
[flutter_tools] use existing service implementations for web (#78995) 2021-03-29 21:44:03 -07:00
Jenn Magder d018c24bb8
MockProcessUtils->FakeProcessManager in version_test (#77985) 2021-03-12 16:38:04 -08:00
Jonah Williams d39d450594
[flutter_tools] remove most globals from resident web runner (#77432) 2021-03-08 14:38:26 -08:00
Jonah Williams d14a9eaa8d
[flutter_tools] remove chrome launcher, analytics mock from web unit tests (#77066) 2021-03-02 15:29:03 -08:00
Jonah Williams a3b14c58ae
[flutter_tools] replace vm_service extension methods with wrapper class (#76721) 2021-02-24 15:40:33 -08:00
Sam Rawlins ba58ad0385
Remove "unnecessary" imports in test/general.shard (#75954) 2021-02-18 13:38:24 -08:00
Jonah Williams 04182572f7
[flutter_tools] allow bypassing context for FlutterProject creation, remove fromPath (#76258) 2021-02-18 12:36:04 -08:00
Jenn Magder 5b823cded8
Remove dead mock classes (#75757) 2021-02-10 17:01:28 -08:00
Jenn Magder 9236eefdff
MockPub -> FakePub (#75759) 2021-02-10 17:01:20 -08:00
Jonah Williams 74bd7b6f6d
[flutter_tools] opt all flutter tool libraries and tests out of null safety. (#74832)
* opt out the flutter tool

* oops EOF

* fix import

* Update tool_backend.dart

* Update daemon_client.dart

* fix more
2021-01-27 15:17:53 -08:00
Jonah Williams e599cdd414
[flutter_tools] fix web messaging (#74513) 2021-01-22 11:07:08 -08:00
Jonah Williams 1d3f697160
[flutter_tools] flag flip (#74444) 2021-01-22 09:29:57 -08:00
Jonah Williams 613a959878
only use code single path for verification of target file existence (#70962) 2020-11-20 14:17:11 -08:00
Angjie Li 2bbd004682
Support --web-renderer options which would allow user to specify which rendering backend to use. (#68848) 2020-10-28 17:32:09 -07:00
James D. Lin e4206ac5dd
[flutter tools] Add a DelegatingLogger class (#67581)
[flutter tools] Add a DelegatingLogger class

Move most of `DelegateLogger` `from test/src/testbed.dart` to
`lib/src/base/logger.dart` to better formalize the common practice of
chaining `Logger`s together.  I renamed the class since it isn't
itself the delegate and to better match the `Delegating...` classes
from `package:collection`.

Additionally, add a freestanding `asLogger<T>` function to "cast" a
`Logger` into a matching delegate if possible.  This will allow
`Logger` chains to be ordered a *bit* more freely (e.g.
`NotifyingLogger` and `AppRunLogger` will no longer required to be
at the end of the chain, an unwritten rule that has led to breakage in
google3).  Chain order still matters since lack of virtual dispatch
means that parent `Logger`s can never invoke child methods, however.

I made `asLogger<T>` a freestanding function because I didn't want to
make it part of the `Logger` interface (and I thought that making it
an extension method might be weird).

Bonus cleanup:
There no longer appears to be a way to construct an `AppRunLogger`
with a null parent, so remove all of code paths for that case and
make the `parent` construction parameter required.
2020-10-09 15:55:24 -07:00
Jonah Williams e819f292b3
[flutter_tools] do not require a dependency on devtools server (#66842)
Re-arrange the implementation of the devtools launcher so that google3 is not required to depend on any devtools packages. Also renames the build_runner folders to isolated to better clarify their intention.
2020-09-29 18:15:56 -07:00
Jonah Williams 511367aa5a
[flutter_tools] remove k toggle for canvaskit from web runner (#66273)
The k toggle allows switching between canvaskit and html backend at runtime. unfortunately this causes hot restart to break, since the dart_sdk modules stores state at runtime. The recommendation will be to use cavaskit via dart-defines.
2020-09-21 15:33:32 -07:00
Jonah Williams 3e838da96a
[flutter_tools] use flutter tool handler for dwds resources and precache tool pub dependencies (#65814)
If the tool is downloaded from a precompiled snapshot, or if the backing source files in the pub cache are deleted, the dwds debugging functionality will break as the client.js file cannot be located. Instead use the PackageConfig to verify that package location, downloading if it is missing.

Override the dwds middleware to avoid Isolate.resolvePackageUri

Fixes #53644
Fixes #65475
2020-09-17 15:22:06 -07:00
Jonah Williams 07caa0fbfe
[flutter_tools] Add plumbing for widget cache (#61766)
To support #61407 , the tool needs to check if a single widget reload is feasible, and then conditionally perform a fast reassemble.

To accomplish this, the FlutterDevice class will have a WidgetCache injected. This will eventually contain the logic for parsing the invalidated dart script. Concurrent with the devFS update, the widget cache will be updated/checked if a single widget reload is feasible. If so, an expression evaluation with the target type is performed and the success is communicated through the devFS result. An integration test which demonstrates that this works is already present in https://github.com/flutter/flutter/blob/master/packages/flutter_tools/test/integration.shard/hot_reload_test.dart#L86

Finally, when actually performing the reassemble the tool simply checks if this flag has been set and calls the alternative reassemble method.

Cleanups:

Remove modules, as this is unused now.
2020-07-20 14:03:44 -07:00
Jonah Williams d8b6fa153a
[flutter_tools] generate a synthetic flutter_gen package on pub get (#61261)
Allow configuring the flutter_manifest to support a synthetic package, this is done through flutter: generate: true.

When running pub get, insert a flutter_gen entry into the packages if it does not already exist. This points to .dart_tool/flutter_gen, which can be updated to contain the generated intl sources (But doesn't currently)

Adds an integration test that verifies this code can be run and imported when enabled.

Part of #60914
2020-07-15 10:12:52 -07:00
Dan Field eadc35f62b
Optionally invert oversized images (#61209)
* Optionally invert oversized images
2020-07-13 14:03:23 -07:00
Jenn Magder 20fe2f88c5
Prefer tear offs to lambdas in test expects (#61196) 2020-07-09 17:58:51 -07:00
Jonah Williams 7ca324ac01
[flutter_tools] support sound null-safety mode for the web (#60570)
In web debug mode, infer sound null safety by default. When sound null safety is enabled, provide a separate dill and precompiled Dart SDK. Release builds do not need this setting since we run dart2js from source.

Fixes #59873
2020-06-30 12:29:42 -07:00
Jonah Williams 2188196125
[flutter_tools] ensure flutter daemon can exit correctly when app fails to start (#60615)
The flutter daemon unconditionally waits for the appFinished signal, even if startup failed. Ensure this future is correctly completed if there is a failure in ResidentRunner.run and not just ResidentRunner.attach. Adds regression tests for run release, debug, debug web, and release web. Adds missing try catch in cold runner startup.

Manually tested with release/debug on Android and release/debug on web.

Fixes #60613
2020-06-30 12:26:18 -07:00
Jonah Williams e1538d1b88
[flutter_tools] last pass on general.shard unit tests (#60263)
Last batch of test fixes for general shard.
2020-06-26 13:36:06 -07:00
Jonah Williams 82a6f9bf0b
[flutter_tools] remove most use of global packages path (#60231)
The global packages path could cause tests to fail when it would be overriden to unexpected (in test setup) values. Remove most usage and make it a configuration on buildInfo, along with most other build information. Cleanup the asset builder to require the .packages path and the resident runners to no longer require it, since they already have the information in build_info.

It needs to stick around for the fuchsia deps we do not control.

Filled #60232 for remaining work.
2020-06-25 12:52:14 -07:00
Jonah Williams 5d61bff294
[flutter_tools] even more test fixes (#60156)
Fix tests broken under tester
2020-06-24 10:23:59 -07:00
Jonah Williams e1f4cfb4f4
[flutter_tools] add toggle b and service extension to change platform brightness (#59571)
A frequent request from the last Flutter developer survey was for an easier method of testing light/dark mode changes. Currently, a user needs to manually change the theme settings or adjust phone settings to see the difference. Instead we should add a toggle from the CLI, and eventually devtools/Intellij/Vscode that allows developers to override the current setting.

Fixes #59495

Adds flutter.ext.brightnessOverride service protocol which either queries the current platform brightness, or overrides it to a new value. This accepts either Brightness.light or Brightness.dark as a value.

Adds a CLI toggle b which allows the setting to be toggled manually.

Requires an update to the MediaQuery, to conditionally use a debug override when not in release mode
2020-06-18 10:32:43 -07:00
Helin Shiah e62c1f6954
Send text error in JSON and print in tools (#59018) 2020-06-09 11:18:03 -07:00
Jonah Williams 0620cfa770
Revert "Send text error in JSON and print in tools (#58994)" (#59002)
This reverts commit f0174b176a.
2020-06-08 11:56:23 -07:00
Jenn Magder 886313393f
Support work profiles and multiple Android users for run, install, attach, drive (#58815) 2020-06-08 11:28:02 -07:00
Helin Shiah f0174b176a
Send text error in JSON and print in tools (#58994)
* Revert "Revert "Send text error in JSON and print in tools (#58284)" (#58872)"

This reverts commit c2d5e18cb2.

* Put streamListen in try/catch if extension events already listened for
2020-06-08 11:24:23 -07:00
Jonah Williams c2d5e18cb2
Revert "Send text error in JSON and print in tools (#58284)" (#58872)
This reverts commit cce6b3c5ae.
2020-06-06 10:35:58 -07:00
Helin Shiah cce6b3c5ae
Send text error in JSON and print in tools (#58284)
* Send text error in JSON and print in tools

* Add test for error text

* Fix analysis issues

* Move streamListen to try/catch and use global.printStatus

* Extract print error fn and listen for events in web runner

* Add extension listen request to test

* Update packages/flutter_tools/lib/src/resident_runner.dart

Co-authored-by: Jonah Williams <jonahwilliams@google.com>

* Rename error parsing method

* Allow crash if listen for extension stream fails

* Add test for error and non-error extension events

* Fix formatting for TextTreeRenderer

* Use shorter message for second exceptions

* Specify types for map

* Add empty JSON for resident_web_runner test

* Move stream listen to vmservice and add vmservice test

* Fix stream type

* Move structured error log definition to vmservice

* Use correct test matcher isNot

Co-authored-by: Jonah Williams <jonahwilliams@google.com>
2020-06-05 19:07:37 -07:00
Jonah Williams e934c2fc0a
[flutter_tools] reland: copy dill after startup (#58455)
* [flutter_tools] only copy cached dill after startup

* shared code

* cleanup artifact directory

* do not copy if dillOutputPath is given
2020-06-04 10:17:43 -07:00
Jonah Williams 6135091de9
Revert "[flutter_tools] only copy cached dill after startup (#58188)" (#58454)
This reverts commit 39d1e4b7e9.
2020-06-01 17:17:03 -07:00
Jonah Williams 39d1e4b7e9
[flutter_tools] only copy cached dill after startup (#58188)
Remove copying from the shutdown stage since that seems risky. If the tool copies the first compilation there will still be a decent dill for initialization.
2020-06-01 16:31:27 -07:00
Bogdan Lukin 80a14af582
[flutter_tools] ensure track-widget-creation can be changed on devcompiler (#56564)
Workaround for cached web builds with --[no-]track-widget-creation flags.
Similar PR: #23299
2020-05-07 18:58:43 -07:00
Zachary Anderson 6f0ed5e142
[flutter_tools] Restore base/platform.dart (#56410) 2020-05-06 08:15:39 -07:00
Jonah Williams 9b7b9d795e
[flutter_tools] reland remove flutter view cache (#56387)
Fixes #56194

Remove caching of FlutterView and poll forever if the list of flutter views is empty. Added test for missing release mode logic.
2020-05-05 12:09:51 -07:00
Jonah Williams d98d3a973f
Revert "[flutter_tools] remove flutter view cache (#56223)" (#56385)
This reverts commit 209bdcb669.
2020-05-05 11:15:33 -07:00