Commit Graph

151 Commits

Author SHA1 Message Date
Lau Ching Jun
d7688ca093
Change all instance of throwing strings to throw specific error classes. (#97325) 2022-02-02 10:45:18 -08:00
Jenn Magder
9e88fe328e
Remove globals_null_migrated.dart, move into globals.dart (#92861) 2021-11-01 17:18:03 -07:00
Ian Hickson
61a0add286
Enable avoid_redundant_argument_values lint (#91409) (#91462) 2021-10-08 09:25:14 -07:00
Zachary Anderson
b9d2177da0
Revert "Enable avoid_redundant_argument_values lint (#91409)" (#91461)
This reverts commit 5fd259be24.
2021-10-07 21:11:07 -07:00
Ian Hickson
5fd259be24
Enable avoid_redundant_argument_values lint (#91409) 2021-10-07 20:13:02 -07:00
stuartmorgan
64fd68ed42
Don't generate plugin registry in ResidentWebRunner (#91281)
* Don't generate plugin registry in ResidentWebRunner

generateDartPluginRegistry was being set to true unconditionally in
ResidentRunner, bypassing the primary check in
DartPluginRegistrantTarget, and the targetPlatform was not set in that
codepath, bypassing the second after the changes in
https://github.com/flutter/flutter/pull/87991. This caused web hot
restarts to be slower due to doing unnecessary work.

This ensures that generateDartPluginRegistry is false in the
ResidentWebRunner to skip that unnecessary step.

Fixes https://github.com/flutter/flutter/issues/91262

* Formatting

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
2021-10-05 12:27:53 -07:00
Ian Hickson
2bab6514b0
Enable avoid_implementing_value_types lint (#91078) 2021-10-04 13:48:04 -07:00
Ian Hickson
989f864497
Enable avoid_setters_without_getters (#91067) 2021-10-01 00:58:05 -07:00
stuartmorgan
97fb8c0560
Fix Dart plugin registrant interaction with 'flutter test' (#90288)
Building an application for a desktop platform that transitively included any Dart-based plugins (such as path_provider) broke `flutter test`, because its compilation was overriding the provided main (in this case, the test main) with `generated_main.dart` if it was present. This PR:
- Changes the `flutter test` compilation path to update `generated_main.dart`, so that the tests will work, and will include any registered Dart plugins.
- Makes using `generated_main.dart` during recompile opt-in, to try to reduce the chance of a similar bug happening with other codepaths in the future.

Fixes https://github.com/flutter/flutter/issues/88794
2021-09-30 20:25:13 -07:00
chunhtai
8d7068694b
Fixes resident_web_runner_test initialize the mock correctly (#90546) 2021-09-22 12:58:21 -07:00
Anna Gringauze
44d9af80cb
Flutter_tools for web: report error messages with stacks on exit (#87386)
* Flutter_tools for web platform: report error messages with stacks on toolExit

Print error messages and stacks in verbose mode before calling
`throwToolExit` on communication errors to chrome and dwds.

This will help us disagnose CI flakes:

Helps: https://github.com/flutter/flutter/issues/84012
Closes: https://github.com/flutter/flutter/issues/87149

* Added tests

* Extend timeout for testing failure to connect to chrome

* Update rest of chrome tests to await until matching is finished
2021-08-03 10:51:35 -07:00
Alexandre Ardhuin
80990c21e2
code formatting (#85783) 2021-07-07 23:06:05 -07:00
Jonah Williams
f2dcbbea1b
[flutter_tools] remove mockito from resident web runner tests (#84659) 2021-06-15 16:54:02 -07:00
Jonah Williams
6728cf34cc
[flutter_tools] remove more mocks from runner tests (#84312) 2021-06-10 12:00:38 -07:00
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