When switching between channels, we were leaving around the version freshness stamp file (bin/cache/flutter_version_check.stamp), which meant that the flutter tool would read from that file to see what the cached date of the most recent commit to the current channel (branch) was. The problem was that since the file was created while on the previous channel, the cached date was for the wrong channel, so if you switch from master to beta, flutter would think that the channel was out of date, and a new version was available, at least for three days after the first time it checked (after three days since the last time the freshness was checked, the cached date would get updated).
This PR modifies the channel command to remove that stamp file whenever the user switches channels, so that the cached date will be from the right channel when it is recreated.
Fixes#21134
This is a bit of a stab in the dark for a flake sometimes seen on bots (but I can't repro locally) #20822. Detaching from a Flutter app currently seems to terminate it, so it may be the cause of the "app not found" when trying to stop the app subsequently.
This change means we stop the app from the main process first, before terminating the attach process.
* Don't time out if process terminates when told to stop but response was not processed
While trying to reproduce #20822 I found a condition where the app may quit before the `app.stop` response is received but this code (which is called in integration test teardown) would sit around waiting and time out. With this change, the process exit is considered a valid response to the stop request.
* Add process exit to log for better errors in failures
This log can be turned on for debugging but is also dumped when a test fails (in certain conditions). With this in the log, it'll be clear if the timeout is because we're waiting for an event but the process quit.
This test is sometimes flaky (#20822) because the two processes try to stop the same app. This fix changes to just gracefully terminate the attach process without explicitly trying to stop and then uses the original spawning process to stop the app.
I can't repro the flake locally to be certain, but I've verified only one stop command is sent now so it *should* be good.
* Don't keep parsing results once we've had the event we expected
* Report errors if an app.stop event is received while waiting for another event
* Don't throw if we see app.stop event when we've just sent an app.stop request
* Improve debug print to include --start-paused if being used
* Improve wrapping
* `flutter analyze` cleanup
* Make `--dartdocs` work in all modes.
* Make `analyze-sample-code.dart` more resilient.
* Add a test for `analyze-sample-code.dart`.
* Minor cleanup in related code and files.
* Apply review comments
* Fix tests
* Fixes resulting from audit of issues links
I looked at every link to GitHub in our repo. For cases where we had a TODO that was waiting for a bug to be fixed, and the bug has now been fixed, I applied the pending change. For cases where the link was out of date, I updated the link.
* Update run_test.dart
skip this test again since it failed on linux and macos bots
All temporary directory start with `flutter_` and have their random component separated from the name by a period, as in `flutter_test_bundle.YFYQMY`.
I've tried to find some of the places where we didn't cleanly delete temporary directories, too. This greatly reduces, though it does not entirely eliminate, the directories we leave behind when running tests, especially `flutter_tools` tests.
While I was at it I standardized on `tempDir` as the variable name for temporary directories, since it was the most common, removing occurrences of `temp` and `tmp`, among others.
Also I factored out some common code that used to catch exceptions that happen on Windows, and made more places use that pattern.
* Reland "Roll engine to version b148e628ec86b3a9a0382e0bcfae73f0390a8232 (#20427)"
This is a re-land with downgraded `package:flutter_gallery_assets`
version.
* Downgrade package:flutter_gallery_assets to 0.1.4
* Change engine.version to 81baff97c29bb08cbf8453a3f9042c5813f84ad3 (which contains an additional fix)
* Change engine.version to e3687f70c7ece72000b32ee1b3c02755ba5361ac (since mac tarballs are corrupted on earlier commit)
Reason for revert: The package:flutter_gallery_assets has removed some images which are required for the examples/flutter_gallery, so the gallery build is failing (only discovered after landing, since gallery doesn't seem to get built during github PR presubmit checks)
This CL
* rolls `engine.version` to flutter/engine@b148e628 (which includes dart sdk 2.1.0-dev)
* rolls `goldens.version` to flutter/goldens@6c45fafdf (which includes updates due to skia changes in engine)
* changes `platform.dill` to `platform_strong.dill` in various places due to flutter/engine@a84b210b
* adds explicit `environment: sdk: ">=2.0.0-dev.68 < 3.0.0"` constraints to `pubspec.yaml` and `pubspec.yaml.tmpl` files (since pub defaults to `<2.0.0` if omitted)
* upgrades to newer versions of various 3rd party packages (to ensure transitive dependencies have `<3.0.0` sdk constraint)
* Upgrade everything except matcher.
* Roll matcher (and test)
* Adjust tests that depend on flutter:test directly to depend on a shim
* Require use of package:test shim and remove other references to package:test
* Skip tests instead of expecting failure, because expected failure = timeout which is slow
Some of these tests are known to fail and were coded to expect it; however because the failure is a timeout it's just dragging out test runs (shortening timeouts will make the tests flakier).
* Make it easier to find skipped tests
* Change SKIP to TODO
Disallow calling stop() or cancel() multiple times. This means that
when you use startProgress you have to more carefully think about what
exactly is going on.
Properly cancel startProgress in non-ANSI situations, so that
back-to-back startProgress calls all render to the console.
Disallow calling stop() or cancel() multiple times. This means that
when you use startProgress you have to more carefully think about what
exactly is going on.
Properly cancel startProgress in non-ANSI situations, so that
back-to-back startProgress calls all render to the console.
* Skip integration tests that use flutter-tester on Windows
This is known to be broken. I will un-skip all of these once a fix for flutter-tester lands on Windows.
* Save with added import!
* Add tests to ensure flutter run does not quit at startup
These tests require https://github.com/dart-lang/vm_service_client/pull/38 to be merged and currently the third test (pause-on-exceptions) fails because of a bug.
* Remove TODO
Probably makes most sense this way for now.
* Address PR comments
* Add `--dry-run` option to `flutter format` sub command
* Add `--set-exit-if-changed` option to `format` sub command
* Add `--machine` option to `format` sub command
* Make variable names to be not shorthand: cmd -> command
Fix https://github.com/flutter/flutter/pull/18360#discussion_r199656120
* Extract some of startApp into a reusable method
* Get basic attach --machine working
* Attach --machine tweaks
Move validation to validate method and create daemon early so we get the startup event before trying to get a connection.
* Bump daemon version so we know whether it's valid to flutter attach
* Tweak output text
* Swap package imports for relative
* Review tweaks (naming, formatting, typedefs)
* Separate arguments from process spawning
This will make calling attach easier
* Add a basic test for flutter attach --machine
* Fix crash if port unforward modifies the list of forwarded ports
* Add a no-op port forwarder for flutter-tester
* Switch to using BasicProject instead of our own inline code
* Fix expectation in test now we have a portForwarder
* Remove stale TODO (this is done)
* Tweak formatting
* Change some Completers to void to fix Dart 2 issues
* Make cleanup of flutter processes in tests more reliable
* Fix quit signals
I confused SigInt&SigTerm for SigTerm&SigKill when I first did this. SigTerm can be blocked and doesn't guarantee the process will be terminated.
* Don't use deprecated constants
* Fix typo
* Add some additional info to debug buffer
* Fix return types on Futures
* Only printError on our simple messages
Any other type is a real error that should be a normal crash (to get a proper error log).
See #19453.
* Add toList() to convert Iterable<String> -> List<String>
This code previously throw in Dart-2 mode.
Fixes#19453.
* Move getSimulatorPath into Xcode
* Add a test that we tried to launch the simulator
* Remove unused import
This uses @kevmoo's completion package to do command line completion for flutter, and a new command "bash-completion" (with alias "zsh-completion") that will output the necessary shell script setup code, and adds the hidden command "completion" that does the actual completion.
Because it adds a dependency, I also had to do flutter update-packages --force-upgrade.
Fixes#18988.
* Allow a longer timeout for app launches
* Include timings in errors when waiting for events
* Extract a helper that adds a timeout and includes message logging
* Ensure all timeouts include messages
* Ensure logs are set up before we invoke actions
* Ensure all messages are logged during timeout periods
This adds a new stream _allMessages that collects all output (as routed through debugPrint) and updates _timeoutWithMessages to use that instead of stdin/out of only the flutter run process (since that was missing stdin - the sends, and both input/output to the VM service).
* Revert "Revert "Roll engine to fed2ea458ed49088d33eddabc546ba56d600c717 (includes dart roll) (#19044)" (#19276)"
This reverts commit cf932490b7 as it also
includes fix for type error that broke tests.
* Add type cast for dart2 type checks.
* Move up to latest goldens
* Make inDirectory() type-parameterized.
* Add typecasting to transitions_perf_test.dart and microbenchmarks.
* Add boolean flag initialization in save_catalog_screenshots.dart
* Add type conversion to gallery transition test
ios-deploy relies on LLDB.framework, which relies on /usr/bin/python and
the 'six' module that's installed on the system. However, it appears to
use the first version of Python on PATH, rather than explicitly
specifying the system install. If a user has a custom install of Python
(e.g., via Homebrew or MacPorts) ahead of the system Python on their
PATH, LLDB.framework will pick up that version instead. If the user
hasn't installed the 'six' module, ios-deploy will fail with a
relatively cryptic error message.
This patch pushes /usr/bin to the front of PATH for the duration of the
ios-deploy run to avoid this scenario.
This patch also removes checks for package six.
Neither Flutter nor any of its direct dependencies/tooling relies on
package six. ios-deploy depends on LLDB.framework (included with Xcode),
which relies on a Python script that imports this package but uses
whichever Python is at the front of the path. Flutter now invokes
ios-deploy with a PATH with /usr/bin forced to the front in order to
avoid this problem.
We could have retained the check out of paranoia, but this seems
unnecessary since it's entirely possible LLDB.framework may one day drop
this dependency, in which case I'd expect the base system install of
Python would likely drop it as well.
* Roll engine to rolled dart
Add connectionTimeout property to class that extends HttpOverrides.
Upgrade packages.
Add more type fixes.
Update goldens hash.
Add more type fixes.
Upgrade packages.
Fix tests.
Remove strong-mode from analysis options yaml file.
Increase dev/devicelab timeout from 2 to 10 seconds.
Added getVM to waitForViews. Fix type errors in compileExpression.
* Pick up engine revision with fix for microbenchmarks regression.
Increase default timeout from 20/30 to 60s.
* Rename util -> test_utils
* Rename flutter_test_driver -> test_driver
* Switch testWithContext -> test
* Remove unused import
* Move test project into a class to make it easier to have multiple of these
Each "TestProject" class can contain its files and things like named breakpoint locations.
* Split expression evaluation tests into own file
* Include last response in error messages
* Update expectations based on current bugs
* Fix async-ness in tests
* Fix incorrect expectation in test
* Fix incorrect evaluations
* Remove skips for tests that are now passing on master
* Expect pass on Linux
🤷♂️
* Call the code
* Skip expression evaluation tests on Windows
* Skip whole group, not just one test
* Remove duplicated method from merge
* Fix misplaced close of group
* Remove code that was duplicated from test we copied
Not sure how this ended up in here?
* Re-fix typo
* Adding a setup function for hot restart that can be overwritten to perform any necessary initialization before a restart is started.
* Adding a test for setupHotRestart
* Removing local pubspec change
* Fixing some type annotation errors
* Responding to comments
This test was designed to ensure flutter_tester keeps running (previously it would quit immediately). However it's turned out ot be rather flaky and we have new tests on the way that supersede this by actually testing real things (debug stepping, reloading, expression evaluation).
* Remove the 'app' domain from flutter daemon
By default the daemon won't register the "app" domain, you need to opt-in (which the 'run' command does, as well as the tests for the app functionality).
Fixes#6658.
* Tweak text
* Put restart/callServiceExtension/stop back into daemon mode
* Add a comment about removing discoverApps
After landing the un-skip this test failed with a timeout. It then passed on the next build (!). I think it's too flaky to leave running until we can better diagnose what's happening.
* Add --create option to flutter emulators
* Tweaks to error message
* Simplify emulator search logic
* Make name optional
* Add a note about this option being used with --create
* Tweaks to help information
* Switch to processManager for easier testing
* Don't crash on missing files or missing properties in Android Emulator
* Move name suffixing into emulator manager
This allows it to be tested in the EmulatorManager tests and also used by daemon later if desired.
* Pass the context's android SDK through so it can be mocked by tests
* Misc fixes
* Add tests around emulator creation
Process calls are mocked to avoid needing a real SDK (and to be fast). Full integration tests may be useful, but may require ensuring all build environments etc. are set up correctly.
* Simplify avdManagerPath
Previous changes were to emulatorPath!
* Fix lint errors
* Fix incorrect file exgtension for Windows
* Fix an issue where no system images would crash
reduce throws on an empty collection.
* Fix "null" appearing in error messages
The name we attempted to use will now always be returned, even in the case of failure.
* Add additional info to missing-system-image failure message
On Windows after installing Andriod Studio I didn't have any of these and got this message. Installing with sdkmanager fixed the issue.
* Fix thrown errors
runResult had a toString() but we moved to ProcessResult when switching to ProcessManager to this ended up throwing "Instance of ProcessResult".
* Fix package import
* Fix more package imports
* Move mock implementation into Mock class
There seemed to be issues using Lists in args with Mockito that I couldn't figure out (docs say to use typed() but I couldn't make this compile with these lists still)..
* Rename method that's ambigious now we have create
* Handle where there's no avd path
* Add another toList() :(
* Remove comment that was rewritten
* Fix forbidden import
* Make optional arg more obviously optional
* Reformat doc
* Note that we create a pixel device in help text
* Make this a named arg
* Improve update checking
This change emables pinging the server to check for updates regardless of whether the local version is "out of date". The server code already has a 7-day cache so the result is that we can now ping the server once every 7 days instead of waiting for the local install to be 4 weeks out of date before pinging.
The original 4 week period is still used for when we'll start warning the user they're out of date if we could not confirm with the server whether there's a new version.
* Improve message when we know there's a new version available
* Fix bnullable bool checks
* Switch nullable bool to enum
* Fix casing of enum values
* Remove stale comment
The names are now descriptive so doesn't need additional explanation.
* Improve name of function
* Remove note:
* Rename kPauseToLetUserReadTheMessage -> timeToPauseToLetUserReadTheMessage
* Change kVersionAgeConsideredUpToDate to 5 weeks from 4
* Inline the isNewerFrameworkVersionAvailable check
* Fix indenting (?)
* Fix more indenting
* Rename function to be clearer it's getting the commit date
* Formating tweaks
* Update stamp when connection failed, and reduce time before we'll try again
Previously we would hit the server on every command if we thought we might be out of date and we never successfully connected (eg. if you're offline). This makes the stamp update even when there's a conneciton failure so that this won't happen, but reduces the time till we check again from 7 days to 3 days to compensate a little in case it was a one-off.
https://github.com/flutter/flutter/pull/18193#issuecomment-399222269
* Fix comment
* Don't perform update checks if not on an official channel
This test is failing on mac_bot (but passing elsewhere) because flutter-tester is apparently quitting earlier than expected. Locally it fails with an even weirder error and almost all tests are failing with "Compilation failed" (this isn't happening on the builds, so something is bad on my MacBook). Marking as skip to fix build while investigating; there's no real impact of this test not running; it's testing a tool that its itself used for testing (and not currently in any way that should be affected by this failure).
fuchsia_tester.dart still assumes Dart 1. Previously, it ran tests directly
from source, flutter_platform.dart automatically runs a kernel compile when
operating in Dart 2 mode, but this assumes a functional Dart SDK is available
in the artifacts directly, and fuchsia_tester.dart mocks out the artifacts
directory with an empty temp dir.
Remaining work is:
1. Get the frontend server building as a dependency on Fuchsia.
2. Patch fuchsia_tester.dart to use a valid Dart SDK and frontend server.
This also reverts migration to Dart 2 typedef syntax.
This reverts commit 6c56bb2. (#18362)
This reverts commit 3daebd0. (#18316)
Now that Dart 1 is turned off, reapplying my change to turn on the prefer_generic_function_type_aliases analysis option, and fix all the typedefs to Dart 2 preferred syntax.
Also eliminated the unused analysis_options_repo.yaml file and turned on public_member_api_docs in analysys_options.yaml.
No logic changes, just changing the typedef syntax for all typedefs, and updating analysis options.
* It's time to #deleteDart1 (#18293)
Eliminates support for Dart 1 in flutter_tools, and drops our Dart 1
benchmarks. All commands now run in Dart 1 mode only.
Eliminates --preview-dart-2 / --no-preview-dart-2 support.
* Fix indentation, remove no longer necessary .toList()
* Only push udpated kernel if >0 invalidated srcs
Eliminates support for Dart 1 in flutter_tools, and drops our Dart 1
benchmarks. All commands now run in Dart 1 mode only.
Eliminates --preview-dart-2 / --no-preview-dart-2 support.
Now that we have thousands of tests, it doesn't make sense to display a separate line for each test. The result is just megabytes of logs that you have to scrub through to find error messages.
Uses the `version` property from the `pubspec.yaml` file to set the corresponding fields in the `local.properties` file respectively in the `Generated.xcconfig` file.
The `--build-name` and `--build-number` options have changed. Now they trump the `version` property from the `pubspec.yaml` file.
If the `version` property is not set and the `--build-name` and `--build-number` options are not provided, the build command will not change the `local.properties` / `Generated.xcconfig` file.
* Send an event at startup with the protocol version and pid
The pid will help with some of the issues of terminate the process when launched through a shell script and the version will allow clients to make decisions about supported features.
I've also bumped the protocol version number for two reasons:
1. This change
2. We didn't increase it when we added the previous emulator commands
When running with --local-engine, build single-architecture apps, rather
than what's declared in the Xcode project.
By default, Flutter creates Xcode projects that generate universal
binaries supporting both armv7 and arm64 processors. Since local engine builds
are all single-architecture, override the Xcode project's ARCHS setting
with the appropriate value for the specific engine.
NOTE: this assumes engine paths consistent with those used in the engine
repo: 32-bit iOS engine builds end in _arm, 64-bit builds do not.
Previously, Flutter did not support iOS devices with armv7 or armv7s
CPUs. We now support these devices. This eliminates the previous
hardcoded checks that prevented running on simulators of older devices.
We maintain the existing restriction on running on watchOS or tvOS
simulators.
Previously, in non-release (i.e. profile) AOT builds, we were setting
--no-checked and --conditional_directives flags. --no-checked is the
default, and we don't make use of conditional directives in Flutter.
Allows users of Fingerprinter to filter the set of paths collected from
the explicitly-specified paths and those collected from depfiles.
In some cases, depfiles are emitted with files that are not present on
the local disk (e.g. the frontend compiler currently emits buildbot
paths for the dart core libraries and dart:ui). These files will not
materially affect whether we need to re-run a build action for which
they are inputs, since they're not present in the filesystem and
therefore cannot change.