* Restructure hot mode test so it runs interactively.
This allows to add a benchmark for hot reload after actual source code change.
* Add curly braces, refactory copyRecursive
This reverts commit 5e7bcbacf8.
`flutter run --benchmark` was triggering a different quick bailout path in the VM than `flutter run`. The failure has been fixed upstream.
* Fix restart flow for preview-dart-2 mode.
Restart in preview-dart-2 needs to use kernel file and it has to be complete, rather than incremental kernel file.
* Add curly braces
* Do full compile on restart
* Roll engine to pick up changes to hot reload for preview-dart-2
The initial loading happens on the host, which was building a script snapshot and allowing imports of dart:mirrors. Hot reload happens on the device, which then notices the imports and issues a compile-time error. This change causes programs with imports of dart:mirrors to be rejected during the initial load.
Fixes https://github.com/flutter/flutter/issues/12440
* Add hotReloadInitialDevFSSyncMilliseconds to track how long user have to wait before being able to do first reload.
This stat is significantly different between existing and preview-dart-2 setting (for the latter, this stat is ~3x slower: 13s vs ~4s).
* Remove ws
* Cleanup timer-related code
This reverts commit 90028813a8.
This change caused a few bots to fail with 'JSON-RPC error 110: Extension error', which is odd because _getUnusedChangesInLastReload is not an extension.
This CL introduces 2 hidden options to 'flutter build aot' and 'flutter run' for passing arbitrary arguments to front-end server and to gen_snapshot tool when building and running flutter app in --profile or --release modes.
The ability to pass arbitrary options simplifies various experiments, as it removes the need to change defaults and rebuild flutter engine for every tested configuration.
This class lives in the Context and allows callers to "inject"
flag values, where flag values are first extracted from the
command arguments, then from the global arguments as a fallback.
This makes command validation happen as part of `verifyThenRunCommand()`,
using a newly introduced protected method (`validateCommand()`) rather than
a `commandValidator` property (that subclasses were responsible for manually
invoking).
* Pin all dependencies ONCE AND FOR ALL
This replaces the secret `flutter update-packages --upgrade` with a destructive `flutter update-packages --force-upgrade` that actually goes and pins every dependency and transitive dependency in every flutter package to the same version.
* Add comments.
1. Migrate simulator device log tailing to os_log toolchain
2. When the log tag (component) is available (iOS 11/Xcode 9), filter to
the set of log lines with tag 'Flutter'.
As of iOS 11 / Xcode 9, Flutter engine logs are no longer recorded in the
simulator's syslog file, which we previously read using tail -f. Instead
they're now accessible through Apple's new macOS/iOS os_log facility,
via /usr/bin/log, which supports a relatively flexible query language.
When run in non-interactive mode, /usr/bin/log buffers its output in 4k
chunks, which is significantly smaller than what's emitted up to the
point where the observatory/diagnostics port information is logged. As a
workaround we force it to run in interactive mode via the script tool.
* Add --trace-skia parameter to flutter run
Skia tracing is extremely useful for internal debug, but reduces the
amount of space available in the Dart Timeline buffers.
Disable skia tracing by default and expose them via the --trace-skia
flag.
* Roll Engine to 57a1445a45964d386500c39f5e8d06db060abadb
This was introduced to suppress libMobileGestalt noise originating from
libsystem_asl.dylib. Commit 39680ebfbd
suppresses all application log messages not originating from the
app/engine iteself on iOS 10 and above. Since the log message in
question is only emitted on devices running iOS >= 10.3.0, this
blacklist no longer necessary.
On iOS 10 and above, suppress engine log messages from system components
other than Flutter. This eliminates a large amount of keyboard/plugin
related noise during edit-refresh development.
Checksum validation is intended only as a performance improvement.
Checksum de-serialization errors (typically framework version mismatch) are
expected on framework updates and shouldn't be user-visible except for
informational purposes when --verbose is set.
ios-deploy 1.9.2 includes fixes for a common source of Xcode breakage
(flutter/flutter#4326) with Xcode 8.3.3 + iOS 10.3.3, and is required to
to support Xcode 9 (flutter/flutter#11875).
Opening Xcode is no longer sufficient to enable develop mode in Xcode 9.
Update the message to run the command-line tool. Alternatively users can
launch an app in the Xcode debugger to do this.
Adds the app entrypoint as a key in the checksum file.
This change eliminates the assumption that checksummed files change when
the main entrypoint changes. In the case where there are two
entrypoints, a.dart and b.dart and a.dart imports b.dart and b.dart
imports a.dart, building the app with entrypoint a.dart followed by a
build of the app with entrypoint b.dart would result in the same
files list and checksums, but should invalidate the build.
This patch migrates iOS device listing from using Xcode instruments to
using the libimobiledevice tools idevice_id and ideviceinfo.
ideviceinfo was previously incompatible with iOS 11 physical devices;
this has now been fixed.
In 37bb5f1300 flutter_tools migrated from
libimobiledevice-based device listing on iOS to using Xcode instruments
to work around the lack of support for iOS 11. Using instruments entails
several downsides, including a significantly higher performance hit, and
leaking hung DTServiceHub processes in certain cases when a simulator is
running, necessitating workarounds in which we watched for, and cleaned
up leaked DTServiceHub processes. This patch returns reverts the move to
instruments now that it's no longer necessary.
Extract a Snapshotter class that can be shared between FLX snapshotting,
AOT snapshotting, and assembly AOT snapshotting. Allows for better
testability of snapshotting logic.
* Extracts script snapshotting used in FLX build.
* Adds tests for snapshot checksumming, build invalidation/skipping.
Remaining work: disentangle + extract AOT snapshotting and Assembly AOT
snapshotting logic from build_aot.dart.
This change re-introduces skipping AOT snapshot builds if input sources
and outputs have not changed since the last snapshot build, assuming a
build for the same platform in the same build mode.
This reverts commit 3d5afb5a81.
It includes the following changes relative to the original:
1. Include the entrypoint source in the checksums
2. include the build mode in the checksums
3. include the target platform in the checksums
This change ensures that snapshot build checksums used to avoid
duplicate builds are invalidated by a change to framework revision
(in case gen_snapshot is updated), as well as by build mode.
Currently, only FLX snapshotting uses checksums to avoid duplicate
builds. FLX snapshotting is always done with BuildMode.debug, so didn't
include build mode in the checksum file.
During FLX snapshotting, changes to (or absence of) any of the following
should trigger re-snapshot:
1. main() entrypoint source
2. transitive closure of sources reachable from the entrypoint source
3. the output snapshot
This patch supports basic filtering of log lines from physical iOS
devices, similar to existing functionality for iOS simulator logging.
This patch also suppresses the following two log messages which are
emitted at app startup on iOS 10.3 devices:
libMobileGestalt MobileGestaltSupport.m:153: pid 123 (Runner) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
Allows the user to specify the kind of project to create. The default is 'app'. Other choices are 'plugin' (the old '--plugin' behavior), and 'package'.
A Flutter 'package' is a Dart package that depends on Flutter, but does not contain native code.
Fixes#10377.
Bare bones widget inspector support.
Toggle the widget inspector from the flutter tool by pressing 'i'.
When the widget inspector is select mode:
Pointer down to to inspect a widget.
Pointer click to finalize selection of a widget. You can now interact
with the application as you normally would but with the inspected widget
highlighted.
Click the inspect icon in bottom left corner of screen to reactivate
select mode.
* Revert "Fix a typo in the saved certificate error message (#11640)"
This reverts commit bfda885a9d.
* Revert "Rollback patch that broke microbenchmarks (#11616)"
This reverts commit 70fe6f4c23.
* Revert "Extract snapshotting logic to Snapshotter class (#11591)"
This reverts commit 309a2d78fb.
* Revert "Minor whitespace formatting fix (#11590)"
This reverts commit bf69c3c69b.
* Revert "Avoid rebuilding snapshots if no change to source (#11551)"
This reverts commit 74835db563.
This change re-introduces skipping snapshot builds if input sources (and
outputs) have not changed since the last snapshot build, with a bugfix
to include the entry-point source in the checksum used to check whether
rebuild can be skipped. This ensures that the following sequence
invalidates the cached build, resulting in two snapshot builds:
flutter build ios lib/foo.dart
flutter build ios lib/bar.dart
This reverts commit 3d5afb5a81.
The output location of gen_snapshot differs based on the engine's target
platform, and we don't know the target platform when building a
platform-independent FLX in JIT mode.
This reverts commit e13e7806e3.
Turns out that with this patch, we aren't actually catching all
errors. For example, `flutter analyze --flutter-repo --watch` didn't
report errors in `dev/devicelab/test/adb_test.dart`.
* flutter analyze --watch auto detect if in flutter repo
* move isFlutterLibrary from AnalyzeOnce into AnalyzeBase for use by AnalyzeContinuously
* pass --flutter-repo to analysis server when analyzing the flutter repository
* enhance flutter analyze --watch to summarize public members lacking documentation
In
df8bf384eb
a new functionality of the Dart VM Service Protocol has been introduced.
Clients connected to the Service Protocol are now able to expose
services that other clients (e.g. Observatory) can invoke through the
Service Protocol itself.
With these changes Flutter Tools register them self as a `reloadSources`
(a.k.a. HotReload) capable client.
Observatory is already listening for the clients which expose this
functionality and uses by default the service based version of
`reloadSources` when available, so requesting a HotReload from
Observatory will trigger the full Flutter HotReload.
Related https://github.com/dart-lang/sdk/issues/30023
Related https://github.com/flutter/flutter/pull/11229
Related https://github.com/flutter/flutter/pull/11256
In some cases, we've seen interactions between Instruments and the iOS
simulator that cause hung instruments and DTServiceHub processes. If
enough instances pile up, the host machine eventually becomes
unresponsive.
Until the underlying issue is resolved, manually kill any orphaned
instances (where the parent process has died and PPID is 1) before
launching another instruments run.
Apply a 30 second timeout to Android/iOS device polling.
If there's a device poll already in progress, skip polling for new
devices; wait for the first request to return/timeout.
* Include the process' `stdout` and `stderr` when it returns a
non-zero exit code in `runCheckedAsync()`
* Defensively catch errors in `AndroidDevice.isAppInstalled()`
and return false
* report run target and if it is an emulator
* don't print debug
* rename parameter, remove unused variable
* fix test
* fix comment
* tweak from review, and fix analyzer error
* send custom parameters for the event, not the session
* fix mock
* use the +1 for usage
Previously, the snapshot file was recomputed on every build. We now
record checksums for all snapshot inputs (which are catalogued in the
snapshot dependencies file output alongside the snapshot) and only
rebuild if the checksum for any input file (or the previous output file) has
changed.
Previously, the snapshot file was recomputed on every build. We now
record checksums for all snapshot inputs (which are catalogued in the
snapshot dependencies file output alongside the snapshot) and only
rebuild if the checksum for any input file has changed.
* Only one call to createSnapshot exists, and it's in the same library.
* Eliminate conditional logic around the presence of depfilePath, the
only existing call always passes a non-null depfilePath.
Previously, xcodeMajorVersion and xcodeMinorVersion returned null unless
xcodeVersionSatisfactory had been called first. We now compute them on
demand, and cache the resultant values.
The main purpose of this PR is to make it so that when you set the
initial route and it's a hierarchical route (e.g. `/a/b/c`), it
implies multiple pushes, one for each step of the route (so in that
case, `/`, `/a`, `/a/b`, and `/a/b/c`, in that order). If any of those
routes don't exist, it falls back to '/'.
As part of doing that, I:
* Changed the default for MaterialApp.initialRoute to honor the
actual initial route.
* Added a MaterialApp.onUnknownRoute for handling bad routes.
* Added a feature to flutter_driver that allows the host test script
and the device test app to communicate.
* Added a test to make sure `flutter drive --route` works.
(Hopefully that will also prove `flutter run --route` works, though
this isn't testing the `flutter` tool's side of that. My main
concern is over whether the engine side works.)
* Fixed `flutter drive` to output the right target file name.
* Changed how the stocks app represents its data, so that we can
show a page for a stock before we know if it exists.
* Made it possible to show a stock page that doesn't exist. It shows
a progress indicator if we're loading the data, or else shows a
message saying it doesn't exist.
* Changed the pathing structure of routes in stocks to work more
sanely.
* Made search in the stocks app actually work (before it only worked
if we happened to accidentally trigger a rebuild). Added a test.
* Replaced some custom code in the stocks app with a BackButton.
* Added a "color" feature to BackButton to support the stocks use case.
* Spaced out the ErrorWidget text a bit more.
* Added `RouteSettings.copyWith`, which I ended up not using.
* Improved the error messages around routing.
While I was in some files I made a few formatting fixes, fixed some
code health issues, and also removed `flaky: true` from some devicelab
tests that have been stable for a while. Also added some documentation
here and there.
This allows us to take advantage of improved command-line tooling (e.g.,
improvements in device listing in Instruments). Now that the engine is
built with Xcode 8 and the framework is tested against Xcode 8, this
reduces the set of configurations we need to support to allow us to
focus on the supported ones: Xcode 8 and Xcode 9.
This reverts commit b2909a245a.
This resubmits the following patches:
1. Use Xcode instruments to list devices (#10801)
Eliminates the dependency on idevice_id from libimobiledevice. Instead,
uses Xcode built-in functionality.
2. Make device discovery asynchronous (#10803)
Migrates DeviceDiscovery.devices and all device-specific lookup to be
asynchronous.
* Revert "Make device discovery asynchronous (#10803)"
This reverts commit 972be9c8b4.
* Revert "Use Xcode instruments to list devices (#10801)"
This reverts commit 37bb5f1300.
This is to resolve a failure that looks related to a bad install of Xcode 8.0
on our build bots and should be reinstated when the infra issue is diagnosed
and resolved.
Instruments worked well when this was originally landed, and on the
following commit, but started failing two commits after this originally
landed. Manual invocation of instruments on the build host currently
results in:
```
dyld: Library not loaded: @rpath/InstrumentsAnalysisCore.framework/Versions/A/InstrumentsAnalysisCore
Referenced from: /Applications/Xcode8.0.app/Contents/Developer/usr/bin/instruments
Reason: image not found
Abort trap: 6
```
It appears the /Applications/Xcode8.0.app/Contents/Applications
directory (which contains Instruments) is missing on the host.
Moves all remaining calls to tools that are part of the libimobiledevice
suite of tools to the IMobileDevice class. This allows for better
tracking of this dependency, and easier mocking in tests.
Use a top-level getter in mac.dart rather than a static instance getter
and a top-level getter in ios_workflow.dart. Makes this code consistent
with how we do context lookups elsewhere.
Extract out IMobileDevice class, move class to idevice_id, ideviceinfo
(and eventually other libimobiledevice tools such as iproxy) behind this
interface.
Add tests for the case where libimobiledevice is not installed, the case
where it returns no devices, and the case where it returns device IDs.
Eliminates the need for the device/daemon code to get at the iOS/Android
tooling indirectly via Doctor. In tests, we now inject the workflow
objects (or mocks) directly.
This code is unused in any test. In upcoming changes that migrate to
Xcode instruments based device listing, we'll mock out the instruments
output separately.
* Before tests
* Add the part to trust the cert on the device
* flip the error checks since some are more specific and are more actionable
* add tests
* review
Eliminates nearly-duplicate install instructions for libimobiledevice,
ideviceinstaller.
Since ideviceinstaller depends on libimobiledevice, it's almost certain
that if libimobiledevice isn't installed, or needs updating, so does
ideviceinstaller.
This message will be emitted both when libimobiledevice requires
updating, or when it has not yet been installed.
It's also not specifically the version of Xcode that it's incompatible
with, it's the lockdownd daemon, which is actually more closely tied to
iTunes.
* Revert "Test installation status when ideviceid is not installed (#10254)"
This reverts commit 0e5d4a8771.
* Revert "Partial rollback of #10204 (#10256)"
This reverts commit b291bf5d6a.
Our emulator detection was based on a simple heuristic that was
failing for the Samsung Galaxy S8. Any heuristic is flawed since
Android devices can report whatever they want to adb, but this
change attempts to tighten the detection by listing known models
(by their ro.hardware property). Again, these values could be
spoofed by emulator system images, but it's less likely to be
an issue than with our previous (and fall-back) heuristic.
Fixes#10203
Related: #10248
* Remove '\n' from terminal input.
* Use trim instead of replaceAll
* Add unit test
* Cleanup the test
* Fixed lint
* Style adjustments
* Forgotten @override
* Revert "Forgotten @override"
Accidently added extra files.
This reverts commit 0aba24fc8e.
* Just @override change
* first pass
* improvements
* extract terminal.dart
* rebase
* add default terminal to context
* The analyzer wants the ../ imports in front of the ./ imports
* review notes
For some reaosn, when we discovered our URI, we were re-instantiating
the `Completer` instance variable whose future we listen to in `nextUri()`.
This led to a race between a caller calling `nextUri()` and us discovering
the URI. If we happened to discover our URI before a caller called
`nextUri()`, then they would be left waiting on a future from the newly
allocated `Completer` (which would never complete).
Fixes#10064
* blind wrote everything except the user prompt
* works
* Add some logical refinements
* Make certificates unique and add more instructinos
* print more info
* Add test
* use string is empty
* review notes
* some formatting around commands
* add a newline
Eagerly generate local.properties, and always update the flutter.sdk
setting in it, in case FLUTTER_ROOT has changed.
Fixes#8365.
Fixes#9716 - at least the specific issue reported. My Android Studio
still complains about Gradle versions - it ships with v3.2, but requires
v3.3...
Add a 'generate dependencies' task to the Gradle build, which checks if
the snapshot dependencies file exists, and runs an extra build before
the actual FlutterTask if it doesn't. This makes the first build slower,
but sub-sequent builds (without source changes) much faster.
Fixes#9717.
FlutterCommand.runCommand subclasses can optionally return a FlutterCommandResult which is used to append additional analytics.
Fix flutter run timing report and add a bunch of dimensional data
If the user specified a non-exact device id, it was producing
an exception whereby we were trying to listen to the
`getAllConnectedDevies()` stream twice.
`adb` can sometimes hang, which will in turn hang the Dart isolate if
we're using `Process.runSync()`. This changes many of the `Device` methods
to return `Future<T>` in order to allow them to use the async process
methods. A future change will add timeouts to the associated calls so
that we can properly alert the user to the hung `adb` process.
This is work towards #7102, #9567
There is a race where we could complete a future based on a stream event
and then before we cancel the stream subscription, we get another event
and try and complete the future again.
- [x] Switch the reassemble timeout to 5 seconds.
- [x] Print a status message if reassemble fails:
```
Performing hot reload...
Reassembling app.flx$main took too long. Hot reload may have failed.
Reloaded 0 of 418 libraries in 5,322ms.
```
Fixes#9316Fixes#8861Fixes#8857Fixes#8856
- [x] Catch SocketErrors and handle them gracefully.
- [x] Print 'Lost connection to device' when the service protocol connection is severed unexpectedly.
- [x] Print 'Application finished' when the application exits otherwise.
After this PR:
```
Launching lib/main.dart on Nexus 7 in debug mode...
Running 'gradle assembleDebug'... 1.2s
Built build/app/outputs/apk/app-debug.apk (21.7MB).
Syncing files to device...
Application finished.
DevFS sync failed. Lost connection to device: SocketException: OS Error: Connection refused, errno = 111, address = 127.0.0.1, port = 53062
Could not perform initial file synchronization.
```
Fixes#6705
- [x] Skip scanning the file system if we already have the Dart dependency set.
Fixes#9376
```
Performing hot reload...
Reloaded 1 of 418 libraries in 888ms.
Performing hot reload...
Reloaded 1 of 418 libraries in 871ms.
** UNTAR dragontail under project root **
Performing hot reload...
Reloaded 0 of 418 libraries in 443ms.
** UNTAR dragontail under lib/ **
Performing hot reload...
Reloaded 0 of 418 libraries in 385ms.
```
The first hot reload does a bunch of work that we used to hide behind the
loader screen. This PR changes the messsage printed to the user on the first
reload from:
'Performing hot reload...'
to:
'Initializing hot reload...'
Subsequent reloads say 'Performing hot reload...'
When invoked from the command line, relative paths aren't typically
used, but they are when invoked from within IDEA and prevents
IDEA from reading the files.
Also, remove flutterPackagesDirectory since it's not used
Generates an android.iml file and a package-level library for flutter.jar.
Does not set up an Android SDK in IDEA; this isn't possible with a
template-based approach. But IDEA shows a clear warning, so the
user can fix this by setting the SDK.
(When creating a Flutter project from within IDEA, we can fix this up
afterwards in the plugin.)
* Fix tests to use Ahem, and helpful changes around that
- Fix fonts that had metric-specific behaviours.
- LiveTestWidgetsFlutterBinding.allowAllFrames has been renamed
to LiveTestWidgetsFlutterBinding.framePolicy.
- LiveTestWidgetsFlutterBinding now defaults to using a frame policy
that pumps slightly more frames, to animate the pointer crosshairs.
- Added "flutter run --use-test-fonts" to enable Ahem on devices.
- Changed how idle() works to be more effective in live mode.
- Display the test name in live mode (unless ahem fonts are enabled).
- Added a toString to TextSelectionPoint.
- Style nit fixes.
* Roll engine to get Ahem changes.
* Update tests for dartdoc changes.
* Fix flutter_tools tests
Added a PluginRegistry to the new project template. The registry files will be automatically updated at build time to register the native plugins.
Fixes#7814.