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.
This yak shave went as follows:
Fix https://github.com/flutter/flutter/issues/8795 by adding stocks to
the examples README.
Notice the layers entry in that README isn't quite right either.
Update that.
Check the layers/README file is worth pointing at.
Update the layers/README.
Let's run some of the layer tests to see if they still work.
Oops, need to update them to gradle.
Ok let's try running them again.
Oops, sector is broken.
Add a test for sector.
Fix sector. Find you need to add an assert to a const constructor.
Notice we need to turn const asserts on for the analyzer.
Notice the analysis_options files are out of sync with each other and
with the full list of lints.
Turn on the lints that should be on.
Fix the bugs that finds.
Uninstalling the app removes the data and cache directories, so this
allows application data to persist across multiple flutter run
invocations.
This also handles the edge case where the app fails to install due to an
error in installation (e.g. debug keystore changes, switching from a
release keystore to a debug keystore, etc.).
Xcode builds depend on the Python 'six' module. If not present, exit
immediately with a useful error message.
The six module is included in the system default Python installation. We
perform this check in case a custom Python install has higher priority
on $PATH; e.g., due to a Homebrew or MacPorts installation.
This extracts an existing doctor check to use it during the build step
as well.
Plugin projects are created by running `flutter create --plugin <name>`.
An example app is also created in the plugin project, using the normal 'create' template, which has been modified to allow for conditional plugin code.
Modified the android package name to match package naming conventions (all lower-case, and must match the directory name).
* Bump to Dart SDK 1.23.0-dev.10
* allows us to understand flutter usage via telemetry
* brings in `@immutable`
Fixes: #9042
* completer fix
* Update to platform 1.1.1.
The very first time `pod install` is invoked, CocoaPods downloads the master spec repository, which takes quite a while. Before this change, the build appeared to have stalled. With this change, at least the spinner is moving.
Added `pod setup` to the install instructions for CocoaPods, so the spec repo is downloaded while setting up Flutter, instead of during the first build.
Old Android Stuio versions pior to 2.2.0 didn't come with Java bundled. Make sure flutter doesn't crash when we try to determine the Java version of those old Android Studio installations.
Go through all packages brought in by pub, and write the name and path of every one that is a flutter plugin into .flutter-plugins.
In android/settings.gradle and ios/Podfile, read in .flutter-plugins, if that file exists. The Android / iOS code from the plugins is automatically added as dependencies of the native code of the app.
**THIS IS A BREAKING CHANGE.** See below for migration steps for
existing projects.
Previously, Flutter app code was built as a raw dylib on iOS. Dynamic
libraries outside of a framework bundle are not supported on iOS, except
for the system Swift libraries provided by Xcode.
See:
https://developer.apple.com/library/content/technotes/tn2435/_index.html#//apple_ref/doc/uid/DTS40017543-CH1-TROUBLESHOOTING_BUNDLE_ERRORS-EMBEDDED__DYLIB_FILES
* Migrates Xcode build from app.dylib to App.framework
* Migrates flutter create template
* Migrates example projects
Migration steps for existing projects
=====================================
The following steps should be taken from the root of your Flutter
project:
1. Edit `ios/.gitignore`: add `/Flutter/App.framework` on a new line.
2. In the Xcode project navigator, remove `app.dylib` from the Flutter
folder. Delete this file from the `ios/Flutter` directory in your project.
3. Run a build to generate `ios/Flutter/App.framework`. From the command
line, run `flutter build ios`. If you have not configured app signing
in Xcode, an alternative method is to open the simulator, then run
`flutter run -d iP`.
4. In the Xcode project navigator, select the `Runner` project. In the
project settings that are displayed in the main view, ensure that the
`Runner` target is selected. You can verify this by exposing the
sidebar using the [| ] icon in the upper-left corner of the main
view.
5. Select the *General* tab in the project settings. Under the
*Embedded Binaries* section, click '+' to add `App.framework`. In the
sheet that drops down, click the *Add Other...* button. Navigate to
the `ios/Flutter` directory and select `App.framework`. Click *Open*.
In the sheet that drops down, select *Create folder references*, then
click *Finish*.
6. In the project settings, verify that `App.framework` has been added to the
*Embedded Binaries* and *Linked Frameworks and Libraries* lists.
7. In the Xcode project navigator, drag `App.framework` under the
Flutter folder.
8. In the Xcode project navigator, select `Flutter` then from the
*File* menu, select *Add Files to "Runner"...*. Navigate to the
`ios/Flutter` directory, select `AppFrameworkInfo.plist` and click
the *Add* button.
9. From the command line, in your project directory, run
`flutter build clean`, then `flutter run`.
At this point your project should be fully migrated.
* Teach flutter_tools to populate PUB_ENVIRONMENT
Will allow telemetry reporting on pub.dartlang.org once
flutter moves to 1.23.0-dev.10.0
* review changes