Commit Graph

114 Commits

Author SHA1 Message Date
Aran Donohue
48eee14f0e
Support --web-header option for flutter run (#136297)
Adds support for a new --web-header option to flutter run.

Creates a workaround for https://github.com/flutter/flutter/issues/127902

This PR allows adding additional headers for the flutter run web server. This is useful to add headers like Cross-Origin-Embedder-Policy and Cross-Origin-Opener-Policy without the use of a proxy server. These headers are required enable advanced web features. This approach provides flexibility to the developer to make use of the feature as they see fit and is backward-compatible. One tradeoff is that it increases the surface area to support for future changes to the flutter web server.

https://github.com/flutter/flutter/issues/127902 is not fully addressed by this change. The solution for that task will be more opinionated. This PR creates a general-purpose workaround for anyone who needs a solution sooner while the bigger solution is developed.
2023-10-17 19:42:01 +00:00
Daco Harkes
aa36db1d29
Native assets support for MacOS and iOS (#130494)
Support for FFI calls with `@Native external` functions through Native assets on MacOS and iOS. This enables bundling native code without any build-system boilerplate code.

For more info see:

* https://github.com/flutter/flutter/issues/129757

### Implementation details for MacOS and iOS.

Dylibs are bundled by (1) making them fat binaries if multiple architectures are targeted, (2) code signing these, and (3) copying them to the frameworks folder. These steps are done manual rather than via CocoaPods. CocoaPods would have done the same steps, but (a) needs the dylibs to be there before the `xcodebuild` invocation (we could trick it, by having a minimal dylib in the place and replace it during the build process, that works), and (b) can't deal with having no dylibs to be bundled (we'd have to bundle a dummy dylib or include some dummy C code in the build file).

The dylibs are build as a new target inside flutter assemble, as that is the moment we know what build-mode and architecture to target.

The mapping from asset id to dylib-path is passed in to every kernel compilation path. The interesting case is hot-restart where the initial kernel file is compiled by the "inner" flutter assemble, while after hot restart the "outer" flutter run compiled kernel file is pushed to the device. Both kernel files need to contain the mapping. The "inner" flutter assemble gets its mapping from the NativeAssets target which builds the native assets. The "outer" flutter run get its mapping from a dry-run invocation. Since this hot restart can be used for multiple target devices (`flutter run -d all`) it contains the mapping for all known targets.

### Example vs template

The PR includes a new template that uses the new native assets in a package and has an app importing that. Separate discussion in: https://github.com/flutter/flutter/issues/131209.

### Tests

This PR adds new tests to cover the various use cases.

* dev/devicelab/bin/tasks/native_assets_ios.dart
  * Runs an example app with native assets in all build modes, doing hot reload and hot restart in debug mode.
* dev/devicelab/bin/tasks/native_assets_ios_simulator.dart
  * Runs an example app with native assets, doing hot reload and hot restart.
* packages/flutter_tools/test/integration.shard/native_assets_test.dart
  * Runs (incl hot reload/hot restart), builds, builds frameworks for iOS, MacOS and flutter-tester.
* packages/flutter_tools/test/general.shard/build_system/targets/native_assets_test.dart
  * Unit tests the new Target in the backend.
* packages/flutter_tools/test/general.shard/ios/native_assets_test.dart
* packages/flutter_tools/test/general.shard/macos/native_assets_test.dart
  * Unit tests the native assets being packaged on a iOS/MacOS build.

It also extends various existing tests:

* dev/devicelab/bin/tasks/module_test_ios.dart
   * Exercises the add2app scenario.
* packages/flutter_tools/test/general.shard/features_test.dart
   * Unit test the new feature flag.
2023-09-10 08:07:13 +00:00
Michael Goderbauer
55b6f049a6
Enable unreachable_from_main lint - it is stable now!!1 (#129854)
PLUS: clean-up of all the unreachable stuff.
2023-07-06 00:09:01 +00:00
Kevin Moore
895879c195
flutter_tools: Flutter Web CLI cleanup (#124564)
flutter_tools: Flutter Web CLI cleanup
2023-04-12 00:01:15 +00:00
Christopher Fujino
3736274a6d
Revert "[flutter_tools] Remove sound null safety flag (#123031)" (#123280)
Revert "[flutter_tools] Remove sound null safety flag (#123031)"
2023-03-22 22:53:49 +00:00
Zachary Anderson
7e88acfb0e
[flutter_tool] Adds a flag to disable Impeller (#122960) 2023-03-20 22:23:23 -07:00
Christopher Fujino
f4c3facfdd
Revert "Revert "[flutter_tools] Remove sound null safety flag (#120936)" (#122909)" (#123031)
[flutter_tools] Remove sound null safety flag #2
2023-03-20 22:32:07 +00:00
Christopher Fujino
f6bc147c91
Revert "[flutter_tools] Remove sound null safety flag (#120936)" (#122909)
This reverts commit 7c3088cf22.
2023-03-17 11:31:48 -07:00
Christopher Fujino
7c3088cf22
[flutter_tools] Remove sound null safety flag (#120936)
[flutter_tools] Remove sound null safety flag
2023-03-17 17:48:35 +00:00
Mouad Debbar
d4b6898478
[web] Put all index.html operations in one place (#118188)
* [web] Put all index.html operations in one place

* review comments

* fix build

* change quotes

* fix test
2023-02-02 19:49:18 +00:00
Ahmed Ashour
c35efdaa68
Remove superfluous words. (#119008)
* Remove superfluous words.

* Update packages/flutter/lib/src/widgets/slotted_render_object_widget.dart

Co-authored-by: Michael Goderbauer <goderbauer@google.com>
2023-01-24 01:57:00 +00:00
Danny Tuppeny
06909ccfa4
Update packages + fix tests for javascript mime change (#118617)
Update test expectations from application/javascript -> text/javascript

`package:mime` now uses `text/javascript` and not `application/javascript`.

See https://github.com/dart-lang/mime/pull/76.
See https://datatracker.ietf.org/doc/html/rfc9239.

> This document defines equivalent processing requirements for the various script media types. The most widely supported media type in use is `text/javascript`; all others are considered historical and obsolete aliases of `text/javascript`.
2023-01-19 09:54:40 -05:00
Liam Appelbe
4453ba0a4d
Null safety migration of packages/flutter_tools/test/general.shard, part 2/2 (#110712)
* Migrate packages/flutter_tools/test/general.shard, part 2/2

* Fix analysis

* Fix tests

* Fix analysis

* Apply suggestions from code review

Co-authored-by: Christopher Fujino <fujino@google.com>

Co-authored-by: Christopher Fujino <fujino@google.com>
2022-09-07 12:28:52 -07:00
Christopher Fujino
017dd3e7d6
[flutter_tools] Fix race condition with completer in devfs_web (#109059) 2022-08-09 23:57:06 +00:00
Michael Goderbauer
c22b7f697f
Add avoid_redundant_argument_values ignores back (#108984) 2022-08-04 09:59:57 -07:00
Michael Goderbauer
e27a19e3f8
Remove outdated ignores (#108924) 2022-08-03 23:37:05 +00:00
Jonah Williams
7e683c023a
[flutter_tools] add tool support for shader hot reload (#107963) 2022-07-27 03:31:06 +00:00
Lau Ching Jun
922eea8763
Dart registrant location (#107967) 2022-07-20 08:51:04 +00:00
Christopher Fujino
81045d4a44
Revert "Read dart_plugin_registrant path from FlutterProject to support non-standard path." (#107850) 2022-07-18 19:58:10 +00:00
Lau Ching Jun
8f834cf150
Read dart_plugin_registrant path from FlutterProject to support non-standard path. (#107617) 2022-07-15 12:33:07 -07:00
Jonah Williams
92034482f9
[flutter_tool] partial null safety migration of tool source code (#105798) 2022-06-15 20:02:07 +00:00
Anna Gringauze
29fecb5980
Provide flutter sdk kernel files to dwds launcher instead of dart ones (#103436)
* Provide flutter sdk kernel files to dwds launcher instead of dart ones

* Update log test to report all warnings

* Update licences for new files

* Addressed CR comments

* Addressed CR comments
2022-05-11 08:52:43 -07:00
Alexandre Ardhuin
07f1c20474
add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
Christopher Fujino
5a3e10047f
[flutter_tools] Add test that "Unresolve URI" warnings from DWDS are filtered from logs (#102399) 2022-04-22 15:29:07 -07:00
David Iglesias
e52b777a2c
[web] flutter.js initialization with ui.webOnlyWarmupEngine (#100177) 2022-03-30 23:00:09 -07:00
Sergey Fedotov
2a4e573dcd
Serve assets with correct content-type header value (#94357) 2021-12-08 12:29:07 -08:00
Jenn Magder
9e88fe328e
Remove globals_null_migrated.dart, move into globals.dart (#92861) 2021-11-01 17:18:03 -07:00
Ian Hickson
61a0add286
Enable avoid_redundant_argument_values lint (#91409) (#91462) 2021-10-08 09:25:14 -07:00
Zachary Anderson
b9d2177da0
Revert "Enable avoid_redundant_argument_values lint (#91409)" (#91461)
This reverts commit 5fd259be24.
2021-10-07 21:11:07 -07:00
Ian Hickson
5fd259be24
Enable avoid_redundant_argument_values lint (#91409) 2021-10-07 20:13:02 -07:00
stuartmorgan
97fb8c0560
Fix Dart plugin registrant interaction with 'flutter test' (#90288)
Building an application for a desktop platform that transitively included any Dart-based plugins (such as path_provider) broke `flutter test`, because its compilation was overriding the provided main (in this case, the test main) with `generated_main.dart` if it was present. This PR:
- Changes the `flutter test` compilation path to update `generated_main.dart`, so that the tests will work, and will include any registered Dart plugins.
- Makes using `generated_main.dart` during recompile opt-in, to try to reduce the chance of a similar bug happening with other codepaths in the future.

Fixes https://github.com/flutter/flutter/issues/88794
2021-09-30 20:25:13 -07:00
Anis Alibegić
a753d09cc9
Fixed several typos (#89485) 2021-09-07 14:56:04 -07:00
Jonah Williams
03a3e7b1e4
Revert "[flutter_tools] fix top web crasher (#83272)" (#83376) 2021-05-25 17:49:04 -07:00
Jonah Williams
a8ec764609
[flutter_tools] fix top web crasher (#83272) 2021-05-24 18:04:02 -07:00
Jenn Magder
0d79013a81
Move globals.artifacts to globals_null_migrated, update imports (#83137) 2021-05-21 18:35:02 -07:00
nt4f04uNd
80a2b6b015
Fix typos (#82589) 2021-05-20 17:19:09 -07:00
Balvinder Singh Gambhir
4a33813b35
[flutter_tools] added base-href command in web (#80519) 2021-05-19 12:39:02 -07:00
Jonah Williams
3bc2378ad2
[flutter_tools] remove mocks from devfs web, cache, and xcode migrator test (#81475) 2021-04-30 17:24:04 -07:00
Emmanuel Garcia
b0a63c4ffe
Reland the Dart plugin registry (#79669) 2021-04-23 15:34:04 -07:00
Jonah Williams
b30d97a64c
[flutter_tools] split host artifacts out of Artifacts (#80876) 2021-04-22 19:29:02 -07:00
Phil Quitslund
61c30c41b2
fix sort_directives violations (#80817) 2021-04-21 13:49:03 -07:00
Danny Tuppeny
563338a106
Support WebSockets for injected client (#78961) 2021-03-24 10:45:03 -07:00
Danny Tuppeny
596133a723
Pass the --disable-dds flag through to dwds (#78806) 2021-03-23 12:36:53 -07:00
Jenn Magder
66768f8c5b
Remove mocks from web devices test (#77968) 2021-03-11 19:55:02 -08:00
Michael Goderbauer
cb867bbedc
Enable unnecessary_await_in_return lint (#77434) 2021-03-05 18:38:15 -08:00
Sam Rawlins
e8d52be500
Remove "unnecessary" imports in flutter_tools tests (#75012) 2021-02-09 09:46:07 -08:00
Jonah Williams
74bd7b6f6d
[flutter_tools] opt all flutter tool libraries and tests out of null safety. (#74832)
* opt out the flutter tool

* oops EOF

* fix import

* Update tool_backend.dart

* Update daemon_client.dart

* fix more
2021-01-27 15:17:53 -08:00
Jonah Williams
32db0fe791
[flutter_tools] provide correct sources and metadata for different base hrefs (#74452) 2021-01-21 23:04:03 -08:00
Jonah Williams
68d8c4b3bb
[flutter_tools] open chrome to correct base URL (#73962) 2021-01-14 12:16:32 -08:00
Jonah Williams
9e5c8771d4
[flutter_tools] wire up native-null-assertions for flutter web (#71618) 2020-12-03 08:59:31 -08:00