Commit Graph

5735 Commits

Author SHA1 Message Date
Andrew Kolos
6b12651419
Fix analytics enabled/disabled event not being sent when the user enables/disables analytics (#160060)
Fixes https://github.com/flutter/flutter/issues/160058.

In addition, only send an event when the enabled-state of analytics
actually gets flipped.


<details>

<summary> Pre-launch checklist </summary> 


- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

</details>


<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-12-12 19:59:50 +00:00
Ben Konyi
292695e7c1
Don't throw StateError when listing core devices during tool shutdown (#160094)
The previous attempt at this fix was assuming that the tool's file
system was a `LocalFileSystem`, but in reality it's a `LocalFileSystem`
wrapped in an `ErrorHandlingFileSystem`. This change takes this into
account.

Fixes https://github.com/flutter/flutter/issues/160082 
Fixes https://github.com/flutter/flutter/issues/156962

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-12-11 20:12:48 +00:00
Ben Konyi
4b14308413
Add support for injecting assets into the widget_preview_scaffold (#159859)
The generated widget_preview_scaffold project needs to explicitly
reference the assets from the parent project's pubspec.yaml. This change
updates flutter widget-preview start to read the parent project's
pubspec.yaml and add references to the assets listed to the
widget_preview_scaffold's pubspec.yaml. If generate: true is set in the
parent project, a reference to the autogenerated flutter_gen package is
manually added to the widget_preview_scaffold's package_config.json.
2024-12-10 15:34:33 +00:00
Mikhail Novoseltsev
2eee054d41
[tool] Fix android tests using outdated regexs to modify templates (#159396)
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

**Description**

While exploring some semi-related stuff, found these 2 tests using
outdated regex which does not work because AGP version in modern
templates is set in `settings.gradle.kts` and in form of
`com.android.application` instead of `com.android.tools.build:gradle`.

Apart from that, in `android_plugin_example_app_build_test.dart` deleted
all lines regarding version change (instead of comply with new way of
declaring plugin) because for a long time it's didn't work anyway:
`replaceAll` haven't find any matches and test ran on latest AGP from
template. More than that, attempt to adapt this test to modern AGP setup
failed because build is not working with AGP < 8 (I lost logs with
actual error for this case, but I believe I can reproduce if anyone
wants)

in `native_assets_agp_version_test`: 

- Fixed version to comply with AGP versioning format, which is
`major.minor.patch`.
- Updated regex and version changing logic to work with
`com.android.application` format and `settings.gradle.kts` file. I
believe that version updating is desired behavior here, unlike in
`android_plugin_example_app_build_test.dart`.
- Updated `kts` syntax for declaring flavors in `build.gradle.kts` and
updated regex-based updating of this file (didn't work previously
because there wasn't actual writing to file)

didn't list any issues because there're not any regarding these tests
(or maybe I just failed to find). In any case, I think that this doesn't
require issue because fix is kinda trivial and motivation is clear.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-12-10 14:19:24 +00:00
Mohellebi abdessalem
43a25a8e41
Align comments in flutter_build_preview_sdk_test.dart with build.gradle.kts usage (#159299)
update comments inside `flutter_build_preview_sdk_test.dart` to match
the usage of `build.gradle.kts` instead of `build.gradle`
those must've slipped from #157195
## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-12-06 21:18:08 +00:00
Michael Goderbauer
f601ed1862
Bump Dart SDK to 3.7 (#159812) 2024-12-05 21:39:53 +00:00
Jonah Williams
e1c09f408c
[flutter_tools] configure shader compiler to output GLES3 shaders for Android. (#159857)
Required changes for https://github.com/flutter/engine/pull/56960

This configures an additional shader target for Android devices.
2024-12-05 20:43:12 +00:00
Andrew Kolos
1856940f66
Remove some usages of package:usage (#159705)
Split-off from https://github.com/flutter/flutter/pull/151518. Helps
https://github.com/flutter/flutter/issues/150575


<details>

<summary> Pre-launch checklist </summary> 


- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

</details>


<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-12-05 17:07:12 +00:00
Anis Alibegić
e2ada1c939
Fixed typos (#159331)
Here's another one of my PRs where I hunt for typos across `flutter`
repo.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-12-05 16:54:09 +00:00
Ben Konyi
74669e4bf1
Add flutter widget-preview {start, clean} commands (#159510)
This is the initial tooling work for Flutter Widget Previews, adding two
commands: `flutter widget-preview start` and `flutter widget-preview
clean`.

The `start` command currently only checks to see if
`.dart_tool/widget_preview_scaffold/` exists and creates a new Flutter
project using the widget_preview_scaffold template if one isn't found.
The widget_preview_scaffold template currently only contains some
placeholder files and will be updated to include additional code
required by the scaffold.

The `clean` command simply deletes `.dart_tool/widget_preview_scaffold/`
if it's found.

This change also includes some refactoring of the `create` command in
order to share some project creation logic without requiring `flutter
widget-preview start` to spawn a new process simply to run `flutter
create -t widget_preview .dart_tool/widget_preview_scaffold`.

Related issue: https://github.com/flutter/flutter/issues/115704

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-12-04 21:51:08 +00:00
Ben Konyi
eabed2381b
Add deprecation notice for Android x86 when building for the target (#159750)
Related to https://github.com/flutter/flutter/issues/157543
2024-12-04 16:45:43 +00:00
Loïc Sharma
88a7ec6b4d
[SwiftPM] Rename SWIFT_PACKAGE_MANAGER environment variable to FLUTTER_SWIFT_PACKAGE_MANAGER (#159502)
Previously, the Swift Package Manager feature could be overridden using
the `SWIFT_PACKAGE_MANAGER` environment variable.

This environment variable name is a bit generic and might collide with
other tooling.

This renames the environment variable to
`FLUTTER_SWIFT_PACKAGE_MANAGER`.

**This is a breaking change**, however, [we haven't documented this
environment
variable](https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-app-developers#how-to-turn-on-swift-package-manager).

Addresses https://github.com/flutter/flutter/issues/159121

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-12-03 19:06:44 +00:00
Martin Kustermann
227f6a04f7
Make native asset tests more robust against flutter upgrading its pinned dependencies (#159715)
Native asset tests use `flutter create --no-pub --template=package_ffi`.
The template used for this is checked in. It then adds extra
dependencies to checked-in packages in flutter/flutter (which have
pinned deps) in those generated templates.

It then pins all dependencies in the modified template project. This can
lead to constraint violations when flutter updates pinned dependencies,
because the template uses old constraints (which are turned from `^x` to
`=x`) and the additional dependency on flutter/flutter checked in
package brings in different pinned dependencies.

In a previous PR we already made this more robust by using flutter's
pinned versions over the the versions from the template (that are
changed from `^x` to `=x`).

Though a new upgrade of flutters pinned packages reveals that this isn't
quite sufficient: The template uses `test` at `^X`. The additional
dependency to `link_hook` doesn't depend on `test`. It therefore turns
it into `=X`. BUT `link_hooks` has a non-dev dependency on `test_core`
which is incompatible with `=X`.

=> So we relax this even more by prefering to choose (pinned) versions
of the flutter/flutter `link_hook` dependencies and (new) dev
dependencies over the template dependencies.
=> This will make use use the pinned `test` version from `link_hooks`
instead of from the template.
2024-12-03 12:21:59 +00:00
LinXunFeng
6b5cd01e39
Fix output path for --appSizeBase (#158302)
Fixes https://github.com/flutter/flutter/issues/158211

before

```shell
A summary of your APK analysis can be found at: /Users/lxf/.flutter-devtools/apk-code-size-analysis_01.json

To analyze your app size in Dart DevTools, run the following command:
dart devtools --appSizeBase=apk-code-size-analysis_01.json
```

now

```shell
A summary of your APK analysis can be found at: /Users/lxf/.flutter-devtools/apk-code-size-analysis_01.json

To analyze your app size in Dart DevTools, run the following command:
dart devtools --appSizeBase=/Users/lxf/.flutter-devtools/apk-code-size-analysis_01.json
```


## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

Co-authored-by: Kenzie Davisson <43759233+kenzieschmoll@users.noreply.github.com>
2024-12-02 19:35:27 +00:00
David Iglesias
1e1b5271f4
[tool] Removes deprecated --web-renderer parameter. (#159314)
Removes the `--web-renderer` option.

Flutter tool users won't be able to select their web renderer.

In order to not drop test coverage, tests are still run with the HTML
Renderer, until its code is fully removed from the engine.

Part of https://github.com/flutter/flutter/issues/145954

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-12-02 18:33:02 +00:00
Daco Harkes
4aa2caef20
[native assets] Create NativeAssetsManifest.json instead of kernel embedding (#159322)
This PR introduces a `NativeAssetsManifest.json` next to the
`AssetManifest.bin` and `FontManifest.json`. This removes the need for
embedding the native assets mapping inside the kernel file and enables
decoupling native assets building and bundling from the kernel
compilation in flutter tools. This means `flutter run` no longer does a
dry run of `hook/build.dart` hooks.

(It also means all isolate groups will have the same native assets.
However, since Flutter does not support `Isolate.spawnUri` from kernel
files, this is not a regression.)

Implementation details:

* g3 is still using kernel embedding.
https://github.com/flutter/flutter/pull/142016 introduced an argument to
embed a `native_assets.yaml` inside `flutter attach` and `flutter run`
(the outer flutter process), but it is not used in `flutter assemble`
(the inner process when doing `flutter run`). So, those arguments need
to still be respected. However, all other logic related to embedding a
yaml encoding in the kernel file has been removed.
* All dry-run logic has been removed. 🎉 
* The `KernelSnapshot` target no longer depends on the
`InstallCodeAssets` target. Instead, the various OS-specific
"BundleAsset" targets now depend on the `InstallCodeAssets` target. The
`InstallCodeAssets` invokes the build hooks and produces the
`NativeAssetsManifest.json`. The various "BundleAsset" commands
synchronize the `NativeAssetsManifest.json` to the app bundle.
* `InstallCodeAssets` produces a `native_assets.json`, which is renamed
to `NativeAssetsManifest.json` in the various "Bundle" targets. This
means that all unit tests of the "Bundle" targets now need to create
this file. (Similar to how `app.dill` is expected to exist because
`KernelSnapshot` is a dependency of the "Bundle" targets.)
* Because dynamic libraries need to be code signed (at least on iOS and
MacOS), the bundling of the dylibs is _not_ migrated to reuse
`_updateDevFS` (which is used for ordinary assets). Only the 2nd and 3rd
invocation of `flutter assemble` from `xcodebuild` has access to the
code signing identity.

Relevant tests:

* test/integration.shard/isolated/native_assets_test.dart - runs
`flutter run` with native assets including hot restart and hot reload.

TODO:

* Undo engine-roll in this PR after engine has rolled in.

Issue:

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

Related PRs:

* https://dart-review.googlesource.com/c/sdk/+/388161
* https://github.com/flutter/engine/pull/56727

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-11-27 11:03:19 +00:00
Matan Lurey
4ff6698838
Report usage of deferred-components to analytics. (#159307)
Towards https://github.com/flutter/flutter/issues/159212.

/cc @jtmcdole

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-11-26 21:01:20 +00:00
Gray Mackall
70e31b48bf
Bump AGP/Gradle/Kotlin warn versions (#158839)
Bumps the versions up a bit, so we can keep people moving forward.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Gray Mackall <mackall@google.com>
2024-11-25 21:13:24 +00:00
Ben Konyi
b5331b3e1b
[ tool ] Fix expression evaluation not handling errors correctly (#159151)
Also starts DDS for integration test devices.

Fixes https://github.com/flutter/flutter/issues/157922
2024-11-25 15:04:09 +00:00
Albert Wolszon
da188452a6
Allow add_format() in flutter gen-l10n DateTime format (#156297)
This Pull Request extends the functionality of the `flutter gen-l10n`
command (and its behavior during hot restart/reload) related to
`DateFormat` type placeholders and their `format`. Until now, it was
impossible to take advantage of `intl`'s
`DateFormat.something().add_somethingElse()`. The `.add_x()` part was
impossible to achieve. This PR adds the ability to take advantage of
these methods over `DateFormat`, by adding the `add_` formats after the
`+` character in the `format` in placeholder configuration. You can even
have multiple added format parts if needed. All within a single
placeholder.

<table>
<tr>
<th>Before the PR</th>
<th>After the PR</th>
</tr>
<tr>
<td>

```json
{
    "bookingsPage_camo_dataLoaded": "CAMO data from {date} {time}.",
    "@bookingsPage_camo_dataLoaded": {
        "placeholders": {
            "date": {
                "type": "DateTime",
                "format": "yMMMd"
            },
            "time": {
                "type": "DateTime",
                "format": "jm"
            }
        }
    },
}
```

</td>
<td>

```json
{
    "bookingsPage_camo_dataLoaded": "CAMO data from {date}.",
    "@bookingsPage_camo_dataLoaded": {
        "placeholders": {
            "date": {
                "type": "DateTime",
                "format": "yMMMd+jm"
            }
        }
    },
}
```

</td>
</tr>
</table>

Resolves #155817.

## Next steps

After this PR is merged, an update to [i18n | Flutter > Messages with
dates](https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization#messages-with-dates)
([source](https://github.com/flutter/website/blob/main/src/content/ui/accessibility-and-internationalization/internationalization.md))
shall be made to include a mention of this new addition.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-11-23 18:55:24 +00:00
Mikhail Novoseltsev
4b46b80661
doctor: make JDK validation message more descriptive (#157280)
This PR attempts to improve clarity of androids section of `flutter
doctor -v` output by providing explicit information about which JDK is
being used and how to configure a different one if needed.

### Before

```console
• Java binary at: /Users/user/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents/jbr/Contents/Home/bin/java
```

### After

1. When JDK is from Android Studio:

```console
    • Java binary at: /Users/users/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with latest Android Studio installation
      To manually set a custom JDK path, use: `flutter config --jdk-dir="path/to/jdk"`
```

2. When JDK is from JAVA_HOME env variable:

```console
    • Java binary at: /Users/user/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents/jbr/Contents/Home/bin/java
      This JDK is specified by JAVA_HOME environment variable
      To manually set a custom JDK path, use: `flutter config --jdk-dir="path/to/jdk"`
```

3. When path to JDK is set in flutter config:

```console
    • Java binary at: /Users/user/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents/jbr/Contents/Home/bin/java
      This JDK was found in system PATH
      To change current JDK, run: `flutter config --jdk-dir="path/to/jdk"`
```
4. When java binary is found in PATH (as fallback)

```console
    • Java binary at: /Users/user/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents/jbr/Contents/Home/bin/java
      This JDK is specified in Flutter configuration
      To manually set a custom JDK path, use: `flutter config --jdk-dir="path/to/jdk"`
```

### Motivation

I think it's described in
https://github.com/flutter/flutter/issues/153156#issuecomment-2336814991.

TLDR; many developers struggle with Java-related issues and more verbose
doctor's output will (presumably) improve DX in that part.


fixes #153156


## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-11-23 00:27:18 +00:00
Matan Lurey
5efd759085
Remove now unused apk-health-tests. Can always re-add in the future. (#159349)
https://github.com/flutter/flutter/issues/159000 resolved (for now).
2024-11-23 00:25:46 +00:00
Dominik Toton
728cedc62a
Fix --web-header flag for flutter drive (#159039)
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

This PR makes sure that `--web-header` flag works together with the
`flutter drive` command. Currently the flag is correctly parsed but it
is not properly propagated and ends up being unused when running the web
server for tests.

I have validated the fix by following the steps to reproduce from:
https://github.com/flutter/flutter/issues/159037.

#### Before the fix

No custom HTTP header in test run:
![Screenshot 2024-11-16 at 22 21
36](https://github.com/user-attachments/assets/b3d4e34b-fe2b-4d32-8b0a-2d55e5d23f69)

#### After the fix

Correct HTTP headers in test run:
![Screenshot 2024-11-16 at 22 13
43](https://github.com/user-attachments/assets/b74a41de-69c5-4968-82c0-a08d29a3252d)


Fixes #159037

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-11-21 20:40:11 +00:00
Jason Simmons
d7f5547ecd
Do a clean shutdown of the flutter_tools processes started by observatory_port_test (#159169)
Killing the flutter_tools parent process may leak child processes
spawned by the tools.

Also wait for the message indicating that DevTools has started before
stopping flutter_tools. If DevTools has not fully launched, then there
may be a race between DevTools startup and flutter_tools shutdown.

Fixes https://github.com/flutter/flutter/issues/159154
2024-11-21 19:04:06 +00:00
Jason Simmons
efe8737ea0
Shut down DevTools and DDS processes if flutter_tools is killed by a signal (#159238)
See https://github.com/flutter/flutter/issues/159154
2024-11-21 17:53:57 +00:00
Matan Lurey
d1e2c5fba7
Try a speculative fix for Gradle OOMs. (#159234)
Speculative fix for https://github.com/flutter/flutter/issues/157640.

A few observations:

- I was a bit paranoid about indented files meaning something was parsed
incorrectly
- I removed `android.enableR8=true` (not used elsewhere)
- I removed `android.experimental.enableNewResourceShrinker=true` (not
used elsewhere)
- I matched the rest of the `jvmargs` used in the standard template file

... let's hope this does good things?
2024-11-21 17:39:13 +00:00
Jonah Williams
f7869a4799
[flutter_tools] opt iOS/macOS apps out of Metal API validation via migrator, update templates in repo. (#159228)
Setting "enableGPUValidationMode = "1"" disables Metal API validation. I
know, I know.

Fixes https://github.com/flutter/flutter/issues/159227
2024-11-21 01:36:55 +00:00
Matan Lurey
5ead4e15a7
Terminate non-detached test devices on flutter run completion (#159170)
See https://github.com/flutter/flutter/issues/159154.
See https://github.com/flutter/flutter/pull/159169.

Before this PR, it appeared we were accidentally leaking (keeping
active) `flutter_tester` instances (or any test device) after `flutter
run` completion, even if the runner was not explicitly detached. I
_think_ this is a bug, but I'll check with the tools team and possibly
@jonahwilliams before finalizing this.

/cc @jason-simmons

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-11-21 01:21:25 +00:00
Matan Lurey
1d24fa8f60
Un-skip tests that use flutter build apk. (#159231)
Closes https://github.com/flutter/flutter/issues/158560.

I believe but am not sure as of
https://github.com/flutter/flutter/pull/159170 merging, many process
flakes that were consuming memory and in turn, making Gradle
particularly sensitive to timing out or being killing by the OS for
low-memory, have been rectified.

It is possible there are additional problems, but they aren't visible at
the moment.

I'd like to re-enable these and keep tracking their stability.
2024-11-21 01:13:50 +00:00
Martin Kustermann
e2d8121708
Remove dependency on [Target] and instead operate on [Architecture] (#159196)
The dart-lang/native repository contains a `Target` class that is almost
not needed anymore. The remaining uses are mainly due to kernel asset
mapping (which we may be able to remove in the future).

This PR removes usages of that `Target` (in favor of `Architecture`)
class in most places in flutter tools.
This makes the code also cleaner because we no longer have an implicit
assumption that
a `List<Target>` all belong to the same operating system.
2024-11-20 12:44:43 +00:00
Matan Lurey
8536b96ebb
Terminate flutter test when no longer needed in integration test. (#159117)
Towards https://github.com/flutter/flutter/issues/51421.

```sh
flutter_tools % dart test test/integration.shard/break_on_framework_exceptions_test.dart

02:38 +29: All tests passed!

54692 ttys003    0:00.02 /opt/homebrew/bin/zsh -il
```

Requires https://github.com/flutter/flutter/pull/159115 for the process
cleanup to work properly, but this is safe to land as-is, otherwise we
still accumulate `flutter` processes over and over as each test case
runs which is not WAI.
2024-11-19 16:16:08 +00:00
Matan Lurey
c5379557b3
Terminate the test device if the flutter tool is signal-killed. (#159115)
Closes https://github.com/flutter/flutter/issues/20949.

Signals (such as SIGTERM or SIGKILL) end up flowing through
`exitWithHooks`, which in turn, after running hooks, call `exit().` That
means, as a result, any `try { } finally { }` guarded execution may
_not_ run, which happens to also be how `flutter_tester` instances are
cleaned up if they have not terminated.

This PR adds in-progress `flutter_tester` runs (or any platform
`flutter_platform` supports) to the shutdown hooks, guaranteeing that
the finalizers (which in turn, kill the process) are _always_ executed
as long as either the test completes, _or_ `exitWithHooks` is called.

The existing integration tests (`integration.shard/test_test.dart`)
still pass as well.
2024-11-19 16:10:32 +00:00
Loïc Sharma
6b6f481f19
[SwiftPM] Move where the migration checks feature flags (#159110)
Previously, the Swift Package Manager app migration would only be
registered if the feature was on.

Now, the Swift Package Manager app migration is always registered but
only runs if the SwiftPM feature is on. This change will make it easier
to introduce a separate feature flag for just the SwiftPM app migration.

This is a refactoring with no semantic change.

Part of https://github.com/flutter/flutter/issues/151567

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-11-19 01:23:08 +00:00
Matan Lurey
3a17b67353
Add a tag and assert some state in FlutterTestDriver tests. (#159099)
Towards https://github.com/flutter/flutter/issues/51421.

Asserts some state we would not like to be hit by in integration tests
using `Flutter*TestDriver`.

In addition, adds a tag that can be used to run all tests that currently
use this pattern:

```sh
flutter test --tags flutter-test-driver
```

This showcases processes leaking quite a bit:
<https://gist.github.com/matanlurey/190d9084d3a45bc5737b8406bc05b4cd>.
2024-11-18 23:37:05 +00:00
Ben Konyi
c7d158d9f9
Fix flaky failure related to core_device_list.json not being found (#158946)
It's possible that the tool can be in the process of shutting down,
which could result in the temp directory being deleted after the
shutdown hooks run before we check if `output` exists. If this happens,
we shouldn't crash but just carry on as if no devices were found as the
tool will exit on its own.

Fixes https://github.com/flutter/flutter/issues/141892

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-11-18 19:52:52 +00:00
Matan Lurey
03c13af0b4
Define and use flutterBin consistently across integration.shard. (#159007)
Towards https://github.com/flutter/flutter/issues/158875.

This should be a NOP, and just reduce the amount of copy-pasted code
across tests.
2024-11-18 19:00:04 +00:00
Matan Lurey
ec2ab541dd
Switch flutter_build_apk_health_tests to use a subset of current tests. (#159004)
Towards https://github.com/flutter/flutter/issues/159000 as part of
debugging issues such as
https://github.com/flutter/flutter/issues/158560.

On a `bringup: true` shard, run a number of `flutter build apk` tests in
succession to try and routinely trigger timeouts and crashes, so we can
test other hypotheses on how to fix this problem (i.e. potentially
around increasing memory, changing daemon configuration, aggressively
killing processes, etc).
2024-11-15 22:54:06 +00:00
Martin Kustermann
01590aa27a
Refactor native asset integration into flutter tools (#158932)
Currently the `NativeAsset` target in flutter tools is responsible for
two things:

* performing the dart build (in the app as well as all transitive pub
dependencies)
* taking output (shared libraries) from this build and copying them
around

This intermingling of responsibilities leads to more complex code and
potentially unnecessary work: If the source code changed (e.g. `.c`
files change) we have to run the dart build again. But doing so may
result in the same shared libraries (e.g. adding comments to the `.c`
code). Currently we're going to copy the shared libraries despite them
having not changed, which then may cause upstream things to be dirtied
(if it's based on timestamp of files) and re-built.

Instead this PR splits this `NativeAsset` into the two orthogonal pieces

* `DartBuild` target that is responsible for the dart build
* `InstallCodeAssets` that is responsible for copying shared libraries
to the right place and producing a `native_assets.yaml`.

This decoupling is also preparation for a future where a dart build can
produce other kinds of assets (e.g. data assets) and is used in the web
build as well. (The web build would use `DartBuild` but not
`InstalCodeAssets`).
2024-11-15 21:04:42 +01:00
Martin Kustermann
1636fbd4cb
Fix code asset copying logic in native asset code (#158984)
After the dart build is done, the flutter tool has to bundle the
produced shared libraries, which it does that by copying them around.

Though the code assumed that all code assets are shared libraries to be
bundled, whereas in fact one can have code assets without any actual
code (ones that are installed on the target system already or artificial
code assets whose symbols get resolved from executable / process).

=> Using non-bundled code assets currently results in null pointer
exceptions and/or cast errors.
=> We update the copy code to only operate on code assets that have a
shared library to bundle.

We also update the copy routines by removing copy&past'ed - but slightly
different - printing code into the shared caller function.
2024-11-15 16:23:23 +01:00
Martin Kustermann
256359194e
Fix duplicate work in native assets release builds (#158980)
In release builds linking of native assets is enabled. The build step is
only a temprary step, it's output is given to the link step which then
returns all final assets (effectively a map-reduce system). Assets that
aren't sent to a specific linker could be conceptually viewed as sent to
a linker that will emit it's input as-is.

=> The code currently took output of build & link step and therefore
accumulated assets that aren't explicitly sent to a linker twice.

=> This led to performing work twice for those (e.g. copying them twice)

This PR changes this such that if linking mode is enabled, we only rely
on the output of the link phase.
That in return means many tests that mock the native asset builds need
to be updated to mock the output of the link phase.
2024-11-15 15:05:42 +01:00
Matan Lurey
eaa99f28b1
Stop generate both .kts and non-.kts gradle files for a test project. (#158965)
Closes https://github.com/flutter/flutter/issues/158962.
2024-11-15 01:38:26 +00:00
Matan Lurey
6a145094ab
Further skip native_assets_test(s) that runs flutter build apk. (#158966)
Towards https://github.com/flutter/flutter/issues/158560.

Still occurred twice in the last 24h:

https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20tool_integration_tests_6_6/42/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20tool_integration_tests_6_6/44/overview

Let's continue to debug why these are so troublesome, but not block the tree doing so.
2024-11-15 01:34:49 +00:00
Ben Konyi
d0bd283734
[ tool ] Don't throw StateError when DDS fails to start (#158744)
This started happening after moving DDS to launch from `dart
development-service` rather than `DartDevelopmentService` (see
33b402d24c) . This state error was
originally meant to be thrown when some string parsing failed, but is
currently wrapping the `DartDevelopmentServiceException`.

Fixes https://github.com/flutter/flutter/issues/158537
2024-11-14 19:43:15 -05:00
kzrnm
dca37ad17f
[gen_l10n] When localizing a message, prefer placeholder definitions defined by the current locale rather than the template locale (#153459)
- Fixes #153457
- Fixes #116716
2024-11-14 21:48:14 +00:00
Andrew Kolos
21144362f8
Move platform-specific log-reading implementation details from ResidentRunner/FlutterDevice to DeviceLogReader implementations (#156181)
Cleans up https://github.com/flutter/flutter/pull/155800. In summary, `ResidentRunner`/`FlutterDevice` have branching behavior around logging that depends on the type of `DeviceLogReader` on the `FlutterDevice` instance.  Let's instead move this behavior to the `DeviceLogReader` implementations.

My apologies for the large diff. Much of this is a refactor that was a bit too difficult to separate into its own commits. 

Here are the main two changes

* Replaces the mutable `connectedVmService` field on the `DeviceLogReader` class with a new method `provideVmService`. This serves largely the same purpose as the mutable field, but it allows for asynchronous code. This is where we put the logic that used to exist in `FlutterDevice.tryInitLogReader`.
* Removes the `tryInitLogReader` method from `FlutterDevice`. This method served to set the `appPid` field on the `FlutterDevice`'s `DeviceLogReader` instance. This was only used in the case of Android to filter out logs unrelated to the flutter app coming from the device, so we can move this logic to `AdbLogReader`'s implementation of `provideVmService`.
2024-11-14 21:29:30 +00:00
Ben Konyi
e40306f92f
Enable --verbose for android_plugin_skip_unsupported_test tests (#158933)
Hoping this will give some more insights into https://github.com/flutter/flutter/issues/157640
2024-11-14 18:35:16 +00:00
Camille Simon
46a41585eb
Add dev_dependency attribute to plugins in .flutter-plugins-dependencies (#158009)
Adds whether or not the plugins in `.flutter-plugins-dependencies` are dev dependencies or not (as the `dev_dependency` attribute).

Fixes https://github.com/flutter/flutter/issues/157948.
2024-11-14 18:08:09 +00:00
Matan Lurey
752ac20f87
No longer pass --verbose to implicit pub calls when flutter --verbose is set. (#158898)
Closes https://github.com/flutter/flutter/issues/158896.
2024-11-14 08:59:49 -08:00
Matan Lurey
125b4e945e
Move explicit package dependencies to a feature flag (#158016)
Closes https://github.com/flutter/flutter/issues/158012.

This is (effectively) a user-facing NOP, which is exchanging an
on-by-default command-line argument (`--implicit-pubspec-resolution`)
for an off-by-default global feature flag
(`explicit-package-dependencies`). It matches the mental model better,
is less painstaking to maintain and feed throughout, and will be easier
to globally flip on/off in a future PR.

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-11-13 18:33:34 -08:00
Matan Lurey
9ac9049d09
Try with bringup: true debugging why flutter build apk often times out. (#158895)
It would be nice to have somewhere to iterate and experiment with what we can do to either fix frequent timeout problems we have with `flutter build apk` (across platforms, to be clear, though I've just started with Linux) or get more information on why the crashes/timeouts happen.

Open to other ways to doing this (though preferably _not_ LED).
2024-11-14 02:12:14 +00:00
Mitchell Goodwin
5f93a7f7ea
Adds a skip message for analyzer (#158890)
#158880 causes the linux analyzer to complain for not having a skip
message.
2024-11-13 14:38:56 -08:00
Loïc Sharma
8a55c941cf
[SwiftPM] Move the logic for SwiftPM enablement to the platform project (#158213)
In the future, it will be possible for Swift Package Manager to be enabled on one but not all platforms (see https://github.com/flutter/flutter/issues/151567#issuecomment-2455941279).

This moves the `usesSwiftPackageManager` property from the platform-agnostic `Project` to the platform-specific `IosProject` and `MacOSProject`.

This will allow the `IosProject` and `MacOSProject` to return different values for `usesSwiftPackageManager` in the future. For now, both of these projects will always return the same value.

Part of https://github.com/flutter/flutter/issues/151567
2024-11-13 21:45:07 +00:00
Matan Lurey
5a9c2b4dd1
Temporarily skip flutter build apk for native_assets tests. (#158880)
Work around for https://github.com/flutter/flutter/issues/158560.
2024-11-13 20:57:13 +00:00
Matan Lurey
7374452eca
Stream the output of flutter build for debugging. (#158757)
Towards https://github.com/flutter/flutter/issues/158560.
2024-11-13 18:55:47 +00:00
Matan Lurey
ed553d10cf
Avoid using platform ProcessInfo.maxRss in test. (#158526)
Closes https://github.com/flutter/flutter/issues/157629.

Avoids failures in the style:
```txt
00:37 +4597 ~3 -1: /Users/matanl/Developer/flutter/packages/flutter_tools/test/commands.shard/permeable/build_appbundle_test.dart: analytics logs success [E]                                                                                                        
  Expected: contains Event:<{"eventName":"flutter_command_result","eventData":{"commandPath":"create","result":"success","commandHasTerminal":false,"maxRss":147013632}}>
    Actual: [
              Event:{"eventName":"command_usage_values","eventData":{"workflow":"create","commandHasTerminal":false,"createProjectType":"app","createAndroidLanguage":"kotlin","createIosLanguage":"swift"}},
              Event:{"eventName":"flutter_command_result","eventData":{"commandPath":"create","result":"success","commandHasTerminal":false,"maxRss":143261696}},
              Event:{"eventName":"timing","eventData":{"workflow":"flutter","variableName":"create","elapsedMilliseconds":527,"label":"success"}},
              Event:{"eventName":"command_usage_values","eventData":{"workflow":"appbundle","commandHasTerminal":false,"buildAppBundleTargetPlatform":"android-arm,android-arm64,android-x64","buildAppBundleBuildMode":"release"}},
              Event:{"eventName":"flutter_command_result","eventData":{"commandPath":"appbundle","result":"success","commandHasTerminal":false,"maxRss":147013632}},
              Event:{"eventName":"timing","eventData":{"workflow":"flutter","variableName":"appbundle","elapsedMilliseconds":10,"label":"success"}}
            ]
     Which: does not contain Event:<{"eventName":"flutter_command_result","eventData":{"commandPath":"create","result":"success","commandHasTerminal":false,"maxRss":147013632}}>
```

I am guessing <https://api.flutter.dev/flutter/dart-io/ProcessInfo/maxRss.html> is not guaranteed to be stable while running, and as a result is not. This stabilizes the value for a test that I believe does not care about getting the "real" value anyway.
2024-11-13 18:03:58 +00:00
Matan Lurey
2d1a3efc38
Move dart pub deps call to <Pub>.deps and use it accordingly (#158524)
Closes https://github.com/flutter/flutter/issues/158396, closes https://github.com/flutter/flutter/pull/158370.
2024-11-13 18:03:53 +00:00
Matan Lurey
a0f2154419
Allow devDependencies to be omitted and not cause a tool crash. (#158518)
Closes https://github.com/flutter/flutter/issues/158441.
2024-11-13 01:04:01 +00:00
Matan Lurey
72fc9b4b37
Explain how to use flutter channel. (#158533)
Closes https://github.com/flutter/flutter/issues/152274.

I ran into https://github.com/flutter/flutter/issues/152274 myself, so seemed like an easy fix.
2024-11-13 00:42:00 +00:00
Loïc Sharma
003135e2d0
[SwiftPM] Update .flutter-plugin-dependencies format (#158138)
In the future, it will be possible for Swift Package Manager to be enabled on one but not all platforms (see https://github.com/flutter/flutter/issues/151567#issuecomment-2455941279).

This updates the `.flutter-plugin-dependencies` file format to separate iOS's and macOS's SwiftPM enablement. For now, these platforms will always have the same value.

This `.flutter-plugin-dependencies` file is read by our CocoaPods scripts to determine whether we should use CocoaPods or not to inject plugins.

Part of https://github.com/flutter/flutter/issues/151567
2024-11-12 20:01:26 +00:00
Andrew Kolos
37d80ce25f
add filesystem error handling to systemTempDirectory (#158481)
Fixes https://github.com/flutter/flutter/issues/153777.

To summarize that issue, `ErrorHandlingFileSystem.systemTempDirectory` calls [`LocalFileSystem.systemTempDirectory`](45c8881eb2/packages/flutter_tools/lib/src/base/file_system.dart (L229)), which makes a `Directory.createSync` call, which can throw exceptions that _should_ be handled and result in a graceful tool exit (e.g. insufficient storage). However, we aren't catching those, hence this issue. 

All we need to do is wrap that call with the `FileSystemException`-handling logic we already have in the tool. See the diff.

I don't think I'll be cherry-picking this since 1) it's not an extremely common crash and 2) users can probably pick apart the crash message and figure out that they need to clear some storage space to proceed.

<details>

<summary> Pre-launch checklist </summary> 

</details>
2024-11-12 18:14:45 +00:00
Ben Konyi
d89e65d516
Replace custom RPCErrorCodes with RPCErrorKind from package:vm_service (#158379)
Removes duplicated constants and ensures consistency by using package:vm_service as a source of truth for RPC error codes for requests made with package:vm_service.
2024-11-11 15:18:09 +00:00
Younghan Kim
18071ec0a8
Remove block and line comments when detecting '.flutter-plugins' in settings.gradle(.kts) (#155488)
**PR Title:**

Remove block and line comments when detecting `'.flutter-plugins'` in `settings.gradle`

---

**Description:**

This PR modifies the `configureLegacyPluginEachProjects` function to remove block (`/* ... */`) and line (`// ...`) comments from the `settings.gradle` or `settings.gradle.kts` file content before checking for the presence of the `'.flutter-plugins'` string. This ensures that only uncommented, meaningful code is considered during the detection, preventing false positives when the string appears within comments.

**Why is this change necessary?**

In some cases, the `'.flutter-plugins'` string may be present inside comments in the `settings.gradle` file. The existing implementation does not account for this and may incorrectly detect the string even when it's commented out. This can lead to unintended behavior, such as configuring plugin projects when it is not necessary.

By removing comments before performing the check, we prevent false positives and ensure that the detection logic is accurate, only acting when the `'.flutter-plugins'` string is present in active code.

**Changes Made:**

- **Added comment removal logic:**
  - Removed block comments (`/* ... */`) using the regular expression `/(?s)\/\*.*?\*\//`.
    - The `(?s)` flag enables dot-all mode, allowing `.` to match newline characters.
  - Removed line comments (`// ...`) using the regular expression `/(?m)\/\/.*$`.
    - The `(?m)` flag enables multi-line mode, so `^` and `$` match the start and end of each line.
  - Combined both comment removal steps into a single chain for efficiency.

- **Updated the string detection:**
  - The check for `'.flutter-plugins'` is now performed on the uncommented content of the `settings.gradle` file.
  - This ensures that only meaningful, uncommented code is considered during detection.

**Issue Fixed:**

- Fixes [#155484](https://github.com/flutter/flutter/issues/155484)

---

---

If you need any further assistance or have questions, feel free to reach out!

---

**Links:**

- [Contributor Guide]
- [Tree Hygiene]
- [Flutter Style Guide]
- [Features we expect every widget to implement]
- [CLA]
- [flutter/tests]
- [breaking change policy]
- [Discord]
- [Data Driven Fixes]
2024-11-11 02:47:32 +00:00
Phil Quitslund
e222381e29
remove redundant arguments (#158349)
An upcoming fix to the analyzer will (correctly) catch these args as
redundant
(https://dart-review.googlesource.com/c/sdk/+/394004/2/pkg/analyzer/lib/src/dart/ast/ast.dart).

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-11-08 09:30:26 -08:00
Ben Konyi
998f42a3f0
Increase Java heap limit to 8GB for plugin integration tests using deferred components (#158330)
Should help resolve https://github.com/flutter/flutter/issues/156953
2024-11-07 15:24:25 -05:00
Matan Lurey
3c689ce6b7
Fix a breakage caused by the test being unskipped. (#158335)
https://github.com/flutter/flutter/pull/158204 collided with
https://github.com/flutter/flutter/pull/157462.

Fortunately the change is 1-line in 1-test.
2024-11-07 10:16:18 -08:00
Matan Lurey
78cfc1ae9b
Plugin.isDevDependency if exclusively in dev_dependencies (#157462)
Work towards https://github.com/flutter/flutter/issues/56591.

I explicitly want an LGTM from @andrewkolos @jmagman @jonahwilliams before merging.

---

After this PR, `<Plugin>.isDevDependency` is resolved based on the following logic, IFF:

- The plugin comes from a package _A_ listed in the app's package's `dev_dependencies: ...`
- The package _A_ is not a normal dependency of any transitive non-dev dependency of the app

See [`compute_dev_dependencies_test.dart`](51676093a3/packages/flutter_tools/test/general.shard/compute_dev_dependencies_test.dart) for probably the best specification of this behavior.

We (still) do not write the property to disk (i.e. it never makes it to `.flutter-plugins-dependencies`), so there is no impact to build artifacts at this time; that would come in a follow-up PR (and then follow-up follow-up PRs for the various build systems in both Gradle and Xcode to actually use that value to omit dependencies).

Some tests had to be updated; for the most part it was updating the default `ProcessManager` because a call to `dart pub deps --json` is now made in code that computes what plugins are available, but there should be no change in behavior.

_/cc @jonasfj @sigurdm for FYI only (we talked on an internal thread about this; see https://github.com/dart-lang/sdk/issues/56968)._

_/cc @camsim99 @cbracken @johnmccutchan for visibility on the change._
2024-11-07 18:09:22 +00:00
Ben Konyi
933323488b
Fix flakiness in hot_reload_test.dart (#158271)
The test was immediately checking the contents of stdout after the daemon indicated that the hot reload had completed. This could cause a race since the reloaded code may not have had time to execute.

Fixes https://github.com/flutter/flutter/issues/158245
2024-11-06 22:14:19 +00:00
Gray Mackall
b8e56e3063
Fix use of deprecated buildDir in Android templates/tests/examples (#157560)
Replace deprecated `Project.buildDir` [getter](https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#getBuildDir()) and [setter](https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#setBuildDir(java.io.File)) uses.
2024-11-06 21:34:23 +00:00
Martin Kustermann
3a83e43ede
Make flutter_tools use newest package:{native_assets_builder,native_assets_cli,native_toolchain_c} (#158214)
Almost all of the code is just adopting to changes to the APIs of
`package:native_assets_builder`, `package:native_assets_cli` and
`package:native_toolchain_c`

There's only two semantic changes

* Removes a test that checks for a verification error if a build hook
produces a static library if the preferred linking mode is dynamic:
=> The test is written in a very hacky way. By monkey patching the build
config.json that flutter build actually made. This monkey patching
relies on package:cli_config which is now no longer used.
=> The actual code that checks for this mismatch lives in
dart-lang/native repository and is tested there. So there's really no
need to duplicate that.

* The `package:native_assets_builder` no longer knows about code assets.
This is something a user of that package (e.g. flutter tools) adds. Now
the dry-run functionality will invoke build hooks who produce code
assets without an architecture.
=> The `package:native_assets_builder` used to expand such a code asset
to N different code assets (one for each supported architecture)
=> This logic was now moved to flutter tools. => In the near future
we're going to this dry-run complexity, which will then also get rid of
this uglyness (of expanding to all archs of an OS).
2024-11-06 14:12:34 +01:00
LouiseHsu
dff191625f
Update error message for Cocoapods support for synchronized groups/folders (#158206)
Update to https://github.com/flutter/flutter/issues/156733
2024-11-06 01:08:54 +00:00
Matan Lurey
2f7a1aa20b
Restore skipped iOS test by looping over FakeAsync elapse. (#158204)
Closes https://github.com/flutter/flutter/issues/60675.

From what I can tell `FakeAsync` wasn't necessary to making this be testable (or at least it isn't anymore?)
2024-11-06 01:05:01 +00:00
Matan Lurey
0b6f99769d
Remove observatory related TODO that is already fixed. (#158205)
Description intentionally left blank :)
2024-11-05 23:43:50 +00:00
Andrew Kolos
8d3cca43b2
use root directory as the default for rootOverride in Cache.test constructor (#158201)
While doing some hacking on `Cache` in https://github.com/flutter/flutter/pull/158081, I noticed that [`Cache.test`](de93182753/packages/flutter_tools/lib/src/cache.dart (L139)) allows the caller to tell Cache to use some given directory as the flutter root (instead of depending on the static global [`Cache.flutterRoot`](4f3976a4f2/packages/flutter_tools/lib/src/cache.dart (L206))). This has a default value, `/cache`. However, `/cache` is an unintuitive name for the root directory of a Flutter installation.

This led to confusion when updating some tests. I wanted to create `/bin/cache/engine-dart-sdk.stamp` for tests, but in reality I needed to create `/cache/bin/cache/engine-dart-sdk.stamp`.

This PR changes this default to the current directory of the file system (which I'm guessing is `/` for all intents and purposes). 

<details>

<summary> Pre-launch checklist </summary> 

</details>
2024-11-05 23:00:05 +00:00
Jenn Magder
b6fef5cfda
Kill interactive script job xcdevice observe processes on tool/daemon shutdown (#157646)
To convince `xcdevice observe` to redirect to stdout it's being launched in an interactive shell `/usr/bin/script -t 0 /dev/null /usr/bin/arch -arm64e xcrun xcdevice observe --usb`
1cc8a07ace/packages/flutter_tools/lib/src/macos/xcdevice.dart (L261-L263)

When the `flutter` command exits, the interactive script process is terminated, but not its jobs `xcdevice observe --usb`.

Instead of `-9` sigterm killing the interactive script, send it a [`SIGHUP`](https://linux.die.net/Bash-Beginners-Guide/sect_12_01.html#sect_12_01_01_02) (signal hangup) during `XCDevice.dispose()`, which will exit its processes.  Add a shutdown hook to ensure `dispose` is run when the process exits.

Fixes https://github.com/flutter/flutter/issues/73859
2024-11-05 19:01:01 +00:00
Polina Cherkasova
b8519bc21e
Reland2: Revert "Revert "Add a warning/additional handlers for parsingsynthetic-package."" (#158184)
Reverts flutter/flutter#158078
2024-11-05 09:42:57 -08:00
Polina Cherkasova
04d3d1a4c3
Reland1: "Revert "Add and plumb useImplicitPubspecResolution across flutter_tools."" (#158126)
Reverts flutter/flutter#158076
2024-11-05 08:49:42 -08:00
Martin Kustermann
31c1292be3
Make native asset integration test more robust, thereby allowing smooth auto-update of packages via flutter update-packages (#158170)
Currently the bot that runs `flutter update-packages` makes PRs that
fail due to native asset integration tests failing.

The root cause is due to incompatible versions on `package:logging`. The
bot tries to upgrade `package:logging` from `1.2.0` to `1.3.0`.

Here's what seems to happen:

* `flutter update-packages` will update
`dev/integration_tests/link_hook/pubspec.yaml` with `package:logging` to
`1.3.0` (as it does with all other `pubspec.yaml` files in the flutter
repository)

* `flutter create --template=package_ffi` will generate a template with
`package:logging` `^1.2.0`

  * The test in question
    * creates ffi template (which will use `^1.2.0`)
* make it depend on `dev/integration_tests/link_hook` (which uses
`=1.3.0`)
* changes logging dependency from the template from `^1.2.0` to `=1.2.0`

IMHO

  * `flutter update-packages` is doing what it's supposed to

* `flutter create --template=package_ffi` can generate templates with
versions it determines (maybe there are use cases where we want to
generate templates with older versions)

  * The problematic part is the test:

     * it makes the generated template depend on `link_hook` and
     * changes template generated pubspec to use pinned dependencies

This PR makes the test package (created via template) use the pinned
package versions from `dev/integration_tests/link_hook` (for
dependencies that are common among the two).
All other dependencies that the template has on top of
`dev/integration_tests/link_hook` it can pin as it does currently.

This will give us deterministic CI behavior (as we use flutter pined
packages and remaining deps being pinned via template) It avoids
changing the `flutter update-packages` and `flutter create
--template=package_ffi` (as their behavior seems reasonable)

Should fix https://github.com/flutter/flutter/issues/158135
2024-11-05 16:08:34 +01:00
Matan Lurey
cc90a424c9
Extract and restore a test that a blank native assets project still builds (#158141)
Closes https://github.com/flutter/flutter/issues/158120.

This PR restores the skipped test, moving it (and the test utility only used by the test) into a standalone file that can be more easily understood. As part of the change the version of `native_assets_cli` is now derived from the (checked-in) `package_ffi/pubspec.yaml.tmpl`, meaning that it should be hard to get into a bad state again.

/cc @christopherfujino (You are welcome to review, but otherwise will defer to Brandon and Victor).
2024-11-05 01:39:25 +00:00
Victor Sanni
f19d329ac0
Disable failing native assets test (#158119)
## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-11-04 11:29:26 -08:00
Polina Cherkasova
0505176f1b
Revert "Add and plumb useImplicitPubspecResolution across flutter_tools." (#158076)
Reverts flutter/flutter#157879 to unblock flutter roll.

Prerequisite reverts:
https://github.com/flutter/flutter/pull/157934

Reason: b/377107864
2024-11-03 17:29:24 +00:00
Polina Cherkasova
f7b24fa525
Revert "Add a warning/additional handlers for parsingsynthetic-package." (#158078)
Reverts flutter/flutter#157934 to unblock https://github.com/flutter/flutter/pull/158076 and then flutter roll.

Reason: b/377107864
2024-11-03 17:12:20 +00:00
Loïc Sharma
3699474585
Make SwiftPM integration tests even MORE idiomatic (#158014)
Reach peak idiomacy by replacing `expect(file.existsSync(), isTrue)` with `expect(file, exists)`!

Follow up to: https://github.com/flutter/flutter/pull/157971
2024-11-01 20:00:04 +00:00
Matan Lurey
2ce743d0f0
Remove unnecessary kCliAnimationsFeatureName that is available as .configSetting. (#158013)
... for consistency with the rest of the file/features.
2024-11-01 19:20:59 +00:00
Loïc Sharma
49ccfb7302
Make the SwiftPM integration tests more idiomatic (#157971)
I recommend reviewing with [whitespace changes disabled](https://github.com/flutter/flutter/pull/157971/files?diff=split&w=1).

Changes:

1. Replaces `expect(string.contains('foo'), isTrue)` with `expect(string, contains('foo'))`
2. Replaces `try/finally` with `addTearDown`

Follow-up to: https://github.com/flutter/flutter/pull/157482#discussion_r1813939657
2024-11-01 18:15:15 +00:00
Matan Lurey
d77d7c3f36
Add a warning/additional handlers for parsingsynthetic-package. (#157934)
Closes https://github.com/flutter/flutter/issues/157928.
Closes https://github.com/flutter/flutter/issues/157929.

| Condition | Expectation |
| --------- | ------------ |
| `synthetic-packages: true` && `--implicit-pubpsec-resolution` | Generates `flutter_gen` with warning.
| `<no synthetic-packages key>` && `--implicit-pubspec-resolution` | Generates `flutter_gen` with warning.
| `synthetic-packages: false` && `--implicit-pubpsec-resolution` | Does not generate `flutter_gen`.
| `synthetic-packages: true` && `--no-implicit-pubpsec-resolution` | Error.
| `<no synthetic-packages key>` && `--no-implicit-pubspec-resolution` | Does not generate `flutter_gen`.
| `synthetic-packages: false` && `--no-implicit-pubpsec-resolution` | Generates `flutter_gen` with warning.
2024-11-01 00:45:07 +00:00
Matan Lurey
8d7513efb6
Renames injectBuildTimePluginFilesForWebPlatform and removes unused named parameter. (#157944)
Closes https://github.com/flutter/flutter/issues/157943.

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-10-31 15:48:23 -07:00
Matan Lurey
fb022290ff
Add and plumb useImplicitPubspecResolution across flutter_tools. (#157879)
Work towards https://github.com/flutter/flutter/issues/157819. **No behavior changes as a result of this PR**.

Based on a proof of concept by @jonahwilliams (https://github.com/flutter/flutter/pull/157818).

The existence of this flag (which for the time being, defaults to `true`) implies the following:

1. The (legacy, deprecated) `.flutter-plugins` file is not generated:
    https://docs.flutter.dev/release/breaking-changes/flutter-plugins-configuration
    
2. The (legacy, deprecated) `package:flutter_gen` is not synthetically generated:
    https://github.com/flutter/website/pull/11343
    (awaiting website approvers, but owners approve this change)

This change creates `useImplicitPubspecResolution` and plumbs it through as a required variable, parsing it from a `FlutterCommand.globalResults` where able. In tests, I've defaulted the value to `true` 100% of the time - except for places where the value itself is acted on directly, in which case there are true and false test-cases (e.g. localization and i10n based classes and functions).

I'm not extremely happy this needed to change 50+ files, but is sort of a result of how inter-connected many of the elements of the tools are. I believe keeping this as an explicit (flagged) argument will be our best way to ensure the default behavior changes consistently and that tests are running as expected.
2024-10-31 10:43:25 +00:00
LouiseHsu
ec04707feb
Adds a new helpful tool exit message for SocketExceptions thrown during mdns discovery (#157638)
Addresses https://github.com/flutter/flutter/issues/150131, but doesn't fix it, as there seem to be cases where the steps included in the messages added in this PR don't work.
2024-10-30 21:20:25 +00:00
Gray Mackall
55c026a230
Upgrade templates to AGP 8.7/Gradle 8.10.2 (#157872)
These are the versions we use in test, as of https://github.com/flutter/flutter/pull/157617.

Motivated by noticing a warning with the old template version:
```
This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
You are strongly encouraged to update your project to use a newer
Android Gradle plugin that has been tested with compileSdk = 35.
```
2024-10-30 18:54:06 +00:00
Matan Lurey
e6c9fce313
Add hidden --no-implicit-pubspec-resolution flag for one stable release. (#157635)
Closes https://github.com/flutter/flutter/issues/157532.

Work towards https://github.com/flutter/flutter/issues/157819.

Because this flag is checked in `FlutterCommand.verifyAndRun`, it seemed cleaner to just make it a global flag - particularly because this flag's longevity is unlikely to be longer than a single stable release.
2024-10-30 17:00:32 +00:00
Matan Lurey
1068d31382
Fix and remove a few no-shuffle tags in flutter_tools. (#157656)
Two of the tests, `test_test` and `break_on_framework_exceptions`, no longer appear to leak (without changes). Perhaps underlying infrastructure has changed, or some other bug in the tool itself was fixed in meantime.

`packages_test` required resetting `Cache.flutterRoot`.

Work towards https://github.com/flutter/flutter/issues/85160.
2024-10-29 19:01:54 +00:00
Gray Mackall
42132e879b
Reland "Upgrade tests to AGP 8.7/Gradle 8.10.2/Kotlin 1.8.10" (#157617)
Reland of https://github.com/flutter/flutter/pull/157032.

Failed tests for initial land: 
https://flutter-dashboard.appspot.com/#/build?hashFilter=5ca6350a06fdae8d3e160f9adbece193f34d0302&repo=flutter&branch=master

These two tests run the same `flavors_test`
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20flavors_test/4579/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Windows_mokey%20flavors_test_win/988/overview
which is now passing
https://ci.chromium.org/ui/p/flutter/builders/try/Linux_pixel_7pro%20flavors_test/37/overview
(fixed by 23c62df1dc)

The other failures seem to be flakes
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20new_gallery_impeller_old_zoom__transition_perf/4902/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20tool_integration_tests_2_5/1247/overview
the first is a timeout, the second passed in presubmit on the original PR and also on this PR.
2024-10-29 18:01:19 +00:00
Matan Lurey
a4167b7cf2
Remove unused PubDependenciesProjectValidator. (#157516)
Closes https://github.com/flutter/flutter/issues/157479.

This came up while I was looking at parsing the results of `dart pub deps --json`, turns out it isn't used.
2024-10-24 22:05:50 +00:00
auto-submit[bot]
b98d9a37ac
Reverts "Upgrade tests to AGP 8.7/Gradle 8.10.2/Kotlin 1.8.10 (#157032)" (#157559)
Reverts: flutter/flutter#157032
Initiated by: gmackall
Reason for reverting: https://github.com/flutter/flutter/pull/157032#issuecomment-2436336078
Original PR Author: gmackall

Reviewed By: {reidbaker, bartekpacia}

This change reverts the following previous change:
I recently noticed the following log when building an app in verbose mode:
```
This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
You are strongly encouraged to update your project to use a newer
Android Gradle plugin that has been tested with compileSdk = 35.
```

It looks like AGP would like us to use a newer AGP version if we want to use compileSdk 35 (which we do). This pr upgrades the tests, in advance of updating the templates.
2024-10-24 21:06:16 +00:00
Gray Mackall
5ca6350a06
Upgrade tests to AGP 8.7/Gradle 8.10.2/Kotlin 1.8.10 (#157032)
I recently noticed the following log when building an app in verbose mode:
```
This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
You are strongly encouraged to update your project to use a newer
Android Gradle plugin that has been tested with compileSdk = 35.
```

It looks like AGP would like us to use a newer AGP version if we want to use compileSdk 35 (which we do). This pr upgrades the tests, in advance of updating the templates.
2024-10-24 20:08:45 +00:00
Matan Lurey
dc13c3bfb7
Allow opting out of .flutter-plugins, opt-out in refreshPluginsList. (#157527)
Work towards https://github.com/flutter/flutter/issues/48918.

Workaround for https://github.com/flutter/flutter/issues/157391 (see https://github.com/flutter/flutter/pull/157393#issuecomment-2434336047).

I'll run all post-submit tasks as well on this PR using `test: all`.
2024-10-24 20:01:45 +00:00
Loïc Sharma
bf319d6213
Add partial test for flutter build ios-framework on non-module (#157482)
Add a partial test for running `flutter build ios-framework` on a regular app project (not a module).

Follow-up to this conversation: https://github.com/flutter/flutter/pull/157393/files#r1811810540

Part of https://github.com/flutter/flutter/issues/146957
2024-10-24 18:53:09 +00:00
LouiseHsu
bade5591bf
Prevent flutter build ios-framework --xcframework from copying Flutter.xcframework.dSYM into the App.framework folder. (#157394)
Fixes https://github.com/flutter/flutter/issues/157359

Prevents Flutter.xcframework.dSYM from being copied into the App.framework folder. I am not 100% positive if there are cases where it's valid to have multiple dSYMs in that folder, so I'm just string matching and filtering out `Flutter.xcframework.dSYM`
2024-10-23 23:35:10 +00:00
Matan Lurey
5a1ae9779d
Remove the only reference to settings.gradle.legacy_versions. (#157380)
Code references:
https://github.com/search?q=repo%3Aflutter%2Fflutter%20%22legacy_versions%22&type=code.

Closes https://github.com/flutter/flutter/issues/87922.

Work towards https://github.com/flutter/flutter/issues/48918.
2024-10-22 14:03:50 -07:00
René Kilczan
48149781f2
Add windows build version detection (#154797)
With this PR flutter doctor will report the actual Windows version. This
resolves #154796

<!-- *If you had to change anything in the [flutter/tests] repo, include
a link to the migration guide as per the [breaking change policy].* -->

The flutter doctor result is with this patch like this:
```
[√] Flutter (Channel stable, 3.24.2, on Microsoft Windows [Version 10.0.22631.4037], locale de-DE)
[√] Windows Version (Windows 11 - 23H2)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)
[√] Android Studio (version 2024.1)
[√] Connected device (3 available)
[√] Network resources

• No issues found!
```

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-10-22 15:53:08 -04:00
Jenn Magder
e38eb756bc
Test alternate correct macOS framework xcprivacy manifest location (#157318)
Cherry-pick the beta branch test https://github.com/flutter/flutter/pull/157136 back to master  so this doesn't regress in the next beta.

This is the framework test for https://github.com/flutter/flutter/issues/157016 on master.  Engine fix can be merged once this merges.
2024-10-22 19:41:14 +00:00
Bartek Pacia
eb5ef69d6b
Use Gradle KTS in new Android app projects by default (2nd try) (#157195)
This PR resolves #151166

This PR relands #154061
2024-10-22 17:28:31 +00:00
Jason Simmons
8b4d48715b
Ensure that the build system checks for updates of locally built flutter_web_sdk artifacts (#156534)
The SourceVisitor uses the engineVersion parameter to determine whether it needs to check for changes to artifacts or if it can assume that artifacts are unmodified from a versioned build of the engine.  engineVersion is set based on whether the Artifacts instance sets the isLocalEngine property.

CachedLocalWebSdkArtifacts (instantiated when the --local-web-sdk flag is used) was only setting isLocalEngine if --local-engine was also used.  This caused the build system to ignore changes to the files in the locally built flutter_web_sdk when using --local-web-sdk alone.

This PR renames Artifacts.isLocalEngine to usesLocalArtifacts in order to clarify what it means.  It also changes CachedLocalWebSdkArtifacts to always enable usesLocalArtifacts.
2024-10-21 22:52:29 +00:00
Parker Lougheed
1995a6cba1
Migrate away from deprecated whereNotNull (#157250) 2024-10-21 19:25:54 +00:00
Jackson Gardner
e19d352fc9
Add support for flutter build web --debug. (#157186)
There have been various requests for this for a while. See https://github.com/flutter/flutter/issues/96283 for an example. This has become more important with dart2wasm builds in the mix, as the profiling versions of the dart2wasm builds are a lot less debuggable than the debug versions. Most of this is already wired up so it just requires taking out a few explicit checks for it and making sure that we compile with the right optimization levels when compiling debug.
2024-10-21 15:35:11 +00:00
Andrew Kolos
3512745071
make ChromiumDevice.stopApp a no-op if it has already been called (#156778)
(Hopefully) fixes https://github.com/flutter/flutter/issues/156700

To summarize that thread, there are a few ways to trigger cleanup logic
in `flutter run -d chrome`. For example, pressing `q` will close Chrome,
but Chrome closing triggers cleanup logic in the resident runner (which
includes trying to close Chrome, which is redundant).

A simple way to fix this is to not call `Chrome.close` in
`ChromiumDevice.stopApp` when we've already called it once. This
solution isn't ideal—consider a scenario where two calls to `stopApp`
are made concurrently. The second one would probably complete before the
browser is actually closed. However, I don't foresee anything ever
depending on `stopApp` finishing implying that the browser is closed.

I feel like there might be a yak to shave here (`ResidentWebRunner`
could keep track of its state and not initiate redundant cleanup
operations), but I am not sure its worth the continued effort.

<details>

<summary> Pre-launch checklist </summary> 


- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

</details>

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-10-21 11:28:30 -04:00
auto-submit[bot]
9a41f11610
Reverts "Use Gradle KTS in new Android app projects by default (#154061)" (#157194)
Reverts: flutter/flutter#154061
Initiated by: QuncCccccc
Reason for reverting: might be the reason that cause Framework tree to red
Original PR Author: bartekpacia

Reviewed By: {gmackall, reidbaker}

This change reverts the following previous change:
This PR resolves #151166
2024-10-18 21:14:46 +00:00
Bartek Pacia
d3c54a115f
Use Gradle KTS in new Android app projects by default (#154061)
This PR resolves #151166
2024-10-18 20:46:01 +00:00
flutter-pub-roller-bot
0549bd8888
Roll pub packages (#156925)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-10-18 20:17:18 +00:00
Matej Knopp
32cb866d3a
Fix native assets failing to build with AGP 8.4 and multiple flavors (#155039)
The nativeAssetDir is not flavor specific and it should only be added to the jniLibs.scrDir once.

Fixes https://github.com/flutter/flutter/issues/155038

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-10-18 19:33:22 +00:00
Gray Mackall
c49ec359a2
Add handler for jlink error when using Java 21 (#157132)
Fixes https://github.com/flutter/flutter/issues/156304.
Also fixes https://github.com/flutter/flutter/issues/155449.

Unfortunately, because the error handler only sees one line at a time, it is hard to make this handling any more specific than this. If we run in to another jlink related error (unlikely) between now and when we phase out support for AGP 8.2.0 and below, we might have trouble differentiating them. We should delete the error handler when we phase out support for those versions.

Example of handled error output:
```
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared_preferences_android:compileReleaseJavaWithJavac'.
> Could not resolve all files for configuration ':shared_preferences_android:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: /Users/mackall/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /Users/mackall/Desktop/JDKs/21/jdk-21.0.2.jdk/Contents/Home/bin/jlink with arguments {--module-path /Users/mackall/.gradle/caches/8.9/transforms/2890fec03da42154757073d3208548e5-79660961-f91d-4df2-90bc-b9a3f2a270bd/transformed/output/temp/jmod --add-modules java.base --output /Users/mackall/.gradle/caches/8.9/transforms/2890fec03da42154757073d3208548e5-79660961-f91d-4df2-90bc-b9a3f2a270bd/transformed/output/jdkImage --disable-plugin system-modules}

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
Running Gradle task 'assembleRelease'...                         2,100ms

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] This is likely due to a known bug in Android Gradle Plugin (AGP) versions less than 8.2.1, when                                   │
│   1. setting a value for SourceCompatibility and                                                                                      │
│   2. using Java 21 or above.                                                                                                          │
│ To fix this error, please upgrade your AGP version to at least 8.2.1. The version of AGP that your project uses is likely defined in: │
│ /Users/mackall/development/BugTesting/fifth/android/settings.gradle,                                                                  │
│ in the 'plugins' closure (by the number following "com.android.application").                                                         │
│  Alternatively, if your project was created with an older version of the templates, it is likely                                      │
│ in the buildscript.dependencies closure of the top-level build.gradle:                                                                │
│ /Users/mackall/development/BugTesting/fifth/android/build.gradle,                                                                     │
│ by the number following "com.android.tools.build:gradle:".                                                                            │
│                                                                                                                                       │
│ For more information, see:                                                                                                            │
│ https://b.corp.google.com/issues/294137077                                                                                            │
│ https://github.com/flutter/flutter/issues/156304                                                                                      │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Gradle task assembleRelease failed with exit code 1
```
2024-10-18 19:06:16 +00:00
Nate Wilson
6b1bc456f4
Arrow syntax for getters (#156483)
This egotistical PR aims to draw attention to a [style guideline](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#use--for-getters-and-callbacks-that-just-return-literals-or-switch-expressions) that I changed:

> #### Use `=>` for getters and callbacks that just return literals or switch expressions

<br>

There was an opportunity for valuable discussion in #154753 about how this structure affects readability, but I shut it down pretty quick since there was a lot of other stuff going on there.

Interested to hear thoughts from @Piinks and others.
2024-10-17 19:25:14 +00:00
LouiseHsu
53bff28f2b
Add a tool warning when pod install does not work after adding a new test/watch/extension/other target with Xcode 16 (#156758)
Running `pod install` on Xcode projects with new test/targets in Xcode 16 will fail. Since this is a [Cocoapods bug](https://github.com/CocoaPods/CocoaPods/issues/12456), this PR adds a warning to the tool that links to a github work around and the current tracking issue.

Fixes https://github.com/flutter/flutter/issues/156733
<img width="567" alt="Screenshot 2024-10-14 at 14 48 39" src="https://github.com/user-attachments/assets/6befa601-4041-46fc-9ca2-f57662adda4a">
2024-10-16 18:58:07 +00:00
Mikhail Novoseltsev
ae6d79336e
[tool] fix android studio preview's version parsing (#156293)
This PR willing to fix issue when `flutter doctor` validator can't determine version of Android Studio EAP.

These are before/after outputs of `flutter doctor -v` showcasing change in behaviour of validator. Each output has 3 `Android Studio` sections, 1 for stable and 2 for different EAP versions. 

<details>
<summary>before, (stable, 3.24.3), 2 issues related to versions of Android Studio</summary>

```console
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.7 23H124 darwin-arm64, locale en-RU)
    • Flutter version 3.24.3 on channel stable at /Users/samer/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/samer/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Users/samer/Library/Java/JavaVirtualMachines/jbr-17.0.7/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment JBR-17.0.7+7-964.1-nomod (build 17.0.7+7-b964.1)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode-16.0.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[!] Android Studio (version unknown)
    • Android Studio at /Users/samer/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[!] Android Studio (version unknown)
    • Android Studio at /Users/samer/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] IntelliJ IDEA Ultimate Edition (version EAP IU-243.12818.47)
    • IntelliJ at /Users/samer/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.94.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (5 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554             • android-arm64  • Android 15 (API 35) (emulator)
    • iPhone (Михаил) (mobile)        • 00008020-001254DA1E39002E • ios            • iOS 17.6.1 21G93
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.7 23H124 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.7 23H124 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 129.0.6668.90
    ! Error: Browsing on the local area network for Михаил Новосельцев’s iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.
```
</details>

<details>
<summary>after,  no issues regarding Android Studio</summary>

```console
[!] Flutter (Channel [user-branch], 3.26.0-1.0.pre.383, on macOS 14.7 23H124 darwin-arm64, locale en-RU)
    ! Flutter version 3.26.0-1.0.pre.383 on channel [user-branch] at /Users/samer/projects/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    • Upstream repository git@github.com:Sameri11/flutter.git
    • FLUTTER_GIT_URL = git@github.com:Sameri11/flutter.git
    • Framework revision 852508425d (20 minutes ago), 2024-10-07 21:22:45 +0500
    • Engine revision 683a14c1f1
    • Dart version 3.6.0 (build 3.6.0-326.0.dev)
    • DevTools version 2.40.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update
      checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/samer/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Users/samer/Library/Java/JavaVirtualMachines/jbr-17.0.7/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment JBR-17.0.7+7-964.1-nomod (build 17.0.7+7-b964.1)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode-16.0.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] Android Studio (version 2024.2.2)
    • Android Studio at /Users/samer/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] Android Studio (version 2024.2.1)
    • Android Studio at /Users/samer/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] IntelliJ IDEA Ultimate Edition (version EAP IU-243.12818.47)
    • IntelliJ at /Users/samer/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.94.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (5 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554             • android-arm64  • Android 15 (API 35) (emulator)
    • iPhone (Михаил) (mobile)        • 00008020-001254DA1E39002E • ios            • iOS 17.6.1 21G93
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.7 23H124 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.7 23H124 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 129.0.6668.90
    ! Error: Browsing on the local area network for Михаил Новосельцев’s iPad. Ensure the device is unlocked and attached with a cable or
      associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```
</details>

Logic behind these changes explained in https://github.com/flutter/flutter/issues/121925#issuecomment-2352826925 

fixes #121925

**Tests**: updated existing tests by adding version checking, but I don't mind writing new ones if necessary – please tell me if so.
2024-10-16 15:56:31 +00:00
Siva
4715296249
Fix JS compilation to use the command 'compile js' instead of using snapshot names to invoke dart2js (#156735)
Fix JS compilation to use the command 'compile js' instead of using
snapshot names to invoke dart2js

The Dart SDK is switching all tools to use AOT snapshots instead of JIT
snapshots and using snapshot names directly causes things to break.
2024-10-15 15:28:27 -07:00
Andrew Kolos
2dad95b21c
Fix flavor-conditional asset bundling for path dependencies (#156687)
Fixes https://github.com/flutter/flutter/issues/155755

When building the asset bundle during, the `--flavor` option isn't considered when searching for assets from dependencies. This PR fixes that.

It's possible that when initially implementing this feature, I thought that flavor-conditional assets didn't make sense for packages. While I still think that way regarding pub packages, using this feature makes a lot more sense for monorepo projects.

<details>

<summary> Pre-launch checklist </summary> 

</details>
2024-10-15 17:39:01 +00:00
Ben Konyi
ad370c8fa7
[ Tool ] Support Powershell v6+ to determine Windows version in flutter doctor (#156476)
Powershell v6+ use the executable name `pwsh.exe` instead of
`powershell.exe`. This change adds support for determining the Windows
version on systems that solely use `pwsh.exe` and don't have
`powershell.exe` on the `PATH`.

Fixes #156189.

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-10-15 11:48:35 -04:00
Viraj Kanwade
0eedec47c2
Updated iPhone enable developer mode instructions (#154511)
The instructions specify to enable Developer Mode in Privacy and Security. But Developer Mode option is not available, unless you open Xcode and reconnect the device.

___________
9/23 edit from @andrewkolos: See https://stackoverflow.com/questions/77648341/flutter-not-reading-device-developer-mode-setting
2024-10-12 06:23:13 +00:00
John McDole
9a9b9218ee
Flutter tool assumes impeller is enabled by default (#156540)
... because it is.
2024-10-10 18:44:18 +00:00
stuartmorgan
e8254b2024
Update Android plugin templates for newer AGP (#156533)
Now that Flutter requires AGP 7+, we can use Java 11 as the compatibility version in the plugin template rather than 1.8, avoiding warnings with newer toolchains, and we can remove the check for 'namespace' existing that was only necessary to support AGP 4.1.

See also https://github.com/flutter/packages/pull/7795 which made this change in Flutter-team-owned plugins.

Part of https://github.com/flutter/flutter/issues/156111
2024-10-10 17:18:50 +00:00
Daco Harkes
e695cd6e9a
Migrator for android 35/16kb page size cmake flags for plugin_ffi (#156221)
Migrates existing instantions of `--template plugin_ffi` to deal with Android 15 16kb memory pages.

Issue:

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

@reidbaker I could only find migrations that run from the root application. However the file needing to be migrated is a plugin. The plugin is being referenced from the example in the example dir and that's where the migrator is run, so I wrote the code so that it walks up to find the plugin. Do you know of a way to run migrators to non-root projects? (Can we even safely do so, e.g. the non-root could be in the pub cache, could be a different project on the users' system etc. So maybe checking if we are in the examples dir is the only sane thing to do?)

Tests:

* Added unit tests in `test/general.shard/android/migrations/cmake_android_16k_pages_migration_test.dart`
2024-10-08 08:41:09 +00:00
David Iglesias
d744da18e5
[tool] Emit a deprecation warning for some values of --web-renderer. (#156376)
This PR emits a blue warning text when using `flutter ... --web-renderer=html|auto`.

(The message is similar to the one that we emit at run-time)

## Issues

Fixes https://github.com/flutter/flutter/issues/154878
See also: https://github.com/flutter/engine/pull/55709
2024-10-08 01:39:06 +00:00
Nate Biggs
da71e6e93d
Update 'dump-info' usage for dart2js builds (#156187)
Dart2js updated its CLI to support generating a 'dump-info' json file by passing a "--stage" option. The "dump-info-all" stage performs a full compilation (from the provided dill) and then also generates the dump info file.

Tested via the `flutter-dev` CLI locally. This results in the same output but with the addition of an extra `main.dart.js.info.json` file.
2024-10-07 20:06:18 +00:00
Andrew Kolos
e96c47f953
handle any RPCError due to vm service disconnection in flutter run (#156346)
Follow-up to https://github.com/flutter/flutter/pull/153714. While reading through run.dart, I noticed we missed a case.
2024-10-07 18:48:22 +00:00
Nate Wilson
5bfc3d43ae
Refactor devfs_web_ddc_modules_test.dart (#155609)
This pull request adds a local function `runInTestbed()` to **devfs_web_ddc_modules_test.dart**, which wraps the `testbed.run()` method. Several whitespace adjustments have been made as well.

<br>

It's much easier to read after clicking "hide whitespace".

<br>

Relevant style guidelines:
- Prefer avoiding line breaks after assignment operators.
- If you have a newline after some opening punctuation, match it on the closing punctuation.
- Only use `=>` when everything, including the function declaration, fits on a single line.
2024-10-03 21:10:03 +00:00
Nate Wilson
5ecf10052f
pattern-matching refactor (#154753)
This pull request aims to improve code readability, based on feedback gathered in a recent design doc.

<br>

There are two factors that hugely impact how easy it is to understand a piece of code: **verbosity** and **complexity**.

Reducing **verbosity** is important, because boilerplate makes a project more difficult to navigate. It also has a tendency to make one's eyes gloss over, and subtle typos/bugs become more likely to slip through.

Reducing **complexity** makes the code more accessible to more people. This is especially important for open-source projects like Flutter, where the code is read by those who make contributions, as well as others who read through source code as they debug their own projects.

<hr>

<br>

The following examples show how pattern-matching might affect these two factors:

<details> <summary><h3>Example 1 (GOOD)</h3> [click to expand]</summary>

```dart
if (ancestor case InheritedElement(:final InheritedTheme widget)) {
  themes.add(widget);
}
```

Without using patterns, this might expand to

```dart
if (ancestor is InheritedElement) {
  final InheritedWidget widget = ancestor.widget;
  if (widget is InheritedTheme) {
    themes.add(widget);
  }
}
```

Had `ancestor` been a non-local variable, it would need to be "converted" as well:

```dart
final Element ancestor = this.ancestor;
if (ancestor is InheritedElement) {
  final InheritedWidget inheritedWidget = ancestor.widget;
  if (widget is InheritedTheme) {
    themes.add(theme);
  }
}
```

</details>

<details> <summary><h3>Example 2 (BAD) </h3> [click to expand]</summary>

```dart
if (widget case PreferredSizeWidget(preferredSize: Size(:final double height))) {
  return height;
}
```

Assuming `widget` is a non-local variable, this would expand to:

```dart
final Widget widget = this.widget;
if (widget is PreferredSizeWidget) {
  return widget.preferredSize.height;
}
```

<br>

</details>

In both of the examples above, an `if-case` statement simultaneously verifies that an object meets the specified criteria and performs a variable assignment accordingly.

But there are some differences: Example 2 uses a more deeply-nested pattern than Example 1 but makes fewer useful checks.

**Example 1:**
- checks that `ancestor` is an `InheritedElement`
- checks that the inherited element's `widget` is an `InheritedTheme`

**Example 2:**
- checks that `widget` is a `PreferredSizeWidget`
(every `PreferredSizeWidget` has a `size` field, and every `Size` has a `height` field)

<br>

<hr>

I feel hesitant to try presenting a set of cut-and-dry rules as to which scenarios should/shouldn't use pattern-matching, since there are an abundance of different types of patterns, and an abundance of different places where they might be used.

But hopefully the conversations we've had recently will help us converge toward a common intuition of how pattern-matching can best be utilized for improved readability.

<br><br>

- resolves https://github.com/flutter/flutter/issues/152313
- Design Doc: [flutter.dev/go/dart-patterns](https://flutter.dev/go/dart-patterns)
2024-10-03 18:21:04 +00:00
Jenn Magder
22247cd55c
Add deprecation warning for "flutter create --ios-language" (#155867)
The Objective-C  `flutter create --ios-language objc` template will be removed in https://github.com/flutter/flutter/issues/148586.

Add a deprecation warning when this flag is passed.  Add an additional warning when Objective-C is specified requesting the user's use-case.

Do not show the warning when creating the module, as Swift is not supported for it yet https://github.com/flutter/flutter/issues/23955

![Screenshot 2024-09-27 at 8 54 16 PM](https://github.com/user-attachments/assets/112be47f-a5bd-4f57-9a9d-c96c7bbc8ac3)

Part of https://github.com/flutter/flutter/issues/148586
2024-10-02 16:13:25 +00:00
Loïc Sharma
6906e58127
[Swift Package Manager] Make available but off on beta and stable (#155964)
Makes the Swift Package Manager feature available but off by default on beta and stable.

Part of: https://github.com/flutter/flutter/issues/153449

Corresponding website PR that will land after the next stable release: https://github.com/flutter/website/pull/11212
2024-10-01 18:00:10 +00:00
Mikhail Novoseltsev
0975e612c0
[tool][android] Allow --target-platform work properly with --debug mode (#154476)
This PR addresses an issue where the `--target-platform` flag was not being respected when building APKs in debug mode. Previously, debug builds would always include `x86` and `x64` architectures, regardless of the specified target platform. This change ensures that the `--target-platform` flag is honored across all build modes, including debug.

To achieve this, `BuildApkCommand` has been slightly changed to become responsible for list of archs that should be built in the current run,rather than just parsing arguments. Previously, this responsibility was distributed to gradle, which could be frustrating (in my opinion)

Fixes #153359
2024-10-01 15:24:53 +00:00
Andrew Kolos
3941346723
when ResidentRunner.tryInitLogReader fails, only log warning on Android (#155800)
This is a follow-up to the PR https://github.com/flutter/flutter/pull/155049 (which fixed https://github.com/flutter/flutter/issues/154903). This PR addresses the resulting issue, https://github.com/flutter/flutter/issues/155795. It does so in a hacky way for the sake of simplicity (and thus suitability for cherry-picking). I intend to clean this up on the master channel with yet another follow-up PR, https://github.com/flutter/flutter/pull/155796, which currently exists as a proof-of-concept to make sure I actually have the ability to clean this after myself here.

**I intend to submit a stable hotfix patch with the changes from the original fix (https://github.com/flutter/flutter/issues/154903) and the follow-up changes from this PR.**
2024-09-30 17:53:08 +00:00
lizhuo
84f65686d9
fix: support android 15 16k page size for template plugin_ffi (#155508)
Android 15 support 16k page sizes, it need [enable 16kb elf alignment](https://developer.android.com/guide/practices/page-sizes#compile-r26-lower).

the current plugin_ffi template will have below error if run on android 15 16k emulator
```
Failed to load dynamic library 'libffigen_app.so': dlopen
failed: empty/missing
DT_HASH/DT_GNU_HASH in
"/data/app/~~Ixsgxu2mj5fKxP1cXpjV6Q==/com.example.ffigen_app_example-6d_efR__WGu
4dsF4tLIaHw==/lib/arm64/libffigen_app.so"
(new hash type from the future?)
```
2024-09-30 15:56:25 +00:00
Martin Kustermann
ead6b0d17c
Remove left-over traces of "link-dry-run" - which isn't used anywhere in flutter (#155820)
The "link-dry-run" functionality was never used in flutter (even before
the recent refactoring).
I think we can remove this "link-dry-run" concept everywhere.

PR to remove this in dart-lang/native:
https://github.com/dart-lang/native/pull/1613
2024-09-27 16:45:35 +02:00
Ian Hickson
20bc0a9cb8
Fix line-wrapping in flutter create error message. (#150325) 2024-09-26 17:04:03 +00:00
Martin Kustermann
abcba1fa7e
Reland "[flutter_tools] Cleanup of native asset related code (removes around 50% of the native asset related code) (#155430)" (#155745)
Changes to original CL: The code that issues an error on unsupported
operating system in the dry-run case was missing a case for iOS and
Android

Original CL description

  tl;dr Removes 50% (>1650 locs) of native asset related code in
  `packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented
  per OS. This lead to very large code duplication of almost identical,
  but slightly different code. It also led to similarly duplicated test
  code.

  Almost the entire dart build/link/dry-run implementation is identical
  across OSes. There's small variations:

- configuration of the build (e.g. android/macos/ios version, ios sdk,
...)
  - determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
  main functions:

    * `runFlutterSpecificDartBuild` which is responsible for
      - obtain flutter configuration
      - perform dart build (& link)
      - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
  similar (but not same):
      - obtain flutter configuration
      - perform dart dry run
      - determine target location

  these two functions will call out to helpers for the OS specific
  functionality:

* `_assetTargetLocationsForOS` for determining the location of the code
  assets

* `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
  overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
  single code path for the build/link/dry-run, we can also remove the
  duplicated tests that were pretty much identical across OSes.

  We also harden the building code by adding asserts, e.g.

    * the dry fun functionality should never be used by `flutter test`

* the `build/native_assets/<os>/native_assets.yaml` should only be used
       by `flutter test` and the dry-run of `flutter run`

  => We change the tests to also comply with these invariants (so the
  tests are not testing things that cannot happen in reality)

  We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
  from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
2024-09-26 12:21:29 +02:00
auto-submit[bot]
4dfa688ec4
Reverts "[flutter_tools] Cleanup of native asset related code (removes around 50% of the native asset related code) (#155430)" (#155713)
Reverts: flutter/flutter#155430
Initiated by: eyebrowsoffire
Reason for reverting: Postsubmit failures closing the tree. See the following examples:

https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20native_assets_ios/5738/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64_mokey%20native_assets_android/583/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20native_assets_android/4075/overview
https://ci.chromium.org/u
Original PR Author: mkustermann

Reviewed By: {bkonyi, dcharkes}

This change reverts the following previous change:
tl;dr Removes 50% (>1650 locs) of native asset related code in `packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented per OS. This lead to very large code duplication of almost identical, but sligthly different code. It also led to similarly duplicated test code.

Almost the entire dart build/link/dry-run implementation is identical across OSes. There's small variations:

  - configuration of the build (e.g. android/macos/ios version, ios sdk, ...)
  - determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two main functions:

  * `runFlutterSpecificDartBuild` which is responsible for
    - obtain flutter configuration
    - perform dart build (& link)
    - determine target location & install binaries

  * `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a similar (but not same):
    - obtain flutter configuration
    - perform dart dry run
    - determine target location

these two functions will call out to helpers for the OS specific functionality:

  * `_assetTargetLocationsForOS` for determining the location of the code assets

  * `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a single code path for the build/link/dry-run, we can also remove the duplicated tests that were pretty much identical across OSes.

We also harden the building code by adding asserts, e.g.

  * the dry fun functionality should never be used by `flutter test`

  * the `build/native_assets/<os>/native_assets.yaml` should only be used by `flutter test` and the dry-run of `flutter run`

=> We change the tests to also comply with these invariants (so the tests are not testing things that cannot happen in reality)

We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.

We also reorganize the main code to make it readable from top-down and make members private where they can be.
2024-09-25 21:46:22 +00:00
Martin Kustermann
621e7ef951
[flutter_tools] Cleanup of native asset related code (removes around 50% of the native asset related code) (#155430)
tl;dr Removes 50% (>1650 locs) of native asset related code in
`packages/flutter_tools`

Before this PR the invocation of dart build/link/dry-run was implemented
per OS. This lead to very large code duplication of almost identical,
but slightly different code. It also led to similarly duplicated test
code.

Almost the entire dart build/link/dry-run implementation is identical
across OSes. There's small variations:

- configuration of the build (e.g. android/macos/ios version, ios sdk, ...)
- determining target locations & copying the final shared libraries

This PR unifies the implementation by reducing the code to basically two
main functions:

  * `runFlutterSpecificDartBuild` which is responsible for
    - obtain flutter configuration
    - perform dart build (& link)
    - determine target location & install binaries

* `runFlutterSpecificDartDryRunOnPlatforms` which is responsible for a
similar (but not same):
    - obtain flutter configuration
    - perform dart dry run
    - determine target location

these two functions will call out to helpers for the OS specific
functionality:

* `_assetTargetLocationsForOS` for determining the location of the code
assets

* `_copyNativeCodeAssetsForOS` for copying the code assets (and possibly
overriting the install name, etc)

=> Since we get rid of the code duplication across OSes and have only a
single code path for the build/link/dry-run, we can also remove the
duplicated tests that were pretty much identical across OSes.

We also harden the building code by adding asserts, e.g.

  * the dry fun functionality should never be used by `flutter test`

  * the `build/native_assets/<os>/native_assets.yaml` should only be used
     by `flutter test` and the dry-run of `flutter run`

=> We change the tests to also comply with these invariants (so the
tests are not testing things that cannot happen in reality)

We also rename `{,Flutter}NativeAssetsBuildRunner` to disambiguate it
from the `package:native_asset_builder`'s `NativeAssetsBuildRunner`.
2024-09-25 22:50:43 +02:00
Jenn Magder
9d42f826d7
Add PrivacyInfo.xcprivacy to macOS plugin template (#155570)
macOS version of https://github.com/flutter/flutter/pull/148485 without NSPrivacyAccessedAPITypes.

Fixes https://github.com/flutter/flutter/issues/155563
2024-09-25 05:30:53 +00:00
Danny Tuppeny
3f038aea0b
[flutter_tools] Fix encoded stderr in "dart.log" from debug adapter to client (#155249)
To aid debugging, debug adapter (DAP) clients can ask the debug adapters
to send verbose logs back to the client (so they can capture them in a
client-side log along with other things happening on the client).
Included in this log is the `stderr` output of the `flutter run` process
spawned by the debug adapter.

This output was not decoded correctly for these logs, so showed up like:

```
[Flutter] [stderr] [91, 32, 32, 43, 49, 52, 32, 109, 115, 93, 32, 67, 111, 117, 108, 100, 32, 110, 111, 116, 32, 102, 105, 110, 100, 32, 97, 110, 32, 111, 112, 116, 105, 111, 110, 32, 110, 97, 109, 101, 100, 32, 34, 105, 110, 118, 97, 108, 105, 100, 34, 46, 10, 10, 91, 32, 32, 32, 32, 32, 32, 32, 32, 93, 32, 82, 117, 110, 32, 39, 102, 108, 117, 116, 116, 101, 114, 32, 45, 104, 39, 32, 40, 111, 114, 32, 39, 102, 108, 117, 116, 116, 101, 114, 32, 60, 99, 111, 109, 109, 97, 110, 100, 62, 32, 45, 104, 39, 41, 32, 102, 111, 114, 32, 97, 118, 97, 105, 108, 97, 98, 108, 101, 32, 102, 108, 117, 116, 116, 101, 114, 32, 99, 111, 109, 109, 97, 110, 100, 115, 32, 97, 110, 100, 32, 111, 112, 116, 105, 111, 110, 115, 46, 10]
```

This change decodes the output before processing.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5268

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-09-24 12:30:06 +01:00
Daco Harkes
aef2758716
[native assets] Roll dependencies (#155432)
Rolls native deps to the latest version, and cleans up deprecated field from template.

Tests:

* All the unit and integration tests for native assets. The template and dependencies are exercised in the integration test.

Since `package:native_assets_builder` already checks for having no static libraries as output, the custom check in flutter_tools is removed. The tests stubbing out the native assets builder exercising the custom check are also removed. (The integration tests now check for the error message from the native assets builder.)
2024-09-24 07:19:09 +00:00
Jenn Magder
8a07265a88
Assert macOS framework artifact contains xcprivacy manifest (#155189)
Add tool test to validate a built macOS app contains the FlutterMacOS framework xcprivacy manifest.

Blocked on https://github.com/flutter/engine/pull/55078 rolling in.
2024-09-23 17:12:31 +00:00
zijiehe@
a4f45471bc
Delete packages/flutter_tools/lib/src/fuchsia directory (#154880)
It's not being actively used, and fuchsia team does not have bandwidth
to maintain it.

Bug: https://b.corp.google.com/issues/353729557

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-09-17 09:10:02 -07:00
Tess Strickland
c50b3fea32
Extend 'flutter symbolize' to handle deferred loading units. (#149315)
Adds `-u`/`--unit-id-debug-info` arguments to `flutter symbolize` to pass paths to DWARF information for deferred loading units. The argument passed via `-u` should be of the form `N:P`, where `N` is the loading unit ID (an integer) and `P` is the path to the debug information for loading unit `N`. The DWARF information for the root loading unit can either be passed by `-d`/`--debug-info` as before or by `--unit-id-debug-info 1:<path>`.

Partial fix for https://github.com/flutter/flutter/issues/137527. Additional work is needed to adjust tools built on top of `flutter symbolize` to store and pass along this additional information appropriately when there are deferred loading units.
2024-09-16 17:55:05 +00:00
Christopher Fujino
b565379812
Catch unable to start app exception (#154970)
Fixes https://github.com/flutter/flutter/issues/153433
2024-09-16 17:32:49 +00:00
Jenn Magder
0a400f8cd8
Assert iOS framework artifact contains xcprivacy manifest (#155187)
Add tool test to validate a built iOS app contains the Flutter framework xcprivacy manifest.

Follow up to https://github.com/flutter/engine/pull/48951.
2024-09-16 13:13:30 +00:00
Sigurd Meldgaard
2812d4685c
Stop reading .packages from flutter_tools. (#154912) 2024-09-13 13:53:05 +02:00
zijiehe@
fc9220c981
Disable fuchsia in flutter_tools (#155111)
This change disables fuchsia in flutter_tools, most of the fuchsia logic becomes no-op, so the test cases need to be removed altogether.

This change needs to go first to avoid breaking dependencies.

Bug: b/353729557
2024-09-12 23:40:06 +00:00
Andrew Kolos
d8f8613a5b
when setting up the log reader for a device during flutter run, discard any RPCError thrown due to the device being disconnected (#155049)
Fixes https://github.com/flutter/flutter/issues/154903

This PR contains some refactoring. To make the actual change easier to figure out, I've tried to separate parts of the change into multiple commits for easier reviewing 🙂.

**I plan on cherry-picking this change to stable.**
2024-09-12 15:42:15 +00:00
Loïc Sharma
ea208f824b
Fix flutter run on Mac x64 hosts if Swift Package Manager is enabled (#154645)
### Problem

Enabling the Swift Package Manager feature caused post-submit tests to fail on Mac x64 hosts:

<details>
<summary>Example error...</summary>

https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20rrect_blur_perf_ios__timeline_summary/575/overview

```
♦ ... flutter --verbose assemble ... -dIosArchs=x86_64 ... profile_unpack_ios

Target profile_unpack_ios failed:
Exception: Binary ... build/ios/Profile-iphoneos/Flutter.framework/Flutter does not contain x86_64.

Running lipo -info:
Non-fat file: ... build/ios/Profile-iphoneos/Flutter.framework/Flutter is architecture: arm64

#0      UnpackIOS._thinFramework (package:flutter_tools/src/build_system/targets/ios.dart:351:7)
<asynchronous suspension>
#1      UnpackIOS.build (package:flutter_tools/src/build_system/targets/ios.dart:298:5)
<asynchronous suspension>
...
```

</details>

### Reproduction

On a mac x64 host:

1. Switch to the latest master channel: `flutter channel master ; flutter upgrade`
1. Disable the Swift Package Manager feature: `flutter config --no-enable-swift-package-manager`
2. Create a Flutter project
2. [Edit the Xcode project manually to add the prepare pre-action](https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-app-developers#step-2-add-run-prepare-flutter-framework-script-pre-action)
3. Run `flutter run` (`flutter build ios` does not reproduce this issue).

### Background

Previously, the Flutter framework was unpacked in the Xcode target's build. Unfortunately, this happens after Swift packages are built; this prevented Swift packages from using the Flutter framework.

To fix this, we added an Xcode pre-action that unpacks the Flutter framework _before_ Swift Package Manager builds packages. The Xcode target still runs the Flutter framework unpack step, but this step no-ops if the unpack step has the exact same inputs. 

```mermaid
flowchart LR
  A[flutter run -d iphone] --> B(Build Xcode project)
  B --> C(Xcode 'prepare framework' pre-action)
  B --> G[Build Swift packages]
  B --> D(Build 'Runner' target)
  C --> E[Unpack Flutter framework #1]
  D --> F["
  Unpack Flutter framework #2
  (No-ops if inputs are same as #1)
  "]
```

https://github.com/flutter/flutter/pull/150052 added an optimization that made it more likely the second unpack step no-ops by fixing a case where the target architecture input could be different:

> When using SwiftPM, we use `flutter assemble` in an Xcode Pre-action to run the `debug_unpack_macos` (or profile/release) target. This target is also later used in a Run Script build phase. Depending on `ARCHS` build setting, the Flutter/FlutterMacOS binary is thinned. In the Run Script build phase, `ARCHS` is filtered to the active arch. However, in the Pre-action it doesn't always filter to the active arch. As a workaround, assume arm64 if the [`NATIVE_ARCH`](https://developer.apple.com/documentation/xcode/build-settings-reference/#NATIVEARCH) is arm, otherwise assume x86_64.

This optimization is only applied if [`ONLY_ACTIVE_ARCH`](https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW157) is `YES`.

> [!IMPORTANT]
> [`ONLY_ACTIVE_ARCH`](https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW157)'s name is misleading. It specifies whether the product includes only object code for the native architecture.
>
> A value of `YES` means the product includes only code for the native architecture ([NATIVE_ARCH](https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW59)).
>
> A value of `NO` means the product includes code for the architectures specified in [ARCHS (Architectures)](https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW62).

### Problem

`buildXcodeProject` incorrectly always sets `ONLY_ACTIVE_ARCH` to `YES` if the Xcode built is for a single architecture:

6abef22251/packages/flutter_tools/lib/src/ios/mac.dart (L353-L361)

This is incorrect! If the host architecture is `x64` but the target architecture is `arm64`, [`ONLY_ACTIVE_ARCH`](https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW157) should be `NO`.

This caused the prepare pre-action to incorrectly use x64 as the target architecture for arm64 devices on an x64 host, which in turn caused builds to fail if Swift Package Manager was enabled.

### Solution

This change updates `buildXcodeProject` to set `ONLY_ACTIVE_ARCH` correctly.

This change also updates the prepare pre-action's to be more conservative in applying the optimization that filters the target architecture. This ensures that the build still works (but without the optimization) if `ONLY_ACTIVE_ARCH` is incorrectly set.

Follow-up PR: https://github.com/flutter/flutter/pull/154649

This unblocks: https://github.com/flutter/flutter/issues/151567

### DeviceLab test

This problem reproduces if you `flutter run` to an iPhone Arm64 device from an x64 mac host with the Swift Package Manager feature enabled.

I ran an affected DeviceLab test to verify the fix works as expected:

Description | CI test | Result
-- | -- | --
SwiftPM enabled without this fix: https://github.com/flutter/flutter/pull/154750 | [Link](https://ci.chromium.org/ui/p/flutter/builders/try.shadow/Mac_ios%20rrect_blur_perf_ios__timeline_summary/7/overview) | ❌ 
SwiftPM enabled with this fix: https://github.com/flutter/flutter/pull/154749 | [Link](https://ci.chromium.org/ui/p/flutter/builders/try.shadow/Mac_ios%20rrect_blur_perf_ios__timeline_summary/8/overview) | âœ
2024-09-11 20:03:22 +00:00
Lau Ching Jun
00b410a466
Update the signature of DDS launcher callback. (#154949)
Following https://dart-review.googlesource.com/c/sdk/+/383901
2024-09-11 17:39:20 +00:00
Shashwat Pathak
0a9148870a
Fix flutter create warning regarding Java compatibility (#152836)
This PR modifies the warning message regarding Java compatibility to make it consistent with the Flutter style guide.

**Current message looks like this**
```
[RECOMMENDED] If so, to keep the default AGP version 8.1.0, make
sure to download a compatible Java version
(Java 17 <= compatible Java version < Java 21).
You may configure this compatible Java version by running:
`flutter config --jdk-dir=<JDK_DIRECTORY>`
Note that this is a global configuration for Flutter.

Alternatively, to continue using your configured Java version, update the AGP
version specified in the following files to a compatible AGP
version (minimum compatible AGP version: 7.0) as necessary:
    -   /home/user/project/testproj/android/build.gradle

See
https://developer.android.com/build/releases/gradle-plugin for details on
compatible Java/AGP versions.
```

**After Modification**

```
To keep the default AGP version 8.1.0, download a compatible Java version 
(Java 17 <= compatible Java version < Java 21). Configure this Java version 
globally for Flutter by running:

  flutter config --jdk-dir=<JDK_DIRECTORY>

Alternatively, to continue using your current Java version, update the AGP 
version in the following file(s) to a compatible version (minimum AGP version: 7.0):

  /home/user/project/testproj/android/build.gradle

For details on compatible Java and AGP versions, see
https://developer.android.com/build/releases/gradle-plugin
```

Fixes #152460
2024-09-11 16:21:16 +00:00
Matan Lurey
0e6c16c27a
Migrate apple-mobile-web-* to mobile-web-*. (#154964)
Closes https://github.com/flutter/flutter/issues/154596.

It's less clear to me if your goal was to migrate _all_ of these btw:
https://github.com/search?q=org%3Aflutter+%22mobile-web-app-capable%22&type=code
2024-09-11 00:39:51 +00:00
Andrew Kolos
30835d7dac
handle EAGAIN (macOS) in ErrorHandlingProcessManager (#154306)
~~Fixes~~ Discovered in https://github.com/flutter/flutter/issues/153776.

To my knowledge, `Resource temporarily unavailable` when trying to run a process means that some required resource is at capacity. There may be too many processes active, not enough available ports, or some sort of blocking cache is full, etc. Feel free to independently research and see if you come to the same conclusion.

Then, it seems safe to catch and handle this within the tool's `ErrorHandlingProcessManager` abstraction, as Flutter cannot realistically do anything to prevent this issue.
2024-09-10 22:24:56 +00:00
Andrew Kolos
d88e692895
fix test chrome.close can recover if getTab throws a StateError (#154889)
Fixes https://github.com/flutter/flutter/issues/154857.

Does so by:
* adding `await chromiumLauncher.connect(chrome, false);` before the `close` call to make sure we enter[ the block ](9cd2fc90af/packages/flutter_tools/lib/src/web/chrome.dart (L521-L535))that actually tries to close chromium
* adding an `onGetTab` callback to `FakeChromeConnectionWithTab`, which the test now uses to throw a StateError upon `getTab` getting called.

## How I verified this change

1. Change `Chromium.close` from using the safer `getChromeTabGuarded` function to using the previous method of calling `ChromeConnection.getTab` directly. Do so by applying this diff:

```diff
diff --git a/packages/flutter_tools/lib/src/web/chrome.dart b/packages/flutter_tools/lib/src/web/chrome.dart
index c9a5fdab81..81bc246ff9 100644
--- a/packages/flutter_tools/lib/src/web/chrome.dart
+++ b/packages/flutter_tools/lib/src/web/chrome.dart
@@ -520,7 +520,7 @@ class Chromium {
     Duration sigtermDelay = Duration.zero;
     if (_hasValidChromeConnection) {
       try {
-        final ChromeTab? tab = await getChromeTabGuarded(chromeConnection,
+        final ChromeTab? tab = await chromeConnection.getTab(
             (_) => true, retryFor: const Duration(seconds: 1));
         if (tab != null) {
           final WipConnection wipConnection = await tab.connect();
```

2. Then, run the test, which should correctly fail:
```
dart test test/web.shard/chrome_test.dart --name="chrome.close can recover if getTab throws a StateError"`
```
3. Revert the change from step 1 and run again. The test should now pass.
2024-09-10 17:23:56 +00:00
Andrew Kolos
9cd2fc90af
Handle ProcessExceptions due to git missing on the host (#154445)
Fixes https://github.com/flutter/flutter/issues/133585.

This PR elects to add a new catch within `_handleToolError` that checks any uncaught error. This new catch will exit the tool without crashing provided the following conditions are met:

1. the error is a `ProcessException`,
2. the error message contains `git` somewhere in the message (we don't match on the entire string in case it changes or is locale-dependent), and
3. `git` does not appear to be runnable on the host system (`ProcessManager.canRun` returns `false` for git).

This is preferable to checking for runnability of `git` before we run it for 1) its simplicity and 2) lack of performance penalty for users that already have git installed (almost every single one).

This PR also does some light refactoring to runner_test.dart to make room for tests that aren't related to crash reporting.
2024-09-09 20:47:05 +00:00
Mikhail Novoseltsev
d9321159bf
[tool] Add dartFileName setting for platform plugins (#153099)
This PR introduces the `dartFileName` parameter for platform plugin configurations with Dart platform implementations. This new parameter allows plugin developers to specify a custom path to the file where the `dartPluginClass` is defined.

**Implementation is opt-in**. `dartFileName` is completely optional and is taken in account only with `dartClassName`. Possibility to set `dartClassName` without `dartFileName` remains. 

**Implementation is backward compatible** – existing configurations using only `dartClassName` remain fully supported. If `dartFileName` is omitted, the system falls back to the previous behavior of deriving the file name from the plugin name.

## Example

```yaml
flutter:
  plugin:
    platforms:
      some_platform:
        dartPluginClass: MyPlugin
        dartFileName: 'src/my_plugin_implementation.dart'
```

fixes #152833
2024-09-06 18:27:09 +00:00
Loïc Sharma
aea84342eb
Improve iOS unpack target's error messages (#154649)
Improves the formatting and error messages of the target that unpacks the Flutter framework in Flutter iOS builds.

Follow up to: https://github.com/flutter/flutter/pull/154645
Part of https://github.com/flutter/flutter/issues/151567
2024-09-05 23:46:22 +00:00
Chris Bracken
4d17998755
iOS,macOS: Do not copy unsigned_binaries.txt to build outputs (#154684)
There are three categories of binaries produced as part of the framework artifacts:
* Those that use APIs that require entitlements and must be code-signed; e.g. gen_snapshot
* Those that do not use APIs that require entitlements and must be code-signed; e.g. Flutter.framework dylib.
* Those that do not need to be code-signed; e.g. Flutter.dSYM symbols.

We are adding the third category in https://github.com/flutter/engine/pull/54977. The Cocoon code signing aspect of this was handled in https://github.com/flutter/cocoon/pull/3890.

This ensures these files don't get copied into the build output should they appear in the artifact cache.

Issue: https://github.com/flutter/flutter/issues/154571
2024-09-05 21:37:28 +00:00
Loïc Sharma
3bda455f4e
Improve 'flutter downgrade' error message (#154434)
`flutter downgrade` fails if you haven't used `flutter upgrade`:

```
$ flutter downgrade
There is no previously recorded version for channel "stable".
```

It's not clear what actions a user should take from this error message. Here's the new error message:

```
$ flutter downgrade
It looks like you haven't run "flutter upgrade" on channel "stable".

"flutter downgrade" undoes the last "flutter upgrade".

To switch to a specific Flutter version, see: https://flutter.dev/to/switch-flutter-version
```

Depends on https://github.com/flutter/website/pull/11098
2024-09-04 22:06:31 +00:00
Rexios
6abef22251
[tool] Update .gitignore templates to include .flutter-plugins files (#152950)
Fixes https://github.com/flutter/flutter/issues/152793
2024-09-04 20:54:24 +00:00
hangyu
0d8247eb7d
Add a RegExp for iOS domain when reading domains from xcodeProject (#154201)
Append the string `?mode=<alternate mode>` to the associated domain to
enable alternate mode in some use cases is recommended in apple
developer guide
(https://developer.apple.com/documentation/xcode/configuring-an-associated-domain#Enable-alternate-mode-for-unreachable-servers)

So when reading these domains from xcode settings, we should consider
this case and trim it.













## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-08-30 11:17:29 -07:00
Andrew Kolos
a8528c70b6
catch StateError thrown from Chromium.close (#154366)
Fixes crasher https://github.com/flutter/flutter/issues/154203.

Also does a little refactoring to move exception handling into the `getChromeTabGuarded` utility function.

I plan on cherry-picking a subset of this change. This would be included in the custom CP patch for https://github.com/flutter/flutter/issues/153064.
2024-08-30 00:01:12 +00:00
Matan Lurey
712cf654d1
Remove --disable-dart-dev across flutter/flutter. (#154280)
As per the Dart CLI team and @bkonyi, this is no longer providing value and we shouldn't cargo-cult it.

Work towards https://github.com/flutter/flutter/issues/154268.
2024-08-29 22:50:04 +00:00
Ben Konyi
04595bc088
Launch DDS using DartDevelopmentServiceLauncher (#154015)
`DartDevelopmentServiceLauncher` was created to share the DDS launch
logic from flutter_tools with other Dart tooling.

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-08-29 16:16:27 -04:00
jesswrd
05c454c28c
Agp Java Compatability Custom Error (#154142)
Catches gradle error and throws a helpful error message that indicates
an incompatability between Java and AGP versions and how to fix the
issue.

Related issue:
[128524](https://github.com/flutter/flutter/issues/128524)

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.
2024-08-29 10:06:48 -07:00
flutter-pub-roller-bot
f9351fae7e
Roll pub packages (#154267)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-08-29 16:28:08 +00:00
Gabriel Terwesten
f0860d83f5
[native assets] Rewrite install names for relocated native libraries (#153054)
Native libraries that are contributed by native asset builders can depend on each other. For macOS and iOS, native libraries are repackaged into Frameworks, which renders install names that have been written into dependent libraries invalid. 

With this change, a mapping between old and new install names is maintained, and install names in dependent libraries are rewritten as a final step.

Related to https://github.com/dart-lang/native/issues/190
2024-08-29 14:51:23 +00:00
Jackson Gardner
b95548e31c
Don't remove toString implementations while in debug mode. (#154216)
This matches the behavior of AOT/VM compilation.
2024-08-28 20:19:48 +00:00
Yegor
93dc40916c
[web:tools] disable search engine choice screen in flutter run (#154059)
The choice screen is irrelevant when debugging apps locally. `flutter run` creates a separate user profile for testing only. It doesn't touch users' browser settings.

Fixes https://github.com/flutter/flutter/issues/153928
2024-08-27 17:00:13 +00:00
Andrew Kolos
9ec2588fd0
handle IOExceptions coming from ChromeTab.connect (#153978)
Fixes https://github.com/flutter/flutter/issues/153972  (unless the cause of https://github.com/flutter/flutter/issues/153064#issuecomment-2305662791 happens to also prevent this fix from working).

In this PR, I've looked for all non-test call sites of `ChromeConnection.getTabs` and made sure are all wrapped in `try` blocks that handle `IOException` (`HttpException` is what we see in crash reporting, but I figure any `IOException` might as well be the same for all intents and purposes).

I plan on cherry-picking this the stable branch.
2024-08-27 16:19:28 +00:00
Loïc Sharma
ebfaa45c7d
[Windows] Improve symlink ERROR_ACCESS_DENIED error message (#154030)
Currently, if creating a symlink on Windows fails due to `ERROR_ACCESS_DENIED`, you'll get an error message like:

```
Error: ERROR_ACCESS_DENIED file system exception thrown while trying to create a symlink from source to dest
```

The `source` and `dest` paths are incorrect.

This will help us debug: https://github.com/flutter/flutter/issues/153758
2024-08-26 17:52:11 +00:00
Chris Bracken
11ab37ee81
macOS: Copy macOS framwork dSYM into build outputs (#153975)
As of Xcode 16, App Store validation now requires that apps uploaded to the App store bundle dSYM debug information bundles for each Framework they embed.

dSYM bundles are packaged in the FlutterMacOS.xcframework shipped in the `darwin-x64-release` tools archive as of engine patches:
* https://github.com/flutter/engine/pull/54696

This copies the FlutterMacOS.framework.dSYM bundle from the tools cache to the build outputs produced by `flutter build macOS`.

Fixes: https://github.com/flutter/flutter/issues/153879
2024-08-24 00:14:15 +00:00
Andrew Kolos
327193af9a
override Analytics in TestBed defaults (#153990)
Fixes https://github.com/flutter/flutter/issues/150663
2024-08-23 18:13:10 +00:00
chunhtai
dde2328185
Android analyze command should run pub (#153953)
The android command will build the android project partially and thus will need to run pub
2024-08-23 17:57:07 +00:00
Gray Mackall
b2de4dfc2b
Re-land "Ensure flutter build apk --release optimizes+shrinks platform code" (#153868)
Re-lands https://github.com/flutter/flutter/pull/136880, fixes https://github.com/flutter/flutter/issues/136879.

Additions to/things that are different from the original PR:
- Adds an entry to `gradle_errors.dart` that tells people when they run into the R8 bug because of using AGP 7.3.0 (https://issuetracker.google.com/issues/242308990).
- Previous PR moved templates off of AGP 7.3.0.
- Packages repo has been moved off AGP 7.3.0 (https://github.com/flutter/packages/pull/7432).

Also, unrelatedly:
- Deletes an entry in `gradle_errors.dart` that informed people to build with `--no-shrink`. This flag [doesn't do anything](https://github.com/flutter/website/pull/11022#issuecomment-2297294421), so it can't be the solution to any error.
- Uniquely lowers the priority of the `incompatibleKotlinVersionHandler`. This is necessary because the ordering of the errors doesn't fully determine the priority of which handler we decide to use, but also the order of the log lines. The kotlin error lines often print before the other error lines, so putting it last in the list of handlers isn't sufficient to lower it to be the lowest priority handler.
2024-08-23 16:44:08 +00:00
August
e0cd56b52b
fix: A referenced default package must be a plugin package (#152134)
Clarify that a referenced default package must also be a plugin package (one, which provides a pluginClass or a dartPluginClass).

Fixes #152037
More precisely https://github.com/flutter/flutter/issues/152037#issuecomment-2239909463.
Introduced in #137040
2024-08-22 21:02:25 +00:00
Matan Lurey
a9e94d9045
Do not silently fail pub get even if output-mode is "none" (#153596)
I am making an assumption `OutputMode.none` should _really_ mean
`OutputMode.failuresOnly`, that is, if we ever get a non-zero exit code,
we still want to know why. If I've somehow misunderstood that, LMK and
I'm happy to revert this PR or make adjustments.

This fixes the bug where if you were to do:

```sh
git clone https://github.com/myuser/fork-of-flutter
cd fork-of-flutter
./bin/flutter update-packages
```

You now get:

1. An actual error message, versus no output at all.
2. A warning that a common reason is not tracking a remote, with
instructions to fix it.

Closes https://github.com/flutter/flutter/issues/148569.
2024-08-22 09:12:54 -07:00
Sigurd Meldgaard
dfdd5f80f2
Fix flutter test in workspace (#153919)
Follow-up to #153754.
2024-08-22 15:34:47 +02:00
Loïc Sharma
88d9f61d12
Add test that app builds if migrated to SwiftPM but SwiftPM is turned off (#153800)
When a Flutter app is migrated to add Swift Package Manager integration, the Xcode project is modified to depend on a local Swift package that's generated by the Flutter tool. This generated package is how plugins are added to the Xcode project if the SwiftPM feature is enabled.

If an app has been migrated to SwiftPM but Flutter's SwiftPM feature is disabled, the [tool must continue to generate a Swift package](47c1df9640/packages/flutter_tools/lib/src/macos/darwin_dependency_management.dart (L69-L78)) to ensure the app continues to build. Otherwise, the Xcode project would depend on a local package that does not exist.

This adds a high-level integration test that ensures this behavior works as expected, which mirrors this finer-grained unit test: 47c1df9640/packages/flutter_tools/test/general.shard/macos/darwin_dependency_management_test.dart (L340-L382)

Part of https://github.com/flutter/flutter/issues/153448
2024-08-21 22:18:05 +00:00
Gray Mackall
919bed6e0a
Reland "Update template/test compileSdk, targetSdk, ndk versions" (#153795)
Relands https://github.com/flutter/flutter/pull/152487.

The difference is in the two new commits:
-1354c6d77b
-931788aa5a, short version is that:
- I forgot that I need to override the compileSdkVersion in the AGP 8.0 [instance of this test](ef9cd32f5a/dev/devicelab/bin/tasks/android_java17_dependency_smoke_tests.dart (L19))
- A postsubmit integration test needed new lockfiles + the package attribute -> AGP namespace change.

These were the only two postsubmit failures: [dashboard](https://flutter-dashboard.appspot.com/#/build).
2024-08-21 18:27:00 +00:00
auto-submit[bot]
7730f29024
Reverts "Update template/test compileSdk, targetSdk, ndk versions (#152487)" (#153793)
Reverts: flutter/flutter#152487
Initiated by: gmackall
Reason for reverting: I forgot that I need to override the compileSdkVersion in the AGP 8.0 [instance of this test](ef9cd32f5a/dev/devicelab/bin/tasks/android_java17_dependency_smoke_tests.dart (L19))
Original PR Author: gmackall

Reviewed By: {reidbaker}

This change reverts the following previous change:
Updates `compileSdk`, `targetSdk`, and `ndk` versions (former 2 to latest, latter to the version of the ndk we are hosting on CIPD).

Summary of changes:
- Updates mentioned template values
- `compileSdk` 35 requires AGP 8.0+, so updated to 8.1 in many places.
- This also necessitated Gradle upgrades in most places
- This also necessitated moving the `package` xml attribute to the AGP `namespace` field in a couple places (test + template).
- Some tests use the output of `flutter create` but then use intentionally lower AGP versions. [I downgraded the `compileSdk` in these tests.](fee34fd61a)
- [Stopped lockfile generation](82324a2570) script from hitting the `hello_world` example because it uses `.kts` gradle files.
- One test needed [some Gradle options we had already added to templates](6aa187b4b6).
2024-08-20 21:45:25 +00:00
Gray Mackall
ef9cd32f5a
Update template/test compileSdk, targetSdk, ndk versions (#152487)
Updates `compileSdk`, `targetSdk`, and `ndk` versions (former 2 to latest, latter to the version of the ndk we are hosting on CIPD).

Summary of changes:
- Updates mentioned template values
- `compileSdk` 35 requires AGP 8.0+, so updated to 8.1 in many places.
- This also necessitated Gradle upgrades in most places
- This also necessitated moving the `package` xml attribute to the AGP `namespace` field in a couple places (test + template).
- Some tests use the output of `flutter create` but then use intentionally lower AGP versions. [I downgraded the `compileSdk` in these tests.](fee34fd61a)
- [Stopped lockfile generation](82324a2570) script from hitting the `hello_world` example because it uses `.kts` gradle files.
- One test needed [some Gradle options we had already added to templates](6aa187b4b6).
2024-08-20 21:33:12 +00:00
Andrew Kolos
4a03b76c68
Handle "Service connection disposed" error from VmService disconnecting while requests are outstanding (#153714)
Fixes umbrella issue https://github.com/flutter/flutter/issues/153471, including its children: https://github.com/flutter/flutter/issues/153472, https://github.com/flutter/flutter/issues/153473, and https://github.com/flutter/flutter/issues/153474.

The VM service can be disposed at any time during requests (e.g. the user closes the app or stops debugging in VSCode)[^1]. a479f91e80 and a7d8707a59 updated package:vm_service to throw new `RPCError`s when the service disconnects while requests are inflight. Therefore, we need to handle these exceptions in the tool. See umbrella issue for more details.

I plan on cherry-picking this change to the stable channel.

[^1]: https://github.com/flutter/flutter/issues/153471#issuecomment-2296294221
2024-08-20 16:39:19 +00:00
Sigurd Meldgaard
a9daf58829
Reland "Load parent package config" (#153754)
Reverts flutter/flutter#153752
Relands https://github.com/flutter/flutter/pull/150850

Now with attached g3fix
2024-08-20 15:30:46 +02:00
Sigurd Meldgaard
276674e760
Revert "Load parent package config" (#153752)
Reverts flutter/flutter#150850

Seems we need a G3Fix
2024-08-20 12:49:42 +02:00
Sigurd Meldgaard
1a2e25c2d8
Load parent package config (#150850)
Fixes #150196
2024-08-20 09:34:35 +02:00
Jason Simmons
31c3d0927b
Do not cancel the VmService's subscription to the isolate event stream in FlutterVmService.findExtensionIsolate (#153607)
The stream subscriptions in the device's VmService are used by other parts of FlutterVmService and other components throughout flutter_tools.  Components that listen to streams should not call VmService.streamCancel because that will interfere with other users who still want the events.

See https://github.com/flutter/flutter/issues/153049
See https://github.com/flutter/flutter/issues/153563
2024-08-19 17:40:07 +00:00
kzrnm
ea477d5981
[gen_l10n] isCustomDateFormat accepts an actual boolean (#153439)
Fixes #153420

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-08-18 08:57:30 -07:00
Andrew Kolos
080928dda3
add HttpException to the list of handled exceptions within ResidentWebRunner::run (#153527)
Resolves https://github.com/flutter/flutter/issues/153298, a major crasher of the flutter tool. I plan on cherry-picking this change.

In `ResidentWebRunner::run`, many connection-related exceptions are caught, logged, and have `ToolExit`s thrown in their place ([code](d23be7a07d/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart (L370-L385)), [PR that introduced this](https://github.com/flutter/flutter/pull/50895)). However, `HttpException` is not included in this list. See https://github.com/flutter/flutter/issues/153298#issuecomment-2290900158 for details if interested.
2024-08-16 16:40:19 +00:00
Loïc Sharma
15876ff6ea
[Swift Package Manager] Test removing the last Flutter plugin (#153519)
The Flutter tool has a bug where removing the last Flutter plugin does not correctly update the CocoaPods integration.

This adds a test to ensure  that the generated Swift package is properly updated when the last Flutter plugin is removed.

See: https://github.com/flutter/flutter/issues/11819#issuecomment-2289782626
2024-08-16 14:03:13 +00:00
Martin Kustermann
354902f7ca
[web] Pass --no-source-maps instead of --extra-compiler-option=--no-source-maps to dart compile wasm (#153417) 2024-08-14 12:00:24 +02:00
Jason Simmons
5a04b4dda9
Disable DevTools when running the hot restart integration test in flutter_tools (#153247)
When DevTools is active HotRunner.attach makes a deferred RPC to a DevTools service.  That RPC appears to cause issues if it executes at the wrong time during the hot restart.

Passing the --no-devtools flag works around this by disabling the RPC.

See https://github.com/flutter/flutter/issues/153049
2024-08-12 19:57:22 +00:00
Chris Bracken
c375dd8d72
[iOS] Copy Flutter.framework.dSYM into app archive (#153215)
As of Xcode 16, App Store validation now requires that apps uploaded to the App store bundle dSYM debug information bundles for each Framework they embed.

dSYM bundles are packaged in the Flutter.xcframework shipped in the `ios-release` tools archive as of engine patches:
* https://github.com/flutter/engine/pull/54414
* https://github.com/flutter/engine/pull/54458

This copies the Flutter.framework.dSYM bundle from the tools cache to the app archive produced by `flutter build ipa`.

Issue: https://github.com/flutter/flutter/issues/116493
2024-08-10 16:39:04 +00:00
Alexander Aprelev
22e6af6b81
Fix tests expectations regarding new lines. (#153174)
Fixes https://github.com/flutter/flutter/issues/153163

Dart sdk change that affected tests is
e8c035308b
2024-08-09 10:31:48 -07:00
Martin Kustermann
493c453d57
Make ios_deploy_test.dart more robust (#153147)
The test should not assume that a stream of bytes delivers them in a
certain chunked order (e.g. all bytes of a line are delivered in one
chunk and the newline comes in another chunk).

Instead it should use a line splitter to obtain individual lines and can
match those against expectations.

This fragile test is broken after [0] which combines writing a string
together with the newline instead of seperately.

[0] https://dart-review.googlesource.com/c/sdk/+/378024
2024-08-09 12:53:15 +02:00
Jenn Magder
6c3677c6e9
Remove -sdk for watchOS simulator in tool (#152992)
Fix the xcodebuild flags mixing up the iOS and watchOS simulators.

Confirmed this passed in CI on Xcode 16 beta 5: https://github.com/flutter/flutter/pull/152408

Fixes https://github.com/flutter/flutter/issues/152983
See also https://github.com/flutter/flutter/pull/152347
2024-08-08 19:34:20 +00:00
Jason Simmons
d23be7a07d
[web] Fix reading of the --local-web-sdk flag and remove the copy of useLocalWebSdk in DebuggingOptions (#152642) 2024-08-08 16:27:21 +00:00
LouiseHsu
51606f99a4
Fix flutter build ipa --export-method not accepting enterprise flag (#153047)
When implementing the fix for https://github.com/flutter/flutter/issues/149369, I missed accounting for the `enterprise` flag for `flutter build ipa` 😬

Fixes https://github.com/flutter/flutter/issues/153000
2024-08-08 16:07:27 +00:00
Jenn Magder
715e476545
Add xcresulttool --legacy flag for deprecated usage (#152988)
Workaround to add the `--legacy` flag until https://github.com/flutter/flutter/issues/151502 can adopt the non-deprecated usage.

This will allow Xcode errors to be parseable again.

Fixes https://github.com/flutter/flutter/issues/152989
2024-08-07 19:59:11 +00:00
Yegor
e8d2e5814e
[web] hide the --web-renderer option in the tool (#152683)
Hide the `--web-renderer` option in the Flutter Tool. The defaults already cover all fully supported modes:

- `flutter build web` provides canvaskit + dart2js
- `flutter build web --wasm` provides skwasm + dart2wasm

We do not want to encourage production usage of any other permutations (e.g. `auto` or `html`), in particular those that simply do not work (e.g. `skwasm` + dart2js).

Fixes https://github.com/flutter/flutter/issues/140096
Fixes https://github.com/flutter/flutter/issues/151786
2024-08-07 18:40:58 +00:00
auto-submit[bot]
72432c3f15
Reverts "[tool] Guard process writes to frontend server in ResidentCompiler (#152358)" (#153028)
Reverts: flutter/flutter#152358
Initiated by: zanderso
Reason for reverting: Speculative revert to determine whether this PR is related to https://github.com/flutter/flutter/issues/153026
Original PR Author: andrewkolos

Reviewed By: {christopherfujino}

This change reverts the following previous change:
Contributes to fixing https://github.com/flutter/flutter/issues/137184.
Cleaned up version of earlier PR, https://github.com/flutter/flutter/pull/152187.

This PR guards all the writes to `Process::stdin` by wrapping them with `ProcessUtils.writelnToStdinUnsafe`. This way, if any writes fail, we should at least get a stacktrace in our crash reporting.
2024-08-07 16:11:26 +00:00
Andrew Kolos
d848262fc4
[tool] Guard process writes to frontend server in ResidentCompiler (#152358)
Contributes to fixing https://github.com/flutter/flutter/issues/137184.
Cleaned up version of earlier PR, https://github.com/flutter/flutter/pull/152187.

This PR guards all the writes to `Process::stdin` by wrapping them with `ProcessUtils.writelnToStdinUnsafe`. This way, if any writes fail, we should at least get a stacktrace in our crash reporting.
2024-08-06 21:51:48 +00:00
Taha Tesser
00ef750d28
[Reland] Introduce double Flex.spacing parameter for Row/Column spacing (#152890)
Relands https://github.com/flutter/flutter/pull/152472 (Fixed error causing message test, maybe by https://github.com/flutter/flutter/pull/152501)

---

fixes [add spacing parameter to Column and Row](https://github.com/flutter/flutter/issues/55378)

### `Column.spacing` Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        backgroundColor: Colors.black,
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: DecoratedBox(
              decoration: BoxDecoration(
                  border: Border.all(
                color: Colors.amber,
              )),
              child: const Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  Column(
                    spacing: 40.0,
                    // ignore: avoid_redundant_argument_values
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Column(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.topCenter,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.bottomCenter,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

### Preview

<img width="1072" alt="Screenshot 2024-07-30 at 15 40 59" src="https://github.com/user-attachments/assets/14f21091-9e46-4a58-8552-1379f4ba9216">

### `Row.spacing` Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        backgroundColor: Colors.black,
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: DecoratedBox(
              decoration: BoxDecoration(
                  border: Border.all(
                color: Colors.amber,
              )),
              child: const Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  Row(
                    spacing: 40.0,
                    // ignore: avoid_redundant_argument_values
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerRight,
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                  Row(
                    spacing: 40.0,
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    children: <Widget>[
                      ColoredBox(
                        color: Color(0xffff0000),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            alignment: Alignment.centerLeft,
                            child: Text(
                              'RED',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff00ff00),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Center(
                            child: Text(
                              'GREEN',
                              style: TextStyle(color: Colors.black),
                            ),
                          ),
                        ),
                      ),
                      ColoredBox(
                        color: Color(0xff0000ff),
                        child: SizedBox(
                          width: 50.0,
                          height: 75.0,
                          child: Align(
                            child: Text(
                              'BLUE',
                              style: TextStyle(color: Colors.white),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}

```

</details>

### Preview

<img width="1072" alt="Screenshot 2024-07-30 at 15 39 42" src="https://github.com/user-attachments/assets/717e9f5e-a491-4853-ba74-e72ec7493363">
2024-08-05 23:04:50 +00:00
Loïc Sharma
29f332c822
Add migration to git ignore SwiftPM build directories (#152766)
Opening a Swift package in Xcode generates `.build` and `.swiftpm` directories. These should be ignored as they contain intermediary build artifacts that aren't meant to be checked-in.

Part of https://github.com/flutter/flutter/issues/148018
2024-08-05 20:26:16 +00:00
Sam Rawlins
7777d67a66
Remove one set of parens that wrap a single String literal (#152031)
In order to address https://github.com/dart-lang/linter/issues/4354, we are reporting a few more cases in unnecessary_parenthesis. `('text') * 2` is one such case. This change is being made in https://dart-review.googlesource.com/c/sdk/+/376540. (These are the only newly-reported unnecessary parentheses for this change.)
2024-08-01 19:13:13 +00:00
Ben Konyi
d55a0b38e3
Fix bad pattern matching in DDS exception parsing (#152685)
Nullable types for values in map patterns require the key to be present.
Since the 'uri' key is not always present in DDS exception responses,
this was causing us to fall back to throwing a StateError.

Fixes https://github.com/flutter/flutter/issues/152684
2024-08-01 14:38:22 -04:00
Andrew Kolos
535e88b092
Reintroduce verbose logging for hot reload flake (#152639)
Adds some logging to assist with troubleshooting https://github.com/flutter/flutter/issues/152220 (which is a reapperance of flake https://github.com/flutter/flutter/issues/146879) on CI.

TL;DR [the tool sometimes never receives the `IsolateRunnable` event from the vm service after calling `_flutter.runInView`](https://github.com/flutter/flutter/issues/146879#issuecomment-2118629953).
2024-07-31 23:15:17 +00:00
Gray Mackall
a1f03609f7
Set up tests that verify we can build a fresh counter app across our Gradle/AGP/Kotlin support range (#151568)
Sets up tests that verify we can build a fresh counter app across our Gradle/AGP/Kotlin support range.

Post submit only, because the suite takes ~30 minutes to run, and I expect it to be _somewhat_ rare that we break only one of these versions (and therefore it doesn't get caught by existing presubmits).
2024-07-31 19:14:46 +00:00
David Iglesias
111b4fe6d1
[web] Set COEP:credentialless on flutter run/drive. (#152413)
This PR changes the value of the `COEP` response header from `require-corp` to `credentialless` in the Flutter tool, when running `flutter run`/`drive` for Web projects.

This enables running tests compiled to wasm, that access 3P resources (like Google Maps) without blocking those resources.

Docs:

* https://developer.chrome.com/blog/coep-credentialless-origin-trial#credentialless_to_the_rescue

## Issue

* https://github.com/flutter/flutter/issues/152411
2024-07-30 23:14:06 +00:00
engine-flutter-autoroll
61848a448b
Roll Flutter Engine from c58d87d62c20 to 31bb9f98472a (8 revisions) (#152555)
c58d87d62c...31bb9f9847

2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 1339015537a3 to 2cb7f5443a48 (4 revisions) (flutter/engine#54212)
2024-07-30 skia-flutter-autoroll@skia.org Roll Dart SDK from 6ab9452297e0 to ad4d2e8b2c65 (1 revision) (flutter/engine#54211)
2024-07-30 49699333+dependabot[bot]@users.noreply.github.com Bump ossf/scorecard-action from 2.3.3 to 2.4.0 (flutter/engine#54208)
2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 20e4dfabb6b2 to 1339015537a3 (1 revision) (flutter/engine#54207)
2024-07-30 skia-flutter-autoroll@skia.org Roll Dart SDK from e8eca6f05494 to 6ab9452297e0 (1 revision) (flutter/engine#54206)
2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 56de22c39d0e to 20e4dfabb6b2 (1 revision) (flutter/engine#54205)
2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 946ca24d03ab to 56de22c39d0e (1 revision) (flutter/engine#54204)
2024-07-30 skia-flutter-autoroll@skia.org Roll Skia from 8167ff71af2c to 946ca24d03ab (2 revisions) (flutter/engine#54202)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
2024-07-30 16:42:10 +00:00
Jonah Williams
102cd01693
[flutter_tools] remove raster stats CLI option. (#152501)
The raster stats feature is being removed from devtools and the engine. Remove the CLI option as well.

Fixes https://github.com/flutter/flutter/issues/144191
Fixes https://github.com/flutter/flutter/issues/132169
2024-07-29 20:30:54 +00:00
Matan Lurey
40d9fcf767
Document that flutter drive --test-arguments can opt-in to dart test (#152410)
Closes https://github.com/flutter/flutter/issues/51135.
Closes https://github.com/flutter/flutter/issues/145499.

Making this the _default_, or better discoverable, is tracked in
https://github.com/flutter/flutter/issues/152409.

You'll notice I also removed `-rexpanded`; @jonahwilliams believes that
was accidentally copied over from else-where, and never did anything
(someone I guess could have parsed it in `void main(...)`, but given
https://github.com/flutter/flutter/issues/51135 &
https://github.com/flutter/flutter/issues/145499 that seems unlikely.
2024-07-26 18:25:58 -07:00
Jenn Magder
e36d9234e8
Change flutter_build_with_compilation_error_test to check stdout or stderr (#152404)
On Xcode 16 beta 3 stderr is:
```
** BUILD FAILED **
```
stdout is:
```
Writing result bundle at path:
	/var/folders/fm/wjzsj_z95ydgn4khxqgbtqx000mfq2/T/flutter_tools.PeJZlH/flutter_ios_build_temp_dirqmiKld/temporary_xcresult_bundle

error: lib/main.dart:13:11: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
  int x = 'String';
          ^
Target kernel_snapshot_program failed: Exception
Failed to package /Users/m/Projects/test_create.
note: Disabling previews because SWIFT_VERSION is set and SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'Runner' from project 'Runner')
note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
```

The tool output of `flutter build ios` shows both:
```
Building com.example.testCreate for device (ios-release)...
Automatically signing iOS for device deployment using specified development team
in Xcode project: S8QB4VV633
Running Xcode build...
Xcode build done.                                           10.1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/fm/wjzsj_z95ydgn4khxqgbtqx000mfq2/T/flutter_tools.Dgnlxc/flutt
    	er_ios_build_temp_dirpKTDdk/temporary_xcresult_bundle

    error: lib/main.dart:13:11: Error: A value of type 'String' can't be
    assigned to a variable of type 'int'.
      int x = 'String';
              ^
    Target kernel_snapshot_program failed: Exception
    Failed to package /Users/magder/Projects/test_create.
    note: Disabling previews because SWIFT_VERSION is set and
    SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'Runner' from
    project 'Runner')
    note: Run script build phase 'Run Script' will be run during every build
    because the option to run the script phase "Based on dependency analysis" is
    unchecked. (in target 'Runner' from project 'Runner')
    note: Run script build phase 'Thin Binary' will be run during every build
    because the option to run the script phase "Based on dependency analysis" is
    unchecked. (in target 'Runner' from project 'Runner')

Encountered error while building for device.
```

The point of this test is that you can see the error `int x = 'String';` error in the tool output. https://github.com/flutter/flutter/issues/72608#issuecomment-797473109

I think just updating the test to check stderr or stdout is sufficient without touching the tool behavior.

Fixes https://github.com/flutter/flutter/issues/151553
2024-07-26 23:12:14 +00:00
Loïc Sharma
40843e3e61
Update minimum macOS version as needed in Swift package (#152347)
If Swift Package Manager is enabled, the tool generates a Swift package at `<ios/macos>/Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/`. This Swift package is how the tool adds plugins to the Flutter project.

SwiftPM is strictly enforces platform versions: you cannot depend on a Swift package if its supported version is higher than your own.

On iOS, we use the project's minimum deployment version for the generated Swift package. If a plugin has a higher requirement, you'll need to update your project's minimum deployment version. The generated Swift package is automatically updated the next time you run the tool.

This updates macOS to do the same thing.

Fixes https://github.com/flutter/flutter/issues/146204
2024-07-26 22:02:08 +00:00
Loïc Sharma
f2b182f54e
Fix some tests that fail with Swift Package Manager enabled (#152267)
https://github.com/flutter/flutter/pull/152049 was reverted as it broke several post-submit tests. This relands the test fixes in https://github.com/flutter/flutter/pull/152049 without enabling Swift Package Manager on the master channel. 

This change is split into two commits:

1. dd1762abb9 - The changes in https://github.com/flutter/flutter/pull/152049
1. 00fdcfb7bb - Undoes the changes that enabled Swift Package Manager on the master channel

Part of https://github.com/flutter/flutter/issues/151567
2024-07-26 21:08:32 +00:00
Ben Konyi
33b402d24c
Reland "Launch DDS from Dart SDK and prepare to serve DevTools from DDS (#146593)" (#152386)
This reverts commit 7cdc23b3e1.

The failure in the `native_assets_test` integration test on Windows was caused by the DevTools process not being shutdown by the `ColdRunner` when running the profile mode portion of the test. This resulted in the test being unable to clean up the project created by the test as DevTools was still holding onto a handle within the directory. This PR adds back the mistakenly removed DevTools shutdown logic in the `ColdRunner`.
2024-07-26 20:51:19 +00:00
John Ryan
af431b38d2
Use more CORS headers for flutter run server (#152249)
Also update tests

Attempt #2 of #152048

cc: @cbracken
2024-07-26 18:01:41 +00:00
Jackson Gardner
8f0e77696f
Set dart defines properly while in debug mode. (#152262)
Turns out just supporting the right value for `kDebugMode` was a lot simpler than I thought. Debug builds used to never go through the build system code path when using `flutter run`, but now that we have wasm this can occur with the run command.

This should address https://github.com/flutter/flutter/issues/148850
2024-07-25 22:00:50 +00:00
Nate Biggs
8cf2161845
Modify stepping integration test to accommodate new DDC async semantics. (#152204)
Updates the expected steps in the async function defined within `stepping_project.dart`. 

The Dart web team is updating the async semantics of DDC to bring them in line with the other backends. Currently, the DDC async semantics don't adhere to the Dart spec and this can lead to inconsistent and surprising results.

However, the step-over operation doesn't work well yet with the new DDC async semantics. In the long run we intend to improve this but until then the debug stepper will have sporadic results that we can't model well with this test. When we are able to fix the stepper functionality, we will return this test to cover more of the async function being stepped over.
2024-07-25 03:22:29 +00:00
auto-submit[bot]
f55ab0e77e
Reverts "Enable Swift Package Manager by default on master channel (#152049)" (#152243)
Reverts: flutter/flutter#152049
Initiated by: cbracken
Reason for reverting: iOS builds failing in post-submit
Original PR Author: loic-sharma

Reviewed By: {jmagman}

This change reverts the following previous change:
Changes:

1. Enables Swift Package Manager by default on the main/master channel
2. Fixes tests that fail if Swift Package Manager is enabled

Corresponding docs change: https://github.com/flutter/website/pull/10938

Addresses https://github.com/flutter/flutter/issues/151567
2024-07-24 16:49:25 +00:00
Loïc Sharma
08d8a7fa81
Enable Swift Package Manager by default on master channel (#152049)
Changes:

1. Enables Swift Package Manager by default on the main/master channel
2. Fixes tests that fail if Swift Package Manager is enabled

Corresponding docs change: https://github.com/flutter/website/pull/10938

Addresses https://github.com/flutter/flutter/issues/151567
2024-07-24 16:24:31 +00:00
Andrew Kolos
91813060c0
[tool] Guard more write/writeln calls on Process.stdin (#151146)
Contributes to fixing https://github.com/flutter/flutter/issues/137184.

This PR guards write calls in non-test files. This PR excludes
* packages/flutter_tools/lib/src/dart/analysis.dart due to a test timeout I would like to figure out in a separate PR and
* packages/flutter_tools/lib/src/compile.dart due to https://github.com/flutter/flutter/issues/151255
2024-07-23 19:27:52 +00:00
Brandon DeRosier
ed470fd101
[native_assets] Fix macOS host build failure when there are no frameworks to sign. (#150742)
When the `"${native_assets_path}"*.framework` glob doesn't resolve anything, the bash will run the loop once with the original unglobbed value: `/path/to/native/assets/*.framework`. Skip this case to prevent the build from failing when there are no frameworks to sign.

To reproduce this build failure:
1. Enable native assets in the Flutter tool: `flutter config --enable-native-assets`
2. Create a Flutter project with the default template: `flutter create test_native_assets`
3. Add a build hook that does nothing (`hook/build.dart`).
4. Try to build/run the app: `flutter run --debug -d macos`
2024-07-23 07:37:30 +00:00
Jenn Magder
f33ffc00ea
Use Xcode build setting PRODUCT_NAME to find app and archive paths (#140242)
1. Instead of getting the `FULL_PRODUCT_NAME` Xcode build setting (`Runner.app`) instead use `PRODUCT_NAME` since most places really want the product name, and the extension stripping wasn't correct when the name contained periods.
2. Don't instruct the user to open the `xcarchive` in Xcode if it doesn't exist.

Fixes https://github.com/flutter/flutter/issues/140212
2024-07-22 23:54:24 +00:00
Andrew Kolos
ebe53d570a
Fix asset transformation in the presence of resolution-aware asset variants (#151932)
For the necessary background knowledge, see the flutter.dev content on [Resolution-aware image assets](https://docs.flutter.dev/ui/assets/assets-and-images#resolution-aware) and [Conditional bundling of assets based on app flavor](https://docs.flutter.dev/ui/assets/assets-and-images#conditional-bundling-of-assets-based-on-app-flavor) if you don't have a basic understanding of these features.

Fixes https://github.com/flutter/flutter/issues/151813 by using unique temporary directories, per asset file, for transformations. Currently, only a single directory is used and the name of the temporary files was based only on the basename of files. This means that `assets/image.png` and `assets/2x/image.png` would share an output path (`<temp dir path>/image.png`), causing a race. If this quick and rough explanation is a bit confusing, the original issue—#151813—provides a full repro and correct identification of the exact cause of the failure that can occur in the asset transformation process.
2024-07-22 23:46:19 +00:00
Jason Simmons
49a315284d
Handle a WebSocketException that may be thrown when closing the WebKit inspection protocol connection to Chrome (#151997)
Noticed this happening on macOS when the tool tries to shut down Chrome after all tabs have already been closed.
2024-07-19 17:58:26 +00:00
Gray Mackall
8c5fbb4021
Remove conditionality in templates that was for AGP <= 4.2 support (#151845)
Not needed after https://github.com/flutter/flutter/pull/149204 (as long as nothing has changed since the comment was made 🙂).

Fixes https://github.com/flutter/flutter/issues/145105.
2024-07-16 22:33:24 +00:00
auto-submit[bot]
7cdc23b3e1
Reverts "Launch DDS from Dart SDK and prepare to serve DevTools from DDS (#146593)" (#151781)
Reverts: flutter/flutter#146593
Initiated by: zanderso
Reason for reverting: Consistently failing `Windows_android native_assets_android` as in https://ci.chromium.org/ui/p/flutter/builders/prod/Windows_android%20native_assets_android/2533/overview 
Original PR Author: bkonyi

Reviewed By: {christopherfujino, kenzieschmoll}

This change reverts the following previous change:
This change is a major step towards moving away from shipping DDS via Pub.

The first component of this PR is the move away from importing package:dds to launch DDS. Instead, DDS is launched out of process using the `dart development-service` command shipped with the Dart SDK. This makes Flutter's handling of DDS consistent with the standalone Dart VM.

The second component of this PR is the initial work to prepare for the removal of instances of DevTools being served manually by the flutter_tool, instead relying on DDS to serve DevTools. This will be consistent with how the standalone Dart VM serves DevTools, tying the DevTools lifecycle to a live DDS instance. This will allow for the removal of much of the logic needed to properly manage the lifecycle of the DevTools server in a future PR. Also, by serving DevTools from DDS, users will no longer need to forward a secondary port in remote workflows as DevTools will be available on the DDS port.

There's two remaining circumstances that will prevent us from removing DevtoolsRunner completely:

 - The daemon's `devtools.serve` endpoint
 - `flutter drive`'s `--profile-memory` flag used for recording memory profiles

This PR also includes some refactoring around `DebuggingOptions` to reduce the number of debugging related arguments being passed as parameters adjacent to a `DebuggingOptions` instance.
2024-07-15 19:55:18 +00:00
Ben Konyi
f023430859
Launch DDS from Dart SDK and prepare to serve DevTools from DDS (#146593)
This change is a major step towards moving away from shipping DDS via
Pub.

The first component of this PR is the move away from importing
package:dds to launch DDS. Instead, DDS is launched out of process using
the `dart development-service` command shipped with the Dart SDK. This
makes Flutter's handling of DDS consistent with the standalone Dart VM.

The second component of this PR is the initial work to prepare for the
removal of instances of DevTools being served manually by the
flutter_tool, instead relying on DDS to serve DevTools. This will be
consistent with how the standalone Dart VM serves DevTools, tying the
DevTools lifecycle to a live DDS instance. This will allow for the
removal of much of the logic needed to properly manage the lifecycle of
the DevTools server in a future PR. Also, by serving DevTools from DDS,
users will no longer need to forward a secondary port in remote
workflows as DevTools will be available on the DDS port. This code is currently 
commented out and will be enabled in a future PR.

There's two remaining circumstances that will prevent us from removing
DevtoolsRunner completely:

 - The daemon's `devtools.serve` endpoint
- `flutter drive`'s `--profile-memory` flag used for recording memory
profiles

This PR also includes some refactoring around `DebuggingOptions` to
reduce the number of debugging related arguments being passed as
parameters adjacent to a `DebuggingOptions` instance.
2024-07-15 14:08:31 -04:00
Martin Kustermann
ee7e5ec275
Emit source maps for wasm in flutter build web --wasm (#151643)
This will make

* `flutter run` have source maps enabled by default
* `flutter build` have source maps disabled by default

which mirrors what happens already today with the js compilers.

For local development this works quite well - even better than with
dart2js (see dart2js issues in [0]).
We do have some follow-up items for source maps in dart2wasm compiler,
see [1]

[0]
[flutter/flutter/issues/151641](https://github.com/flutter/flutter/issues/151641)
[1]
[dart-lang/sdk/issues/56232](https://github.com/dart-lang/sdk/issues/56232)
2024-07-13 10:24:16 +02:00
Chris Bracken
68f375fe38
[macOS] support secure restorable state by default (#151605)
By default, Flutter apps only do default AppKit app serialisation of
Window location etc. and by default, state serialisation in AppKit apps
is compatible with `NSSecureCoding`. AppKit apps generated since Xcode
13.2 include this method in the app delegate generated by the default
app template.

Background
==========

This method was added to opt into having [de]serialization require a
coder implementing the `NSSecureCoding` protocol. Apple wasn't able to
force this across the board, because `NSSecureCoding` limits certain
behaviours during deserialisation, which some third-party apps have have
previously relied on.

Specific background on the sorts of vulnerabilities that
`NSSecureCoding` was designed to prevent are described in the
`NSSecureCoding` documentation:

https://developer.apple.com/documentation/foundation/nssecurecoding?language=objc

A demonstration of a root privilege escalation and SIP bypass
vulnerability is described in the following blog post:
https://sector7.computest.nl/post/2022-08-process-injection-breaking-all-macos-security-layers-with-a-single-vulnerability/

Fixes: https://github.com/flutter/flutter/issues/150062

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-07-12 11:08:26 -07:00
Daco Harkes
cec2400658
[native_assets] Stop running link hooks in JIT mode (#151534)
Stop running link hooks in debug mode.

Rationale: link hooks only get access to tree-shaking info in release builds, so they can't do anything meaningful in debug builds. Debug builds should be fast as development cycle, so running less is better.

More details:

* https://github.com/dart-lang/native/issues/1252

Also: rolls packages to latest versions.

## Implementation details

The decision whether linking is enabled is made as follows:

* For normal builds `build_info.dart::BuildMode` is used to determine whether Dart is compiled in JIT or AOT mode.
* Testers always run in JIT, so no linking.
* Native asset dry runs only run for JIT builds (e.g only when hot reload and hot restart are enabled).

## Testing

The integration test is updated to output an asset for linking if `BuildConfig.linkingEnabled` is true, and to output an asset for bundling directly if linking is not enabled.
2024-07-12 06:44:23 +00:00
August
d55a5f96c1
feat: Support overriding native endorsed plugins (#137040)
These changes allow to override existing native endorsed (federated & inline) plugins with e.g. non-endorsed plugin implementations via direct dependencies as described in the section *Platform implementation selection* in the [design doc](https://docs.google.com/document/d/1LD7QjmzJZLCopUrFAAE98wOUQpjmguyGTN2wd_89Srs).

```yaml
# pubspec.yaml
name: example
dependencies:
  my_plugin: ^0.0.1
  my_plugin_android_alternative: ^0.0.1
```

Closes #80374, closes #59657

Related: Override Dart plugins (#87991, #79669)
2024-07-11 18:54:01 +00:00
Gray Mackall
bb637f3128
Reland "Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, and tests"... but no longer upgrade module AGP version (#151433)
Relands https://github.com/flutter/flutter/pull/150969, but removes the upgrade to the module AGP version.

The reason is that a more complicated change is required because in AGP 8.0 software components are no longer generated by default, but rather only generated for variants that are configured to be published using the publishing DSL (see the `android.disableAutomaticComponentCreation` section of https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes).

That broke our aar initialization script, because the components didn't exist so the `aar` tasks never got [created here](9ff9c67272/packages/flutter_tools/gradle/aar_init_script.gradle (L29)).

Verified that the one postsubmit that failed now passes (`android_obfuscate_test`)
2024-07-10 21:37:26 +00:00
Andrew Kolos
5103d75743
[tool] Remove some usages of deprecated usage package (#151359)
Partially addresses https://github.com/flutter/flutter/issues/150575 and https://github.com/flutter/flutter/issues/150665

Will require a g3fix.
2024-07-09 18:17:21 +00:00
Kenzie Davisson
5ebc993dff
Write the package config location to the test bootstrap. (#150440)
Work towards. This is the Flutter companion to
https://github.com/dart-lang/test/pull/2245. Work towards
https://github.com/dart-lang/test/issues/2246.
2024-07-09 09:36:19 -07:00
Daco Harkes
9ab8b6e150
[deps] Roll dart-lang/native packages (#151403)
Pass in the minimum iOS and MacOS version.

Roll dart-lang/native deps.

Related issues:

* https://github.com/flutter/flutter/issues/145104
* Relevant discussion: https://github.com/flutter/flutter/pull/148504
2024-07-09 07:41:35 +00:00
Andrew Kolos
c206a47505
[tool] make testUsingContext provide a Stdio (with hasTerminal unset) override by default (#151357)
While exploring https://github.com/flutter/flutter/issues/107607, I noticed that flutter_tools test results change based on whether `dart test` is run from a terminal or from a process (such as a Dart program). I also ran into this while writing tests for https://github.com/flutter/flutter/pull/150667.

This is due to tests that rely on the global `Stdio` instance, on which the `hasTerminal` property depends on whether the tool is being invoked from a terminal.

Ideally, `testUsingContext` would require any tests that depend on `globals.stdio` to define an override for `Stdio`, but this is not the case. Until a solution to this more general problem is figured out, I think we should have `testUsingContext` always provide a `Stdio` override by default.
2024-07-08 23:47:31 +00:00
Aaron Housh
25b72bab18
Fix invalid URL suggestion for gradle incompatability (#150999)
The current URL has 2 /to, but it should only be 1. However, this url redirects to https://docs.flutter.dev/release/breaking-changes/android-java-gradle-migration-guide, so I can change it to that if it's preferred just to go to the final destination - just don't know if it's a redirect for a reason

i didn't create an issue as it's a doc change, but if that's a requirement I can do that
2024-07-03 20:38:11 +00:00
Navaron Bracke
ab8bc00e2c
Fix project name fallback (#150614)
This PR changes the project name logic for `flutter create` to look for the name in the pubspec.yaml `name` field,
before falling back to the directory name.

Fixes https://github.com/flutter/flutter/issues/53106 

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-07-03 16:28:27 +00:00
Jason Simmons
b373fa2c6e
Handle a SocketException thrown when sending the browser close command to Chrome (#151197)
https://github.com/flutter/flutter/pull/150645 tries to shut down Chrome by sending a browser close command through a debug protocol.  The webkit_inspection_protocol library used to send the command may throw a SocketException if Chrome has already been shut down.
2024-07-03 13:23:20 +00:00
Danny Tuppeny
ce0e5c4330
[flutter_tools] Update the mapping for the Dart SDK internal URI (#151170)
This changes the mapping for the Dart SDK inside Flutter from `org-dartlang-sdk:///third_party/dart/sdk` to org-dartlang-sdk:///flutter/third_party/dart/sdk`. This URI changed in https://github.com/flutter/engine/pull/51917 but was not caught by tests because they only tested a specific set of mappings and there were no integration tests checking what URIs were actually produced by a running app.

So, this change also adds an integration tests that ensures that a real running app produces URIs that are then correctly mapped.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5164.
2024-07-02 22:56:17 +00:00
Andrew Kolos
8acf86d995
[tool] Fix stdin.flush calls on processes started by FakeProcessManager (#151183)
Fixes https://github.com/flutter/flutter/issues/151151
2024-07-02 20:40:06 +00:00
Andrew Kolos
af913a75b5
Use ErrorHandlingFileSystem.deleteIfExists when deleting .plugin_symlinks (#151073)
Fixes https://github.com/flutter/flutter/issues/137168.
2024-07-02 18:46:22 +00:00
Sigurd Meldgaard
21d996929b
Refactor BuildInfo to always require packageConfigPath (#150559)
Refactor warming up to #150196
2024-07-02 11:19:31 +02:00
Andrew Kolos
271e0427e3
[tool] remove some temporary printTrace calls (#151074)
Cleans up printTrace calls added while investigating https://github.com/flutter/flutter/issues/146879.

Also makes[ this `catch` clause ](https://github.com/flutter/flutter/pull/151074/files#diff-214723283174eb75e740a102252215723aa56716226ea92d084ef8a5bea4e931L578-R581)more precise.
2024-07-02 00:53:19 +00:00
auto-submit[bot]
dbc2dc88bc
Reverts "Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, and tests (#150969)" (#151147)
Reverts: flutter/flutter#150969
Initiated by: goderbauer
Reason for reverting: Failing test in https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8743574743030691569/+/u/run_android_obfuscate_test/stdout
Original PR Author: gmackall

Reviewed By: {christopherfujino, reidbaker}

This change reverts the following previous change:
After the land of https://github.com/flutter/engine/pull/53592, there is some log spam:
```
e: /Users/mackall/.gradle/caches/transforms-3/c1e137371ec1afe9bc9bd7b05823752d/transformed/fragment-1.7.1/jars/classes.jar!/META-INF/fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/mackall/.gradle/caches/transforms-3/d86c7cb1c556fe1655fa56db671c649c/transformed/jetified-activity-1.8.1/jars/classes.jar!/META-INF/activity_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
...
```

I think this is harmless, but still annoying. Upgrading the AGP version fixes it. To be honest, I don't know why (I expected the Kotlin version would do it). But after https://github.com/flutter/flutter/pull/146307, our tests have been running on AGP/Gradle 8.1/8.3 for a while, so it makes sense to upgrade anyways.

In a follow up PR:
1. Also upgrade the tests that were left behind in https://github.com/flutter/flutter/pull/146307, as I think removal of discontinued plugins paved the way here.
2024-07-01 23:31:26 +00:00
Gray Mackall
bd5ab96018
Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, and tests (#150969)
After the land of https://github.com/flutter/engine/pull/53592, there is some log spam:
```
e: /Users/mackall/.gradle/caches/transforms-3/c1e137371ec1afe9bc9bd7b05823752d/transformed/fragment-1.7.1/jars/classes.jar!/META-INF/fragment_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
e: /Users/mackall/.gradle/caches/transforms-3/d86c7cb1c556fe1655fa56db671c649c/transformed/jetified-activity-1.8.1/jars/classes.jar!/META-INF/activity_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
...
```

I think this is harmless, but still annoying. Upgrading the AGP version fixes it. To be honest, I don't know why (I expected the Kotlin version would do it). But after https://github.com/flutter/flutter/pull/146307, our tests have been running on AGP/Gradle 8.1/8.3 for a while, so it makes sense to upgrade anyways.

In a follow up PR:
1. Also upgrade the tests that were left behind in https://github.com/flutter/flutter/pull/146307, as I think removal of discontinued plugins paved the way here.
2024-07-01 21:41:59 +00:00
John McDole
33be93b210
Read AndroidManifest.xml and emit manifest-aar-impeller-(enabled|disabled) analytics (#150970)
Same as #150791 except with AARs (`flutter build module`)
2024-07-01 18:50:24 +00:00
Andrew Kolos
28ff59513b
[tool] when writing to openssl as a part of macOS/iOS code-signing, flush the stdin stream before closing it (#150120)
Fixes https://github.com/flutter/flutter/issues/100584. Might help https://github.com/flutter/flutter/issues/137184.
2024-06-28 22:01:04 +00:00
Michael Rittmeister
3a97a38c41
Add support for type-safe plugin apply (#150958)
The Gradle Kotlin DSL also allows for type-safe application of the Flutter Gradle plugin, which is currently undetected by the CLI
```kotlin
plugins {
  dev.flutter.`flutter-gradle-plugin`
}
```

Please note that the added test case isn't ideal, since the example gradle isn't actually valid kotlin DSL, however the `kotlin host app language with Gradle Kotlin DSL` is identical

Fixes #149859
2024-06-28 17:24:59 +00:00
Alejandro Santiago
47e65e806f
Use caret syntax with flutter create command (#150920)
The Pull Request changes the `dartSdkVersionBounds` value, which gets templated into the `pubspec.yaml` from the `flutter create`:

ffdeaa1995/packages/flutter_tools/templates/app/pubspec.yaml.tmpl (L8)

As from the Dart dependencies ["Best practices"](https://dart.dev/tools/pub/dependencies#use-caret-syntax) section of the documentation:

> Use caret syntax
Specify dependencies using the [caret syntax](https://dart.dev/tools/pub/dependencies#caret-syntax). This allows the pub tool to select newer versions of the package when they become available. Further, it places an upper bound on the allowed version.

To learn more about the Caret syntax, refer to the [Caret syntax documentation](ffdeaa1995/packages/flutter_tools/templates/app/pubspec.yaml.tmpl (L8)).

**Additional context**
- https://github.com/VGVentures/io_crossword/pull/592#event-13304953743 (cc: @kevmoo)
- [Very Good Templates](https://github.com/VeryGoodOpenSource/very_good_templates) relies on the Caret syntax when templating the Dart SDK
2024-06-28 16:46:34 +00:00
Danny Tuppeny
eb58fe16b6
[flutter_tools] Include more details in structured errors sent to a DAP client (#150698)
The debug adapter converts Flutter's structured errors into a text format to be sent to the debug client and shown in the console. When an error is not the first error since the last reload, it is shown as just a summary (since it may be caused by a prior error). In this mode, the filter was causing some important information (the erroring widget) to be omitted.

This tweaks the logic to include child nodes of a `DiagnosticBlock` in this mode.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4743

## Before:

![image](https://github.com/flutter/flutter/assets/1078012/46ccd2ef-b165-46b4-a8ab-4473f82a904c)

## After:

![image](https://github.com/flutter/flutter/assets/1078012/232f866e-cf6f-4016-9d1d-49323204da04)
2024-06-28 06:36:03 +00:00
Andrew Kolos
1f672c24a3
[tool] make the systemTempDirectory getter on ErrorHandlingFileSystem wrap the underlying filesystem's temp directory in aErrorHandlingDirectory (#150876)
Fixes https://github.com/flutter/flutter/issues/150730

If you can think of a more concise title, be my guest.
2024-06-27 20:39:14 +00:00
Jackson Gardner
74688cea3d
Have flutter.js load local canvaskit instead of the CDN when appropriate (#150806)
If the user specifies the `--no-web-resources-cdn` or `--local-web-sdk`, we should use the local version of CanvasKit. `flutter.js` now has a flag that can be specified in the build configuration that tells it to load locally instead.

Also, added a link to the relevant docs in the web template warnings.

This addresses https://github.com/flutter/flutter/issues/148713
Also fixes https://github.com/flutter/flutter/issues/145559
2024-06-27 18:44:04 +00:00
LouiseHsu
9a673175ab
Fixes flutter build ipa failure: Command line name "app-store" is deprecated. Use "app-store-connect" (#150407)
Fixes https://github.com/flutter/flutter/issues/149369
2024-06-27 07:42:21 +00:00
Parker Lougheed
c946a5a526
Switch to more reliable flutter.dev link destinations in the tool (#150587)
Contributes to https://github.com/flutter/website/issues/10363.
2024-06-26 23:30:39 +00:00
Matan Lurey
a6a8caaa73
Read AndroidManifest.xml and emit manifest-impeller-(enabled|disabled) analytics (#150791)
Work towards https://github.com/flutter/flutter/issues/132712.

After this PR, after a completed `flutter build apk` command, we:

- Emit a `manifest-impeller-disabled` command if `io.flutter.embedding.android.EnableImpeller` is `'false'`.
- Emit a `manifest-impeller-disabled` command if `io.flutter.embedding.android.EnableImpeller` is _missing_.
- Emit a `manifest-impeller-enabled` command if `io.flutter.embedding.android.EnableImpeller` is `'true'`.

We will need to change the default (see `_impellerEnabledByDefault` in `project.dart`) before releasing, otherwise we will misreport `manifest-impeller-disabled` at a much higher rate than actual. If there is a way to instead compute the default instead of hard-coding, that would have been good.

See <https://docs.flutter.dev/perf/impeller#android> for details on the key-value pair.

---

I also did a tad of TLC, by removing the (now-defunct) `Usage` events for `flutter build ios`, so they are consistent.

/cc @zanderso, @chinmaygarde, @jonahwilliams
2024-06-25 22:41:23 +00:00
Jason Simmons
9afd397cd4
[flutter_tools] Shut down Chromium cleanly using a command sent through the debug protocol (#150645)
The previous approach of killing the Chromium parent process sometimes caused leaks of child processes on Windows.  The Browser.close command in the debug protocol will tell Chromium to shut down all of its processes.
2024-06-25 21:43:02 +00:00
Andrew Kolos
d520f07647
[tool] make ErrorHandlingFileSystem.deleteIfExists catch error code 3 (ERROR_PATH_NOT_FOUND on Windows) (#150741)
Resolves https://github.com/flutter/flutter/issues/150736

FYI I plan to cherry-pick this
2024-06-25 16:24:04 +00:00
Danny Tuppeny
e250c655d1
[flutter_tools/dap] Handle app.stop errors when launching/attaching (#149734)
Two issues I noticed when I hit the issue at https://github.com/flutter/flutter/issues/149258

1. When the an app.stop event arrives from Flutter with an error, DAP does not pass that error back to the client so there's no visibility of the error.
2. If app.stop occurs but no app.start ever did, we leave the progress notification hanging around

This fixes both by handling app.stop and closing any open launch progress as well as passing any error to the client.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5124
2024-06-25 10:56:29 +00:00
Reid Baker
7292c94bac
Update android_device.dart to have clearLogs not print to standard error (#150197)
Even though this does not fix the below issue lets land this anyway as not logging to stderr when clearing logs makes sense to me. 
related https://github.com/flutter/flutter/issues/150093 

The test added is bad. It does not verify the behavior changed. 
To verify the behavior changed correctly I would need to modify the generic device class to have clearLogs be an async function like many of the other calls. That would mean modifying every other device type and their implementations and their tests. Then I would need to update android_device to expose its logger. That is more than I have time for to validate a 2% flake error. 

Feel free to disagree in the comments on this pr.
2024-06-24 18:38:27 +00:00
Andrew Kolos
8e4f704abc
[CLI tool] in flutter test, consider --flavor when validating the cached asset bundle (#150461)
Fixes https://github.com/flutter/flutter/issues/150296

**Context.** `flutter test` has its own code path for writing flutter app [assets](https://docs.flutter.dev/ui/assets/assets-and-images). https://github.com/flutter/flutter/pull/132985 introduced [flavor-conditional asset bundling ](https://docs.flutter.dev/deployment/flavors#conditionally-bundling-assets-based-on-flavor), which lets users control which assets get bundled based on `--flavor`. `--flavor` is supported in `flutter test`.

**Bug and fix.** `--flavor` isn't considered when deciding whether we need to rebuild this asset bundle:

5e448f4ce5/packages/flutter_tools/lib/src/commands/test.dart (L709)

This PR address this by writing the value of `--flavor` to a file in the build directory and checking that when validating the cached asset bundle.
2024-06-20 17:45:09 +00:00
Gray Mackall
b98d48549c
Make flutter tool enforce >= kotlin 1.7.0, Gradle 7.0.2, and AGP 7.0.0, and Fix test failures blocking androidx upgrade (#149204)
PR to pave the way for https://github.com/flutter/engine/pull/53001 to re-land

Summary: 
- Enforces use of Kotlin >= `1.7.0` (please see below note)
- Fixes ci failures that prevented the above PR from landing.

Details:

Because it landed initially, we are able to fake the roll in this PR to fix all the tests ([see my comment](https://github.com/flutter/flutter/pull/149204#discussion_r1617924772)).

Fixes all the tests that failed:
1. `module_test` failing on multiple platforms (3/9 of the failures). 
Failure is 
```
> Android resource linking failed
   ERROR:/b/s/w/ir/x/t/flutter_module_test.KECMXW/hello/.android/plugins_build_output/device_info/intermediates/merged_res/release/values/values.xml:194: AAPT: error: resource android:attr/lStar not found.
```

This is a rather unhelpful error message but some [folks online suggest](https://stackoverflow.com/a/69050529) that upgrading your `compileSdk` version fixes this.
These resolve when I remove the dependency on the long discontinued [package_info](https://pub.dev/packages/package_info) and [device_info](https://pub.dev/packages/device_info) packages, perhaps because they are transitively pulling in low `compileSdk` versions? This is unclear to me.

2. `module_custom_host_app_name_test` was failing for the same reason (another 3/9, or cumulative 6/9).
3. `tool_integration_tests_3_4` was a flake 🙂 (7/9)
4. `framework_tests_slow` needed a newer version of the Kotlin Gradle plugin (the flutter tool tells us this, so I just upgraded as suggested) and it resolved (8/9)
5.`android_preview_tool_integration_tests` needed newer AGP and KGP versions. I also refactored the tests, and bumped our error versions, fixing https://github.com/flutter/flutter/issues/142653.

**Note that the bump to KGP is not in line with our policy** - we didn't warn for `1.5.0-1.6.x` for a release (or at all) before dropping support. But I think it might still be justified:
- The bump to our androidx libraries unblocks ongoing Scribe work, and also includes a fix for a [memory leak](https://github.com/flutter/flutter/issues/129307#issuecomment-1601636959) and a [crash on folding phones](https://github.com/flutter/flutter/issues/114868#issuecomment-2133226962), among many other bug fixes.
- Gradle [doesn't test on half of that range](https://docs.gradle.org/current/userguide/compatibility.html#kotlin), and so we implicitly can't claim to support it either. More generally, our Java and Kotlin support ranges should probably strictly fall within what Gradle tests.
2024-06-18 20:24:09 +00:00
Jenn Magder
6c06abbb55
Add test for engine artifact framework permissions (#148786)
Framework test to validate the iOS and macOS framework engine artifacts (Flutter.framework and FlutterMacOS.framework) have read and executable permissions.

~~Will fail until https://github.com/flutter/engine/pull/52961 rolls.~~ <-- it rolled https://github.com/flutter/flutter/pull/148819
2024-06-18 17:07:21 +00:00
Lexycon
0287c22564
Add 'fail-fast' argument to flutter test (#149587)
This adds the 'fail-fast' argument to flutter test, since dart test already supports this feature. Tests can now be stopped after first failure. 

Fixes #124406
2024-06-17 22:06:07 +00:00
Kate Lovett
62586dc09d
Update old wiki links (#149544)
Part of https://github.com/flutter/flutter/issues/145009

Finishes updating links in the repo that pointed to the old wiki
2024-06-17 17:26:08 +00:00
Martin Kustermann
32df505897
Use --(no-)strip-wams instead of --(no-)-name-section in dart compile wasm (#150180) 2024-06-13 21:56:41 +02:00
Matan Lurey
0cc27b993f
Suppress Flutter update check if --machine is present at all. (#150138)
Fixes https://github.com/flutter/flutter/issues/145158.

In an ideal world, the `--machine` flag would be strictly a global flag which sub-commands can choose to use (or perhaps just to report a `toolExit` that they don't have a `--machine` supported-mode if not. However currently, there is both a global flag, and command-specific flags.

This leads to the confusing scenario where:
```sh
flutter devices --machine
```

... still checks for a Flutter update, printing a banner and breaking the JSON output.

This PR "fixes" that by allowing `--machine` _anywhere_ in the command-line arguments to suppress the check.

/cc @johnmccutchan.
2024-06-13 19:35:49 +00:00
Victoria Ashworth
e18c5e209c
Improve build time when using SwiftPM (#150052)
When using SwiftPM, we use `flutter assemble` in an Xcode Pre-action to run the `debug_unpack_macos` (or profile/release) target. This target is also later used in a Run Script build phase. Depending on `ARCHS` build setting, the Flutter/FlutterMacOS binary is thinned. In the Run Script build phase, `ARCHS` is filtered to the active arch. However, in the Pre-action it doesn't always filter to the active arch. As a workaround, assume arm64 if the [`NATIVE_ARCH`](https://developer.apple.com/documentation/xcode/build-settings-reference/#NATIVEARCH) is arm, otherwise assume x86_64.

Also, this PR adds a define flag `PreBuildAction`, which gives the Pre-action a [unique configuration of defines](fdb74fd3e7/packages/flutter_tools/lib/src/build_system/build_system.dart (L355-L372)) and therefore a separate filecache from the Run Script build phase filecache. This improves caching so the Run Script build phase action doesn't find missing targets in the filecache. It also uses this flag to skip cleaning up the previous build files.

Lastly, skip the Pre-action if the build command is `clean`.

Note: For iOS, if [`CodesignIdentity`](14df7be3f9/packages/flutter_tools/bin/xcode_backend.dart (L470-L473)) is set, the Pre-action and Run Script build phase will not match because the Pre-action does not send the `EXPANDED_CODE_SIGN_IDENTITY` and therefore will codesign it with [`-`](14df7be3f9/packages/flutter_tools/lib/src/build_system/targets/ios.dart (L695)) instead. This will cause `debug_unpack_macos` to invalidate and rerun every time. A potential solution would be to move [codesigning out of the Run Script build phase](14df7be3f9/packages/flutter_tools/lib/src/build_system/targets/ios.dart (L299)) to the [Thin Binary build phase](14df7be3f9/packages/flutter_tools/bin/xcode_backend.dart (L204-L257)) after it's copied into the TARGET_BUILD_DIR, like we do with [macOS](14df7be3f9/packages/flutter_tools/bin/macos_assemble.sh (L179-L183)).
2024-06-12 21:16:07 +00:00
Satyam Srivastav
c5e5e0cc36
closes #issue136763, changed a command to generate gradle error message according to platform (#149877)
Currently, the error message displayed to regenerate the lockfiles gives a Unix-like command ./gradlew, which will be incorrect for Windows environments. This PR uses globals.platform.isWindows to give the appropriate command.

closes #136763
2024-06-12 05:12:57 +00:00
Mouad Debbar
ee10d2fc3a
[web] Change --web-renderer default from auto to canvaskit (#149773)
- When `--web-renderer` is omitted, keep the value `null` until it later materializes to either `canvaskit` or `skwasm`.
- No more hardcoded defaults anywhere. We use `WebRendererMode.defaultForJs/defaultForWasm` instead.
- When in `--wasm` mode, the JS fallback is now `canvaskit` instead of `auto`.
- Add test for defaulting to `skwasm` when `--wasm` is enabled.

Fixes https://github.com/flutter/flutter/issues/149826
2024-06-10 16:38:09 +00:00
Daco Harkes
2a543aa43b
[native_assets] Fix framework name deduplication (#149761)
Applies 02d5286e02 to MacOS.

I'm hoping this will fix:

* https://github.com/flutter/flutter/issues/148955
2024-06-07 07:07:08 +00:00
Jackson Gardner
5fb34b719e
Attempt to fix some web test flakiness. (#149828)
If the service is disposed when we make calls on it, we need to bubble up an exception that is understood by the callers.

This is another speculative fix for https://github.com/flutter/flutter/issues/149238.
2024-06-06 23:22:51 +00:00
Victoria Ashworth
529a4d2bac
Disable sandboxing for macOS apps and tests in CI (#149618)
macOS 14 added new requirements that un-codesigned sandbox apps must be granted access when changed. Waiting for this UI caused macOS tests to fail on macOS 14 because the test runner forced codesigning off. Additionally, adding codesigning is not sufficient, since it must still be approved before codesigning is enough to pass the check. As a workaround, this PR disables sandboxing for macOS apps/tests in CI.

![Screenshot 2024-05-30 at 2 41 33 PM](https://github.com/flutter/flutter/assets/682784/1bc32620-5edb-420a-866c-5cc529b2ac55)

https://developer.apple.com/documentation/updates/security#June-2023)
> App Sandbox now associates your macOS app with its sandbox container using its code signature. The operating system asks the person using your app to grant permission if it tries to access a sandbox container associated with a different app. For more information, see [Accessing files from the macOS App Sandbox](https://developer.apple.com/documentation/security/app_sandbox/accessing_files_from_the_macos_app_sandbox).

And that link explains why this is happening on a macOS 14 update:

> In macOS 14 and later, the operating system uses your app’s code signature to associate it with its sandbox container. If your app tries to access the sandbox container owned by another app, the system asks the person using your app whether to grant access. If the person denies access and your app is already running, then it can’t read or write the files in the other app’s sandbox container. If the person denies access while your app is launching and trying to enter the other app’s sandbox container, your app fails to launch.
> 
> The operating system also tracks the association between an app’s code signing identity and its sandbox container for helper tools, including launch agents. If a person denies permission for a launch agent to enter its sandbox container and the app fails to start, launchd starts the launch agent again and the operating system re-requests access.

Fixes https://github.com/flutter/flutter/issues/149268.
Fixes framework part of https://github.com/flutter/flutter/issues/149264.
Might fix packages issue: https://github.com/flutter/flutter/issues/149329.

Verified framework tests:
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20plugin_test_macos/9/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20run_debug_test_macos/2/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20tool_integration_tests_4_4/2/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20integration_ui_test_test_macos/3/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20flavors_test_macos/3/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac_benchmark%20complex_layout_scroll_perf_macos__timeline_summary/6/overview
2024-06-04 21:51:19 +00:00
Brandon DeRosier
02bc11c9be
Place flutter_gpu in the package cache. (#149299)
Resolves https://github.com/flutter/flutter/issues/131711.

Fetch https://storage.googleapis.com/flutter_infra_release/flutter/${engine_version}/flutter_gpu.zip and extract it into the package cache.

Cannot function until https://github.com/flutter/engine/pull/53107 has been merged/rolled into the framework.
2024-06-03 22:46:02 +00:00
Greg Price
5e448f4ce5
Support failures-only and silent reporters in flutter test (#148739)
Fixes #148738.

Also add some tests for this part of the `flutter test` CLI.
2024-06-03 19:44:39 +00:00
Andrew Kolos
be724796aa
update generated localized message files in the stocks test app (#148741)
Fixes https://github.com/flutter/flutter/issues/149386. Fixes https://github.com/flutter/flutter/issues/106150.

The stocks test app includes Dart files containing localized messages generated by `package:flutter_localizations`. However, these files appear to have become out of date. Running `pub get` in the project will regenerate these files and generate a diff, which can be annoying when working on the repo.

This PR generates the files. ~~It also updates the templates for these files to be compliant with flutter/flutter repo lint rules, including `noop_primitive_operations` and `use_super_parameters`.~~ It also adds `// ignore_for_file: type=lint` to these files to disable linting for these files. This avoids issues like  https://github.com/flutter/flutter/issues/106150 and [this](https://github.com/flutter/flutter/pull/148741#issuecomment-2141161753).
2024-06-03 18:08:19 +00:00
Danny Tuppeny
182c1e6a36
Unskip expression evaluation test (#149253)
This test was skipped in https://github.com/flutter/flutter/pull/148737
because it had became flaky because instances created in expression
evaluation were being collected quickly. The change in
ffbbdb5a10
prevents things in the VM Service's ring buffer from being GC'd which
should resolve the issue.

I am unable to reproduce this test flaking locally on latest code.

Fixes https://github.com/flutter/flutter/issues/148704



## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
2024-05-29 23:24:36 +01:00
Gray Mackall
df64ca0b11
Change android_plugin_new_output_dir_test.dart test description (#149198)
Changes the test description to what I understand it is testing. 

Context at https://discord.com/channels/608014603317936148/846507907876257822/1245077048599515157.

cc @chunfengyao as the original author, as I see you are still active on Github 🙂
2024-05-28 23:04:10 +00:00
Martin Kustermann
9938ab1c60
[web] Remove --dart-sdk flag to dart2wasm compiler (#149129)
Dart2wasm only needs a platform file, which contains the compiled
`dart:*` libraries. There's no need to specify a seperate `--dart-sdk`
option (anymore).

(See also https://dart-review.googlesource.com/c/sdk/+/366821)
2024-05-28 09:48:44 +02:00
Victor Eronmosele
4c929f0f44
Prevent test folder deletion on running flutter create --empty on an existing app project (#147160)
This PR modifies the `flutter create --empty` command to not delete the `test/` folder when run on an existing app project. 

Before:
```bash
flutter create my_app --empty
mkdir my_app/test
if test -d my_app/test; then echo "test exists"; else echo "test does not exist"; fi # test exists
flutter create my_app --empty  
if test -d my_app/test; then echo "test exists"; else echo "test does not exist"; fi # test does not exist
```

After:
```bash
flutter create my_app --empty
mkdir my_app/test
if test -d my_app/test; then echo "test exists"; else echo "test does not exist"; fi # test exists
flutter create my_app --empty  
if test -d my_app/test; then echo "test exists"; else echo "test does not exist"; fi # test exists
```
Fixes https://github.com/flutter/flutter/issues/134928
2024-05-22 17:37:05 +00:00
Daco Harkes
1f16d9121c
[native_assets] Add support for link hooks (#148474)
This PR adds support invoking `link.dart` hooks.

Link hooks can add new assets. Link hooks can transform assets sent to link hook from build hooks.

This PR does not yet add support for getting tree-shake information in the link hooks. This is pending on defining the `resources.json` format (https://github.com/dart-lang/sdk/issues/55494).

Issue:

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

## Implementation considerations

The build hooks could be run before Dart compilation and the link hooks after Dart compilation. (This is how it's done in Dart standalone.) However, due to the way the `Target`s are set up, this would require two targets and serializing and deserializing the `BuildResult` in between these. This would lead to more code but no benefits. Currently there is nothing that mandates running build hooks before Dart compilation.

## Testing

* The unit tests verify that the native_assets_builder `link` and `linkDryRun` would be invoked with help of the existing fake.
* The native assets integration test now also invokes an FFI call of a package that adds the asset during the link hook instead of the build hook.
  * In order to keep coverage of the `flutter create --template=package_ffi`, `flutter create` is still run and the extra dependency is added and an extra ffi call is added. (Open to alternative suggestions.)
2024-05-22 16:02:00 +00:00
holzgeist
43548359c9
add default-flavor field to flutter pubspec, which will be used as the flavor in flutter build/run if --flavor is not provided (#147968)
This PR adds a new flag `default-flavor` in the `flutter` section of `pubspec.yaml`. It allows developers of multi-flavor android apps to specify a default flavor to be used for `flutter run`, `flutter build` etc.
Using `flutter run` on flavored apps already works without specifying `--flavor` already works on iOS (it defaults to the `runner` schema), so I (and others in #22856) figured this would be nice to have.

fixes #22856
2024-05-22 05:11:24 +00:00
Gray Mackall
7a3baded76
Add a migrator to remove FlutterMultiDexApplication.java (#148515)
Fixes https://github.com/flutter/flutter/issues/148368.

See [my comment](https://github.com/flutter/flutter/issues/148368#issuecomment-2116133180) for the specific context.
2024-05-21 18:53:53 +00:00
Matej Knopp
454dd7e29c
[iOS] specify minimum os version for native asset frameworks (#148504)
Fixes https://github.com/flutter/flutter/issues/148501
2024-05-21 16:16:08 +00:00
Zachary Anderson
b6bed5aaf2
Skip flaky test in expression_evaluation_test.dart (#148737)
Skipping for https://github.com/flutter/flutter/issues/148704
2024-05-21 08:35:40 -07:00
LouiseHsu
185f526ddf
Fixes incorrect read/write permissions on Flutter.framework and FlutterMacOS.framework (#148580)
Fixes https://github.com/flutter/flutter/issues/148354

Fixes https://github.com/flutter/flutter/issues/147142
Closes https://github.com/flutter/flutter/pull/147144

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
2024-05-20 14:41:52 -07:00
Jason Simmons
a45cde5998
Remove the no-shuffle tag on the flutter_tools create_test suite (#148688)
The issue was fixed by https://github.com/flutter/flutter/pull/148616
2024-05-20 18:58:59 +00:00
Nate
73ecc8a9b2
Reland "if chains → switch expressions" (#148634)
I did a goof a while back:

![late initialization error](https://github.com/flutter/flutter/assets/10457200/47dc423f-0dd0-4869-9a11-59cb7d1ea46e)

Now that [the bug is fixed](e9d403541f), I think we're good to re-implement the if-chains cleanup!

Related:

- https://github.com/flutter/flutter/pull/147793
- https://github.com/flutter/flutter/pull/148556
- https://github.com/flutter/flutter/issues/148548
2024-05-20 17:43:00 +00:00
Nate
adf279f308
Fix template manifest test (#148616)
`'flutter create should tool exit if the template manifest cannot be read'` fails consistently, as shown by #148614.

The test expects a `ToolExit` with the message "Unable to read the template manifest", but depending on how the test is being run, a different exception ("Cannot create a project within the Flutter SDK") is sometimes thrown first.

This pull request relocates the test project to `dev/` to prevent the extraneous error.
2024-05-18 23:42:22 +00:00
Jason Simmons
791a782a8f
Disable shuffling in the flutter_tools create_test suite (#148619)
This suite is failing when run with --test-randomize-ordering-seed=20240518

This is currently blocking the engine->framework roller
2024-05-18 23:02:23 +00:00
Andrew Kolos
ac6409b311
Swap crash reporting with unified analytics (#148525)
Fixes: https://github.com/flutter/flutter/issues/147260

(this is a remake of https://github.com/flutter/flutter/pull/147296; in hindsight I could have force-pushed there instead but 🤷)
2024-05-18 01:30:13 +00:00
Zachary Anderson
597462a3c4
Revert "if chains → switch expressions" (#148556)
Reverts flutter/flutter#147793

Introduced https://github.com/flutter/flutter/issues/148548.
2024-05-17 10:27:02 -07:00
stuartmorgan
b98ffdc467
Add PrivacyInfo.xcprivacy to plugin template (#148485)
Adds an empty privacy manifest, and commented out code to include it in the build, to the plugin template. This will make it much easier to explain how to add a privacy manifest in plugin docs, since instead of explaining the format of the file from scratch and providing example code to inculde it, we can just instruct people to add entries to an exisitng file and then uncomment a line or two. This will also make it much easier to figure out from the template output itself how to add support for people who don't find the documentation.

Part of https://github.com/flutter/flutter/issues/131940

Fixes https://github.com/flutter/flutter/issues/140013
2024-05-16 19:58:11 +00:00
stuartmorgan
3a27301013
Fix iOS reference in macOS Cocoapods error (#148506)
Fixes a Cocoapods error message that was hard-coded to reference iOS to instead reference iOS or macOS as appropriate.

Fixes https://github.com/flutter/flutter/issues/146744
2024-05-16 19:58:08 +00:00
Matej Knopp
c719f03ded
[macOS] codesign native assets during embed (#148310)
Fixes https://github.com/flutter/flutter/issues/148051

Currently only the "embed" phase, which is run during the Runner target
build have access to code-signing identity. The flutter assemble target,
which does the main build (and also builds native assets) does not have
access to the code-signing identity.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
2024-05-16 18:12:33 +02:00
Andrew Kolos
7d263507fb
add more print traces in hot runner workflow (#148258)
In service of https://github.com/flutter/flutter/issues/146879. See https://github.com/flutter/flutter/issues/146879#issuecomment-2108784673 in particular for the purpose of this PR. This adds a few more `printTrace` calls to try to see where we are getting stuck.
2024-05-13 22:51:48 +00:00
Nate
4734d80f22
if chains → switch expressions (#147793)
Previous "if-chains" pull requests:
- https://github.com/flutter/flutter/pull/144905
- https://github.com/flutter/flutter/pull/144977
- https://github.com/flutter/flutter/pull/145194
- https://github.com/flutter/flutter/pull/146293
- https://github.com/flutter/flutter/pull/147472

<br>

I think this one should be enough to wrap things up!

fixes https://github.com/flutter/flutter/issues/144903

---------

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2024-05-10 00:55:48 -06:00
Danny Tuppeny
cea1d6f055
Unpin DDS and roll pub packages (#147925)
DDS was temporarily pinned to 4.1.0 because 4.2.0 triggered some test
failures (see https://github.com/flutter/flutter/pull/147250). Those
failures should be fixed by vm_service 14.2.2, so this unpins DDS and
rolls both of these packages (along with devtools_shared, which is a DDS
dependency).

(If the bot updates vm_service before this is done, I can rebase over
that will reduce the size of this PR to just a few files)
2024-05-08 10:35:28 +01:00
Elliott Brooks
b487b8c19a
[flutter web] Listen for service extension registration events to determine hot-restart method name (#147897)
### Some background:

* Flutter registers the hot-restart service extension for all devices **except** web devices. For web devices, DWDS registers the service extensions.
* When a user is debugging their code via VS Code, the VS Code Dart extension [sends a hot-restart](94cb81c552/src/debug/run_daemon_base.ts (L100)) request via stdin/out to flutter_tools
* flutter_tools then [calls the "hotRestart" service extension](f3978c7a46/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart (L447)) (which, again, has been registered by DWDS)

### Why is this change necessary?

In DWDS, we are changing how we register the "hotRestart" service extension (here is the PR for that: https://github.com/dart-lang/webdev/pull/2388). Previously, we registered the "hotRestart" service extension on a client that was directly connected to the VmService. With https://github.com/dart-lang/webdev/pull/2388, we will be registering the "hotRestart" service extension on a client that is connected to DDS. 

When a service extension is registered against DDS, DDS adds a prefix to the service extension method name (e.g. "hotRestart" becomes "s0.hotRestart"). It informs clients of the service extension name via `kServiceRegistered` events sent to the `Service` stream. 

Therefore, this change simply listens to those service extension registered events, and uses them to determine the "hotRestart" service extension's method name.
2024-05-07 23:06:59 +00:00