Commit Graph

618 Commits

Author SHA1 Message Date
Chris Bracken
928bb1229b [tool] Consistent FakeProcessManager.run/runSync (#103947)
`FakeProcessManager` is a test-oriented implementation of `ProcessManager`
that simulates launching processes and returning `ProcessResult` objects
whose `exitCode`, `stdout`, `stderr` can be used to write platform-portable,
hermetic tests that don't rely on actually launching processes from
executables on disk. Its `run` and `runSync` methods provide asynchronous and
synchronous variants of this functionality.

Previously, the behaviour of `run` and `runSync` were inconsistent with
regards to the treatment of the `stdoutEncoding` (similarly,
`stderrEncoding`) parameters:

`run`:
* if the encoding was null, `ProcessResult.stdout` was returned as a
  String in UTF-8 encoding. This was incorrect. The behaviour as
  specified in `ProcessResult.stdout` is that in this case, a raw
  `List<int>` should be returned.
* If the encoding was unspecified, `ProcessResult.stdout` was returned as
  a `String` in the `io.systemEncoding` encoding. This was correct.
* If the encoding was non-null, `ProcessResult.stdout` was returned as a
  `String` in the specified encoding. This was correct.

`runSync`:
* if the encoding was null, `ProcessResult.stdout` was returned as a
  `List<int>` in UTF-8 encoding. This was incorrect. The behaviour as
  specified in `ProcessResult.stdout` is that in this case, a raw
  `List<int>` should be returned.
* If the encoding was unspecified, `ProcessResult.stdout` was returned as
  `List<int>` in UTF-8 encoding. This was incorrect. The behaviour as
  specified in `ProcessResult.stdout` is that in this case, a String a
  `String` in the `io.systemEncoding` encoding should be returned.
* if the encoding was non-null, `ProcessResult.stdout` was returned as a
  `String` in unknown (but probably UTF-8) encoding. This was incorrect.
  The behaviour as specified in `ProcessResult.stdout` is that in this
  case, a `String` in the specified encoding should be returned.

`_FakeProcess`, from which we obtain the fake stdout and stderr values now
holds these fields as raw `List<int>` of bytes rather than as `String`s. It
is up to the user to supply values that can be decoded with the encoding
passed to `run`/`runAsync`.

`run` and `runAsync` have been updated to set stdout (likewise, stderr) as
specified in the `ProcessResult` documentation.

This is pre-factoring for #102451, in which the tool throws an exception
when processing the JSON output from stdout of the `vswhere.exe` tool,
whose output was found to include the `U+FFFD` Unicode replacement
character during UTF-8 decoding, which triggers a `toolExit` exception
when decoded using our [Utf8Decoder][decoder] configured with `reportErrors` =
true. Because `FakeProcessManager.runAsync` did not previously invoke
`utf8.decode` on its output (behaviour which differs from the non-fake
implementation), it was impossible to write tests to verify the fix.

Ref: https://api.flutter.dev/flutter/dart-io/ProcessResult/stdout.html

Issue: https://github.com/flutter/flutter/issues/102451

[decoder]: fd312f1ccf/packages/flutter_tools/lib/src/convert.dart (L51-L60)
2022-05-17 11:15:54 -07:00
Jenn Magder
c6ced845e3 Remove custom unawaited, prefer dart:async version (#103212) 2022-05-07 08:49:04 -07:00
Alexandre Ardhuin
07f1c20474 add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
Jonah Williams
944fcda67f [flutter_tools] remove UWP tooling (#102174) 2022-04-26 11:19:07 -07:00
Jesús S Guerrero
3394fb4a58 [flutter_tools] fix flutter create --offline (#100941)
Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
2022-04-07 17:05:49 -07:00
Michael Goderbauer
dcde8163ce migrate to super params (#100509) 2022-03-31 11:46:47 -07:00
Brian Quinlan
f6c4c3df19 Remove unnecessary ignore: override_on_non_overriding_member (#99793) 2022-03-16 19:10:17 -07:00
Jenn Magder
dd97133df2 Remove tool crash git.io link shortener (#99574) 2022-03-08 17:00:06 -08:00
Jenn Magder
8f360c977a Update minimum required version to Xcode 13 (#97746) 2022-03-01 16:26:11 -08:00
Danny Tuppeny
76758ef960 [dap] Don't use --start-paused when running in Profile/Release mode (#98926) 2022-02-24 17:06:24 -08:00
Brian Quinlan
76855aa893 Add keyLog and connectionFactory to HttpClient implementations (#98045) 2022-02-11 00:35:16 -08:00
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
a599c23b2b Disallow running on unsupported devices (#97338) 2022-02-01 16:13:03 -08:00
Daco Harkes
0e2f51dfd0 FFI plugins (#96225) 2022-01-26 23:44:45 +01:00
Lau Ching Jun
1065826686 ProxiedDevice, connection to a remotely connected device via flutter daemon. (#95738)
Also allow daemon commands to pass binary streams
2022-01-25 23:46:14 -08:00
Zachary Anderson
65c6e88223 Revert "FFI plugins (#94101)" (#96122)
This reverts commit 5257f0290c.
2022-01-04 08:09:12 -08:00
Daco Harkes
5257f0290c FFI plugins (#94101)
* Building shared C source code as part of the native build for platforms Android, iOS, Linux desktop, MacOS desktop, and Windows desktop.
* Sample code doing a synchronous FFI call.
* Sample code doing a long running synchronous FFI call on a helper isolate.
* Use of `package:ffigen` to generate the bindings.
2022-01-04 10:14:27 +01:00
Danny Tuppeny
7e1e98c356 Add support for executing custom tools in place of Flutter for DAP (#94475) 2021-12-15 13:29:05 -08:00
Lau Ching Jun
8186fb7435 Use XML format in PlistParser (#94863)
* Switch to use xml in PlistParser

* Review feedbacks: Change dynamic to Object, remove getValueFromFile
2021-12-13 18:22:29 -08:00
Chris Wong
7ef5226799 Migrate to process 4.2.4 (#92630) 2021-11-30 17:14:07 -08:00
Christopher Fujino
e8ec8a0dfb [flutter_tools] Catch lack of flutter tools source missing (#93168) 2021-11-12 14:43:52 -08:00
Kenzie (Schmoll) Davisson
7748731903 Add DevTools version to flutter --version and flutter doctor -v output. (#93065)
* Add DevTools version to `flutter --version` output.

* review comments

* fix test

* add explanatory comment

* dummy commit to kick bots

Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
2021-11-11 14:40:22 -08:00
Jenn Magder
31933af486 Update minimum required version to Xcode 12.3 (#93094) 2021-11-05 16:08:04 -07:00
Jenn Magder
f4d1bfedd2 Migrate tracing to null safety (#92849) 2021-11-05 15:58:07 -07:00
Jenn Magder
9e88fe328e Remove globals_null_migrated.dart, move into globals.dart (#92861) 2021-11-01 17:18:03 -07:00
Yegor
ad7727a21c [web] enable CanvasKit tests using a local bundle fetched from CIPD (#92134) 2021-10-21 11:13:18 -07:00
Jenn Magder
1dbafdb53b Migrate protocol_discovery to null safety (#91267) 2021-10-12 12:13:02 -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
Ian Hickson
f25b833f27 Enable avoid_print lint. (#91444) 2021-10-07 16:48:04 -07:00
Mouad Debbar
c2ea78d231 Revert "Enable avoid_print lint. (#91332)" (#91438)
This reverts commit cb378edc9e.
2021-10-07 16:16:17 -04:00
Ian Hickson
cb378edc9e Enable avoid_print lint. (#91332) 2021-10-07 09:53:03 -07:00
Christopher Fujino
91dd3276fd migrate vm service to null safety (#88320) 2021-10-02 10:18:03 -07:00
Ian Hickson
4315cdcf76 Some test cleanup for flutter_tools. (#90227) 2021-10-01 10:38:02 -07:00
Ian Hickson
989f864497 Enable avoid_setters_without_getters (#91067) 2021-10-01 00:58:05 -07:00
Greg Spencer
01af8e5987 Make flutter update-packages run in parallel (#91006)
This modifies the flutter update-packages and flutter update-packages --force-upgrade commands so that the many invocations of "dart pub get" in each repo project run in parallel instead of in series.
2021-09-30 10:26:31 -07:00
Christopher Fujino
a2cd16ba82 use test logger, which does not allow colors (#90010) 2021-09-14 11:22:02 -07:00
Jenn Magder
d550d497f1 Migrate some flutter_tools tests to null safety (#88850) 2021-08-25 16:21:04 -07:00
Zachary Anderson
f0e832cdea [flutter_tool] Fix DesktopLogReader to capture all output (#88116) 2021-08-12 14:57:07 -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
Jenn Magder
a69b3ca5d3 Exclude arm64 from iOS app archs if unsupported by plugins (#87244) 2021-07-30 10:54:34 -07:00
Remi Rousselet
1995da2c0c Disable the automatic "pub get" if the project is using a third-party tool for linking dependencies. (#86177) 2021-07-19 08:06:03 -07:00
Jonah Williams
63a4013160 Revert "[flutter_tools] let the logger know about machine mode (#86116)" (#86363)
This reverts commit 53d8cba3ec.
2021-07-13 10:39:35 -07:00
Jonah Williams
53d8cba3ec [flutter_tools] let the logger know about machine mode (#86116) 2021-07-12 10:41:03 -07:00
Hannes Winkler
a1e9f2057f [custom-devices] general improvements, add custom-devices subcommand, better error handling (#82043) 2021-07-07 09:16:04 -07:00
Jonah Williams
88e756d19e [flutter_tools] well known device ids (#85184) 2021-06-24 18:46:04 -07:00
Jonah Williams
1e2753b741 [flutter_tools] remove all mocks from error handling io test (#84646) 2021-06-22 15:06:02 -07:00
Greg Spencer
88f3811055 Turn on avoid_dynamic_calls lint, except packages/flutter tests, make appropriate changes. (#84476)
This adds avoid_dynamic_calls to the list of lints, and fixes all instances where it was violated.

Importantly, this lint is NOT turned on for flutter/packages/test, because those changes are happening in another PR: #84478
2021-06-14 14:16:57 -07:00
Jonah Williams
67a57eb9a5 [flutter_tools] remove feature for alternative invalidation strategy (#84366) 2021-06-10 11:59:04 -07:00