Because this class has some subtle behaviour with regards to control of
exit timing and when and how it streams data to stderr and stdout, it's
worth adding unit tests for this class directly, as well as (in a
followup patch) for FakeProcessManager.
This is additional testing relating to refactoring landed in:
https://github.com/flutter/flutter/pull/103947
Issue: https://github.com/flutter/flutter/issues/102451
`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)
* Provide flutter sdk kernel files to dwds launcher instead of dart ones
* Update log test to report all warnings
* Update licences for new files
* Addressed CR comments
* Addressed CR comments
* Implement trackpad gestures in framework
* Touch and Pan/Zoom pointers have separate IDs now
* Handle trackpad pointer device type
* Respect supportedDevices for pan/zoom events
* Update after rebase
* Fix check failures
* Avoid error with very short drags
* Address feedback
* Refactor drag event handler
* Address more feedback
* Add some missing punctuation
* Added a bool that allows us to limit debugProfileBuildsEnabled to user
created widgets.
* made it turned on by default
* switched to hashmap
* Cleaned everything up and added tests
* fixed an odd test where it wants to be able to add asserts and run in profile mode
* hixie feedback
* hixie2
* made it default to false
* updated docstring as per dans request
* Don't terminate Dart process pids from VM Service
These processes may be on another device, and in the case of attach the debugee should not be terminated anyway.
Previously, https://github.com/flutter/flutter/pull/100271 enabled
building universal macOS binaries by default, but included a bug causing
the arm64 App.framework to be built such that the TEXT section
containing the app instructions built by gen_snapshot incorrectly
contained x86_64 instructions rather than arm64 instructions.
When building macOS (and iOS) apps, Flutter builds them in three
components:
* The Runner application: built by Xcode
* The bundled App.framework: built from assembly code generated by
gen_snapshot from the application's Dart sources.
* The bundled FlutterMacOS.framework: built as part of the engine build
and packaged by copying the distributed binary framework from our
artifacts cache.
Building App.framework consists of the following steps:
* For each architecture, invoke gen_snapshot to generate
architecture-specific assembly code, which is then built to object
code and linked into an architecture-specific App.framework.
* Use the `lipo` tool to generate a universal binary that includes both
x86_64 and arm64 architectures.
Previously, we were building architecture specific App.framework
binaries. However, for all architectures we were (mistakenly) invoking
the general `gen_snapshot` tool (which emitted x64 instructions, and
which is now deprecated) instead of the architecture-specific
`gen_snapshot_x86` and `gen_snapshot_arm64` builds which emit
instructions for the correct architecture.
This change introduces a small refactoring, which is to split the
`getNameForDarwinArch` function into two functions:
* `getDartNameForDarwinArch`: the name for the specified architecture as
used in the Dart SDK, for example as the suffix of `gen_snapshot`.
* `getNameForDarwinArch`: the name for the specified architecture
as used in Apple tools, for example as an argument to `lipo`. For
consistency, and to match developer expectations on Darwin platforms,
this is also the name used in Flutter's build outputs.
Issue: https://github.com/flutter/flutter/issues/100348
This changes the default build architectures for Flutter macOS apps to
x86_64 and arm64. Previously, we manually excluded arm64 builds via the
EXCLUDE_ARCHS Xcode setting in Flutter's generated xcconfig file. This
eliminates setting EXCLUDE_ARCHS during the build and updates the
default architectures in the tool and in the macos_assemble.sh wrapper.
Issue: https://github.com/flutter/flutter/issues/97681
Umbrella issue: https://github.com/flutter/flutter/issues/60113
This fixes a race condition in test/integration.shard/cache_test.dart which allowed the test to fail if the machine took a very long time to acquire a lock or launch a process.
* Starts using the `--source` flag to compile the dart registrant.
* updated general.shard tests
* Fixed the resident compiler flow
* added integration test
* made the integration test self contained
* renamed generated_main to dart_plugin_registrant
* cleaned up for review
* added task runner for ci
* added bringup and TESTOWNERS
* updated failure message
* Fixed order dependency and removed no-shuffle-tag in build_ios_framework_test.dart
* Removed trailing spaces in build_ios_framework_test.dart
* Removed unnecessary formatting
* Update flutter_tools to look for new VM service message
The Dart SDK will soon move away from the current Observatory message:
"Observatory listening on ..."
To a new message that no longer references Observatory:
"Dart VM Service listening on ..."
This change updates all tests with mocks to check for the new message
and also adds support for the new message in ProtocolDiscovery.
See https://github.com/dart-lang/sdk/issues/46756
* Fix some parsing locations
* Fix analysis failures
* Update message
* Remove extra comment
* Update message
* Add globals prefix