On flutter run, we update ios/Flutter/Generated.xcconfig with various
Flutter-specific settings required by xcode_backend.sh during a build
from Xcode. These settings need to be present at the time the project is
loaded since Xcode doesn't pick up live updates to these files.
Without these settings, Xcode fails to locate xcode_backend.sh itself,
causing the build to fail until the Xcode project has been closed and
re-opened. This also prevents Xcode's project updater from 'helpfully'
suggesting to clean up and delete the Generated.xcconfig file.
* Make new project template gradle-based for Android.
With this change, the 'new project' template uses the same gradle-based build for Android as the hello_services example. This has some implications on build performance, since we're now building a complete Android app instead of just combining a pre-compiled .dex with the Flutter assets.
The very first build is a little over 2x slower, since it needs to download gradle and build the build scripts before getting to the actual code. Subsequent builds with changes to the code are comparable to the old builds. Null builds are faster. Enabling the gradle daemon speeds up subsequent builds by around 5s.
* Move Flutter Gradle plugin to Flutter root.
* Fix potential NPE in iOS doctor check
In case Xcode is not installed, the xcode-select path may be null.
* fixup! Fix potential NPE in iOS doctor check
If the developer has only installed the Xcode command-line tools,
xcode-select and some other tools may be present, but xcodebuild will be
missing. In this case, output a slightly improved message indicating
that the installation is incomplete rather than missing.
* Small Flutter strong mode cleanup fixes.
These are cases where strong mode down cast composite errors
generally indicated cases that would performance or correctness
issues if Flutter code was run in a strong mode VM.
* Fix Command API so that it is always in terms of Map<String,String>.
* Fix typedef
If ensureDirectoryExists fails -- e.g. because a file file of the same
name as the directory to be created exists, ensure that we exit cleanly
with a useful error message.
If the tool is started immediately after a previous run of the tool, then
the most recent log timestamp may come from the previous run's logs.
The new instance of the tool should not print those logs.
This was happening during runs of the microbenchmark script.
* Add doctor check for Python 'six' module
Required as part of Xcode lldb module. In all likelihood, if we
encounter this situation, the developer is using a custom Python install
(e.g., via MacPorts or Homebrew).
* Return null from VM.mainView if no view exists
* Retry in connectToServiceProtocol if a view is not yet available
* Do not explicitly call exit from the benchmarks - it will not cleanly shut down the engine
* Update gradle example to support x86 in debug mode.
Changed the Flutter Gradle plugin a bit to better fit in with the
Android build.
Fixes#6136Fixes#6864Fixes#7539
This remove a very brittle aspect of flutter drive, whereby it would
assume a known port instead of explicitly finding out what it was.
Fixes#7692 and hopefully fixes the devicelab tests.
Move the drive/run common stuff to RunCommandBase, rather than the
superclass which applies to everything.
Implement --no-resident (fixes
https://github.com/flutter/flutter/issues/5448). This is particularly
useful when running flutter from scripts.
Rename RunAndStayResident to ColdRunner.
* Add a check in case the flutter directory in .packages no longer exists. Clean up and prompt user
* Update documentation to use flutter packages get for end-users instead of flutter update-packages.
* Merge missing sdk error with the multiple sdk error. They're really the same thing.
* Use flutterPath in both checks.
* Change file_system’s copy folder to copy director which takes into account the file system
* Test support files
* Add test and split into 2 messages again.
* Move tests to run in memory file system's copy. Tested with dev/bots/test.sh
The zip files downloaded from cloud storage are not clearly separated
into engine artifacts and tools anyways.
Also, because of this unclear separation, we were downloading
`linux-x64/artifacts.zip` twice before.
* Change file_system’s copy folder to copy director which takes into account the file system
* Address review comments.
Test with 2 different instances of file systems.
Refactor DevFS so that it's easier to add new types of content such as kernel code
* add tests for DevFS package scanning
* add tests for DevFS over VMService protocol
* which covers _DevFSHttpWriter and ServiceProtocolDevFSOperations
* replace AssetBundleEntry and DevFSEntry with DevFSContent
* refactor to cleanup common code and replace some fields with locals
* rework .package file generation refactor away DevFSOperations.writeSource
* only update .package file if it has changed
* only write/delete/evict assets that have been changed/removed
Also, defer to test package for throttling (this will require a test
package update as well).
Also, add a lot more instrumentation to --verbose mode for tests, and
fix minor trivial things here and there, and add error handling in
more places.
Also, refactor how coverage works to be simpler and not use statics.
When a machine is heavily loaded, it can severely delay the time it
takes for the OS to start a process once it's asked to do so. Our
5 second timeout that we were giving the test process to connect
to the test harness seemed like plenty of time, were it not for the
fact that the test process itself was not being started in time when
CPU throttling was in effect.
This change updates the test timeout to begin counting only once the
test process has been started. We keep the original timeout in play
in the event that the test process *never* starts up for some reason,
but we up that timeout value to 5 minutes.
Stop building (unused) unlinked summaries for packages.
Improves update speed considerably (for `n` packages it saves us `n` needless calls to `pub get`).
Previously, it was possible for the test harness to bail
and the test runner to complete before the platform plugin
triggered the collection of coverage data. This fixes the
race condition such that the pending coverage collection
task is recorded immediately after starting the process.
As of Dart SDK 1.22.0-dev.5.0, `Process.exitCode` is no longer
mutable (that SDK version picks up e5a16b1ca5).
This change allows the tools code to pass analysis in sdk versions both
before and after that change, to allow for analysis against both the host and
target sdks.
We now produce a more reasonable error message when we're missing the
flutter_test dependency in a test. Also, remove the flutter_tools stack traces
when the engine dies.
Fixes#6187
Each stack trace will yield many async task stacks for every write request
that is in flight. If the device side is unresponsive and all writes are
failing, then this can generate an overwhelming amount of logs.
Fixes https://github.com/flutter/flutter/issues/7351
When a test runs to completion, the test harness closes the stream side of the
StreamChannel, causing the sink side to be closed as well. So by the time we
receive a test result of completed/harnessBailed, the controller sink has been
closed.
This removes direct file access from within flutter_tools
in favor of using `package:file` via a `FileSystem` that's
accessed via the `ApplicationContext`.
This lays the groundwork for us to be able to easily swap
out the underlying file system when running Flutter tools,
which will be used to provide a record/replay file system,
analogous to what we have for process invocations.
- [x] Introduce DependencyChecker which can determine if any dependencies have been modified.
- [x] Move the DartDependencyBuilder into a separate file.
- [x] Add unit tests for DartDependencyBuilder.
- [x] Add unit tets for DependencyChecker
Part of #7014
Without this, an FLX with no assets may be completely empty in AOT mode.
This will result in a warning when the engine's unzip library tries to
parse the FLX.
Fixes https://github.com/flutter/flutter/issues/7060
This fixes an infinite loop in the code that walks the parent
context chain looking for a variable.
This also includes a fix in build_info.dart whereby if the context
is set but the config is not yet set, we were trying to dereference
null.
* s/sky/flutter/ in Android templates
* update engine.version with a compatible engine version
* replace more SkyActivity references with FlutterActivity
This argument will enable mocking of os-layer process invocations,
where the mock behavior will come from replaying a previously-
recorded set of invocations. At the point of process invocation,
the key metadata for the invocation will be looked up in the
recording's manifest, and iff a matching record exists in the
manifest, the process will be mocked out with data derived from
the corresponding recorded process (e.g. stdout, stderr, exit code).
This moves the various copies of port forwarding code in the Device subclasses into the ProtocolDiscovery class.
* move port forwarding to a common location
* throw exception if protocol Uri is not discovered or port forwarding fails
* cancel discovery protocol subscriptions on iOS launches (wasn't happening before)
* fix iOS port forwarding to match other implementations
* add tests
It is not enabled by default in the VM because applications not launched via the tools may try to connect with the debugger. This causes the debugger and the IDE to hang on Mac.
* Add --record-to option to flutter tools
This option will cause flutter tools to record all process
invocations that occur and serialize their stdout and stderr
to files that get added to a "recording" ZIP file. This is
part of an effort to be able to test flutter tools in a hermetic
environment.
As a side-benefit, this recording should prove an excellent
attachment to any bug report.
With this change, they're run via instance methods on an object
obtained through the context. This will allow us to substitute
that object in tests with replay/record versions to allow us to
mock out the os-layer in tests.
- [x] Remove the two stage initial boot process.
- [x] Remove the loader screen app.
- [x] Don't report reload times for the initial reload because we are
switching from a snapshot to source and that will always be worst case.
- [x] Stop unnecessarily building the flx a second time on startup.
- [x] Stop unncessarily copying the flx to the device a second time on startup.
- [x] Remove `startBundle` and move logic into `startApp`.
* Allow for application-specific log readers.
When running with prebuilt application binaries, those applications
aren't guaranteed to be named "Runner" (as it is when we build
the app locally in Flutter tools)
* Remove the workaround that pinned args to v0.13.6
This reverts most of the changes in commit 6331b6c8b5
* throw exception if exit code is not an integer
* rework command infrastructure to throw ToolExit when non-zero exitCode
* convert commands to return Future<Null>
* cleanup remaining commands to use throwToolExit for non-zero exit code
* remove isUnusual exception message
* add type annotations for updated args package
* convert pubGet to throw ToolExit on non-zero exit code
* convert commandValidator to throw ToolExit for non-zero exit code
* convert flutter commands to throw ToolExit for non-zero exit code
* use convenience method throwToolExit
* only show "if this problem persists" for unusual exceptions
I was in here trying to figure out why we rebuild sky_services (the
answer is, because we rebuild every package we've ever downloaded, but
that's not really a problem for new users so whatever), and while I
was here I did some cleanup.
- [x] Remove the second full-sync on startup.
- [x] Always invoke the snapshotter to determine the minimal set of Dart sources used.
- [x] Only synchronize the *used* Dart sources to DevFS.
- [x] Detect syntax / file missing errors on the host and gate reloads / restarts.
This is causing issues when integratting Flutter into GN as the
generated depfile refers to snapshot as the target instead of the
bundle. We instead use a separate GN action to generate the
snapshot use the Flutter compiler to only assemble the bundle.
* merge `flutter skia` into `flutter screenshot`
* improve skia failed error message
* update help text - how to find diagnostic port for skia
* improve error message if skia capture fails
With the old policy the most recent log would not be printed until the next
log is produced (which may be indefinitely). This change prints logs
immediately along with a time delta since the previous log.
* Rollback commits to get iOS into a stable state
This rolls back the following commits:
* 23c52fc (#6434)
* a97cf4b (#6433)
* e72e174 (#6428)
It also updates the engine to a newer revision that has the
necessary rollbacks in the engine repo.
Fixes#6458
It takes a little bit longer that 10 seconds to install, launch and
have the observatory be available on an iPod touch. Depending on the
size of the application, it could be a lot longer to transer the
bundle over the wire. The 60 seconds is arbitrary.
Bump to latest Dart SDK dev build (`1.21.0-dev.0.0`).
* updates to analyzer w/ support for bazel workspaces
* removes deprecated analysis `cacheSize` variable access
Previously, overall status was reported as good if Xcode and homebrew
were installed, even if there were issues with either of the tools. We
now report partial status if we detect issues with either installation.
* Bump Dart SDK to `1.20.0-dev.10.0`.
`1.20.0-dev.10.0` corresponds to `1.20-RC0`.
* pubspec.lock cleanup
* check for pubspec.lock existence
* cleaned up conditional remove
libimobiledevice 1.2.0 is incompatible with Xcode >= 8.0. Since the
libimobiledevice tools don't include a --version flag, check for valid
exit code on running idevicename, if an iOS device is connected.
When using --use-application-binary:
- [x] Stop flutter run from checking for a pubspec.yaml in current directory
- [x] Stop flutter run from invoking pub get
- [x] Set 'shouldBuild' based on --use-application-binary
- [x] Stop requiring 'lib/main.dart' to be present before running.
- [x] Stop building an FLX when launching on Android
Ensure that we're monitoring logs before we launch the app on the
device. This prevents the case where we start monitoring after the ports
have already been logged.
Also update the regex to use an optional capture group.
With iOS 10, the syslog format changed from:
Sep 23 16:04:17 cbracken-iPhone Runner[6188] <Info>: .*
to:
Sep 23 16:04:17 cbracken-iPhone Runner(libsystem_asl.dylib)[6188] <Info>: .*
This updates the observatory port scraping to handle either case.
This rewrites imports of various mojom.dart files from the Flutter
engine repo to instead import normal-looking dart files from the
(new) flutter_services package. This package handles exporting the
correct symbols from generated code wherever that may live.
Includes an engine roll to 3551e7a48e2e336777b15c7637af92fd7605b6c5
which contains the new flutter_services package.
* Update tools to use `analyzer` from vended Dart SDK.
* updates `flutter_tools` and `flutter_test` to use the SDK-vended `analyzer` package
* tweaks dependency tracking logic to only record the SDK-vended `analyzer` so as not to crash on spurious conflicts (due to transitive dependencies)
* Review fixes.
* refactor _run to runCmd
* replace requiresProjectRoot getter with call to commandValidator
* replace requiresDevice getter with call to findTargetDevice
* trace command requires a debug connection, not a device
* inline androidOnly getter
* rename command methods to verifyTheRunCmd and runCmd
* move common verification into BuildSubCommand
* rename deviceForCommand to device
* rename methods to verifyThenRunCommand and runCommand
This moves all of the various .analysis_options* files to the flutter repo root so that it's easier to
* remember to keep them all in sync, and
* easily refer customers to them
This updates the flutter analyze command to use the .analysis_options_flutter_analyze in the repo root when either the --flutter-repo flag is supplied or the sources being analyzed reside in the flutter repo.