* Refactor for iOS.
* For android_xxx_unopt_arm64&ios_xxx_unopt_arm, remove the _arm64/_arm suffix.
dart generated in host_xxx_unopt/host_xxx has an arch of x86_64 which supports arm64/arm.
* Remove suffixes for various archs.
* move flutter_assets to App.framework
* Roll engine to 05fee4eeee0ff6b219b1fcc394371e5f6963cc46
05fee4eee Update default flutter_assets path for iOS embedding (flutter/engine#7518)
02205db01 Roll src/third_party/skia 5d052dac3ac1..02738a86e5fd (4 commits) (flutter/engine#7541)
af907c074 Roll src/third_party/skia 5c7a3ac0e214..5d052dac3ac1 (7 commits) (flutter/engine#7540)
dde286673 IWYU to get SkFontMetrics (flutter/engine#7539)
* Use Xcode build configurations to drive Flutter build mode
* Proper check wrt local_engine, print error if profile mode misisng
* Remove unused code, update tests, fix template problem, update warning
* fix up warning
* add explanatory dev comment
* fix whitespace
* missing words, change lambda arrow to function body
* error indentation
* Test early exits for xcode_backend.sh
* only on macOS, use right test
* Update error messages
* case insensitive compare for build config
* Update gallery podfile
* update projects to add profile configuration
* make compatible with flavors
* add missing plist files
* add FLUTTER_FRAMEWORK_DIR back, set swift version for profile, tell Podfile about profile
* Use Xcode build configurations to drive Flutter build mode
* Proper check wrt local_engine, print error if profile mode misisng
* Remove unused code, update tests, fix template problem, update warning
* fix up warning
* add explanatory dev comment
* fix whitespace
* missing words, change lambda arrow to function body
* error indentation
* Test early exits for xcode_backend.sh
* only on macOS, use right test
* Update error messages
* case insensitive compare for build config
* Update gallery podfile
* update projects to add profile configuration
* make compatible with flavors
* add missing plist files
* Fix xcode_backend.sh script to support add2app
* Fix ios deployment target. Too old for new Xcode.
* Fix ios host app
* Register plugins with Flutter view
A dSYM file is created for the stripped `App.framework` and placed at `build/aot/App.dSYM`.
Reduces `App.framework` for Flutter Gallery by 6MB uncompressed, minus 23%.
Reduces `App.framework` for Hello World by 1.6MB uncompressed, minus 22%.
Fixes#4287.
Fixes#18693.
Helps with #21813.
See also #12012.
This change depends on https://dart-review.googlesource.com/c/sdk/+/76306.
* Prototype
* Fix paths to Flutter library resources
* Invoke pod install as necessary for materialized modules
* Add devicelab test for module use on iOS
* Remove debug output
* Rebase, reame materialize editable
* Add devicelab test editable iOS host app
* Removed add2app test section
This tickled a bug in KernelCompiler.compile() where the fingerprinter
doesn't include the outputFilePath in its list of dependencies. As such,
if the output .dill file is missing or corrupted, the fingerprint still
matches and re-compile is skipped, even though it shouldn't be. I'll fix
that in a followup, then look at how this triggered that issue. My
hypothesis is that that it's due to the aot kernel compile and bundle
kernel compile have separate output directories for the .dill files
(build/ vs build/aot) but the same output directory for the associated
depfiles (due to this patch).
This reverts commit 43a106e95a.
The --snapshot argument was only necessary in Dart 1. The --depfile
argument was only used in Dart 2 mode to pass to the kernel compiler,
but was inconsistent with the 'build aot' command, where the depfile was
always set to build/kernel_compile.d.
This patch updates 'build bundle' to emit the depfile to a location
consistent with the 'build aot' command; since it's not intended to be
user-configurable and flutter.gradle hardcodes the location to
build/kernel_compile.d either way, this patch also eliminates the
ability to configure the filename altogether.
This patch eliminates the --preview-dart-2/--no-preview-dart-2 flag,
hardcoding all uses to true. It also defaults all previewDart2 method
parameters to true, where they hadn't yet been.
A series of subsequent patches will eliminate all previewDart2
parameters and the associated code from within the codebase.
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.
This reverts commit e22f99743b.
Adding the exit(exitCode) fixes the hang.
Tested by running `fx run-host-tests` with a topaz checkout.
Verified the hang before, no hang after.
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)
* 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.
This change adds support for armv7, arm64, and universal iOS apps.
This change eliminates iOS target architecture hardcoding (previously
arm64 only) and uses the target architecture(s) specified in Xcode's
ARCHS setting ('Architectures' in Xcode Build Settings).
For universal binaries, set ARCHS to its default value, $(ARCHS_STANDARD).
Note that after changing the architecture in Xcode, developers should
run 'pod install' from the ios subdirectory of their project. A separate
change (that will land before this one) will add support for
automatically detecting project file and Podfile changes and re-running
pod install if necessary.
This change also adds an --ios-arch option to flutter build aot. In iOS
AOT builds (in profile and release mode), this dictates which
architectures are built into App.framework. This flag should generally
be unnecessary to set manually since flutter build aot is typically only
invoked internally by flutter itself.
In debug mode iOS builds, we build a stub App.framework with no
functionality, since the engine itself loads the code from the included
bundle and subsequently via hot reload. This is simply done for
consistency with profile/release AOT app structure.
To satisfy the linker, ensure that we're building this code for all
build architectures, not just CURRENT_ARCH.
This is pre-work for supporting arbitrary iOS architectures (armv7,
arm64, universal) in Flutter.
This re-lands feb16d8, which was reverted due to a flaky test.
In debug mode iOS builds, we build a stub App.framework with no
functionality, since the engine itself loads the code from the included
bundle and subsequently via hot reload. This is simply done for
consistency with profile/release AOT app structure.
To satisfy the linker, ensure that we're building this code for all
build architectures, not just CURRENT_ARCH.
This is pre-work for supporting arbitrary iOS architectures (armv7,
arm64, universal) in Flutter.
Correctly split ARCHS into a Bash array in xcode_backend.sh.
Previously, when ARCHS contained multiple values (e.g., ARCHS="armv7 arm64"),
we treated that as a single architecture, and lipo invocation would
fail.
iOS debug builds always run in interpreted mode whether on device or on
simulator. In both cases, we can skip snapshotting and link against an
empty App.framework. Previously, we did this for iOS simulator builds.
This does the same for device builds.
Previously, debug iOS builds used gen_snapshot to generate a core
snapshot, then used 'xxd' to generate C files containing the snapshot
data in buffers named kDartVmSnapshotData and kDartIsolateSnapshotData,
which are then compiled/linked into App.framework. This is unnecessary
since the VM compiled into Flutter.framework already contains this data.
This is required for iOS debug builds, but unused otherwise. In theory,
Android debug builds could be run in this mode, but this is historically
untested and adds unnecessary complexity to the code. If ad-hoc testing
is required, it can be patched in when necessary.
This re-lands 8c4f0c0d21 with a fix to
xcode_backend.sh to eliminate the use of --interpreter.
* Created plumbing but has stream problem
* testing with makePipe
* Trying pipe but not really getting anywhere
* works by repeatedly reading line
* Minor cleanup
* works
* Clean up pipe after use.
* Move the last status forward
* Make sure failed script commands bubble up
Pull code out of flx.dart:assemble() to make flx.dart:buildAssets
which creates the AssetBundle. This will allow us to create just
this instead of an entire FLX.
* Revert "Revert "Reduce xcodebuild noise #2" (#14641)"
This reverts commit 2d47481f1e.
* Stop scrapping xcodebuild output, get the right build settings
* clone the command params first
* Reduce noise in xcodebuild stdout
* Reduce output from cleaning, from non failing xcode outputs and from script
* Check xcodebuild clean's exit code
* Revert "Reduce noise in xcodebuild stdout"
This reverts commit 222a26f55f.
* Revert "Include a directory with Flutter assets (#12944)"
This reverts commit 3af6b9cbf5.
* Revert "Upgrade project.pbxproj to include flutter_assets (#13011)"
This reverts commit 08128cb29b.
* Revert "Upgrade complex_layout project.pbxproj to include flutter_assets (#13544)"
This reverts commit 35f1a04195.
* mark complex_layout_ios__start_up as flaky
Previously, the usage analytics would generate a write to the user's
HOME directory during the Fuchsia build. We're tightening down the
environment in which we run the Fuchsia build, and these writes are now
more obvious.
This patch removes the usage analytics during the Fuchsia build,
avoiding the write to the user's HOME directory.
**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.
* Do not attempt to merge non-fat frameworks in Xcode build
During the Xcode build, we strip code irrelevant to the target
architecture in frameworks used by the application. In the case of
non-fat executables, no stripping occurs, so the frameworks can be used
as-is. No merge & replace step is necessary.
* fixup! Do not attempt to merge non-fat frameworks in Xcode build
Required to handle Flutter SDK (and other) paths that include spaces.
Also includes general cleanup:
* Declare explicitly that we use /bin/bash, since we rely on its
features.
* Add -- where possible, to avoid interpreting files starting in - as
options.
* Suppress output of pushd/popd.
* Avoid stringifying arrays.
Support for thinning app frameworks to the target architecture was added
in 708909fc6b. This commit adds support
and error-checking for non-fat frameworks that are not of the target
architecture. In such cases, we now fail the build, and emit an error
message and the contents of lipo -info for the affected framework.
* Support thinning iOS frameworks to supported architectures
When building against frameworks that are distributed as
multi-architecture fat binaries, we want to strip the frameworks we
distribute down to only the architectures specified in $ARCHS.
This patch adds:
* The ability to specify commands to xcode_backend.sh (if none is
specified, run BuildApp for backward compatibility).
* A 'thin' command that invokes lipo to thin down the distributed as
described above.
* Add framework thinning step to iOS build
Invokes xcode_backend.sh thin on the build application.
* Limit architectures to arm64 in Xcode template
Flutter does not yet support armv7 iOS devices. Limit the $ARCHS build
variable to arm64 until then.
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.
* 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
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.
This change adds a top-level getBuildDirectory func and funcs for
android, aot, asset, ios build products.
Developers may now add a "build-dir" mapping to their
~/.flutter_settings (JSON format) config file. Output directory is
relative to the main flutter application directory.
This change also changes the default build directory for iOS builds to a
subdirectory of the configured build directory, 'build/ios' by default.
Expose the main entry point for the tools via the library lets us run the tools
from the Flutter package, which simplifies the setup for end developers because
they don't need to declare a dependency on sky_tools directly.
This makes the 'package-root' option universal for sky_tools and configures the
ArtifactStore with it statically at startup. The actual sky_engine revision
is computed on demand.
This adds the following commands to sky_tools:
sky_tools cache clear: Nukes all local artifacts in the cache
sky_tools cache populate: Populates the cache with all known artifacts
This is useful both to fix busted caches and to make sure that the cache is
fully populated so that subsequent operations can proceed without needing
network access.
This initial version assumes the developer has mojo_shell and all other services
sitting on disk somewhere and that they're on linux and only want to run on
linux. This can be generalized down the line to support more use cases. This
downloads the sky_viewer.mojo corresponding to the packages/sky_engine/REVISION
in the developer's directory, so they can specify whatever revision they want.
sky_tools run_mojo downloads sky_viewer.mojo into its cache directory if it is
not present and constructs a command line to pass to mojo_shell that maps the
shebang stamped into the flx to the downloaded sky_viewer.mojo.
Since sky_viewer.mojo lives in the cloud and mojo_shell can load from the cloud
this could also map to an https URL. This should likely be an option.
This command will produce an flx package. Currently, this command doesn't work
because we don't have the Flutter compiler downloaded from Google storage yet.
A future patch will make that happen.
This command uses package:test to run Dart tests with sky_shell. For this to
work, we need https://github.com/dart-lang/test/tree/hacky-loader-hook to land.
We're also not smart enough to find sky_shell ourselves yet. Instead, we take
the path as input using an environment variable. Eventually, we'll be able to
get the sky_shell executable from package:sky_engine, but we don't yet ship
that executable.