Commit Graph

9275 Commits

Author SHA1 Message Date
auto-submit[bot]
c1a301e8e8
Reverts "Manual pub roll (#156549)" (#156607)
Reverts: flutter/flutter#156549
Initiated by: christopherfujino
Reason for reverting: https://github.com/flutter/flutter/issues/156606
Original PR Author: christopherfujino

Reviewed By: {matanlurey}

This change reverts the following previous change:
I manually ran:

```
flutter update-packages --force-upgrade
cd dev/tools && dart bin/generate_gradle_lockfiles.dart --no-gradle-generation --no-exclusion
```

Note this bumps the `google_mobile_ads` plugin, which caused https://github.com/flutter/flutter/issues/156474. I expect it to work this time after https://flutter-review.googlesource.com/c/recipes/+/60340
2024-10-11 18:52:18 +00:00
Christopher Fujino
184deff0f2
Manual pub roll (#156549)
I manually ran:

```
flutter update-packages --force-upgrade
cd dev/tools && dart bin/generate_gradle_lockfiles.dart --no-gradle-generation --no-exclusion
```

Note this bumps the `google_mobile_ads` plugin, which caused https://github.com/flutter/flutter/issues/156474. I expect it to work this time after https://flutter-review.googlesource.com/c/recipes/+/60340
2024-10-11 17:57:36 +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
225e4aabb5
Flutter templates example app Gradle memory settings (#156201)
Adding even more memory to see if it addresses flakes:

* https://github.com/flutter/flutter/issues/156063#issuecomment-2388949557
2024-10-10 16:02:11 +00:00
auto-submit[bot]
0403c1cb8f
Reverts "Roll pub packages (#156440)" (#156473)
Reverts: flutter/flutter#156440
Initiated by: zanderso
Reason for reverting: Failing in post submit with
```
[2024-10-08 18:00:22.743647] [STDOUT] stdout:                [!] CocoaPods could not find compatible versions for pod "Google-Mobile-Ads-SDK":
[2024-10-08 18:00:22.743695] [STDOUT] stdout:                  In Podfile:
[2024-10-08 18:00:22.743718] [STDOUT] stdout:                    google_mobile_ads (from `.symlinks/plugins/google_mobile_ads/ios`) was resolved t
Original PR Author: flutter-pub-roller-bot

Reviewed By: {fluttergithubbot}

This change reverts the following previous change:
This PR was generated by `flutter update-packages --force-upgrade`.
2024-10-09 13:45:47 +00:00
flutter-pub-roller-bot
f96d1618c4
Roll pub packages (#156440)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-10-08 23:28:01 +00:00
Kevin Moore
a80c3823f5
[tool] Update description of where to install platforms in XCode (#156432)
Fixes https://github.com/flutter/flutter/issues/156431
2024-10-08 21:34:22 +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
flutter-pub-roller-bot
a9047e93bc
Roll pub packages (#156117)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-10-02 23:01:09 +00:00
flutter-pub-roller-bot
4ad274720f
Roll pub packages (#156114)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-10-02 21:12:16 +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
Devon Carew
ff7e5f3d73
update flutter create generated projects to use package:flutter_lints 5.0.0 (#156011)
- update flutter create generated projects to use package:flutter_lints
5.0.0; this is a follow-up to publishing `package:flutter_lints` 5.0.0

- related to https://github.com/dart-lang/lints/issues/205

## 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-10-02 08:36:40 -07:00
flutter-pub-roller-bot
d59499988a
Roll pub packages (#155846)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-10-01 22:45:08 +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
Gray Mackall
cad7418f0a
Roll packages manually (#155786)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

*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-09-27 00:49:08 +00: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
Robert Ancell
8925e1ffdf
Move the Linux runner into a subdirectory (#153812)
Fixes https://github.com/flutter/flutter/issues/60213
2024-09-26 11:52:53 +12: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
Mohellebi abdessalem
936cfb8edc
reduce warnings inside flutter.groovy file #2 (#155628)
follow up for : [#152073](https://github.com/flutter/flutter/pull/152073)
2024-09-25 19:41:20 +00: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
flutter-pub-roller-bot
db76401cd8
Roll pub packages (#155640)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-09-25 00:03:57 +00:00
Parker Lougheed
22570daa18
Misc docs cleanup and fixes (#155501) 2024-09-24 20:03:08 +00:00
Danny Tuppeny
9fcbcd4357
Fix some broken links in DAP readme (#155600)
The location of the DAP readme in the Dart SDK repo moved. Some of the links here got updated, but apparently not all.
2024-09-24 14:47:24 +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
Kristen McWilliam
ea3c3e719e
fix(Linux): specify application id (#154522)
This change sets the program name to the application ID, which helps various
systems like GTK and desktop environments map this running application to its
corresponding .desktop file. This ensures better integration by allowing the
application to be recognized beyond its binary name.

Notably, this is necessary on Wayland to map the running application window to
the desktop file, and therefore apply the correct icon.

I've tested that this works in both GNOME & KDE Wayland sessions.

Partially addresses https://github.com/flutter/flutter/issues/53229

Resolves https://github.com/flutter/flutter/issues/154521

## Icon Association

### Task switcher

The task switcher shows the application's icon in the bottom-middle. Before it only showed a generic Wayland icon.

| Before 	| After 	|
|--------	|-------	|
| ![before1](https://github.com/user-attachments/assets/6f9392f3-c6ff-4ea4-b71b-7186949e2afd) |![after1](https://github.com/user-attachments/assets/e70d394a-a880-42c9-8409-6b975fb59ce1) |

### Window Decorations

KDE shows the application's icon on the window decorations, at the top-left.  Before it only showed a generic Wayland icon.

| Before 	| After 	|
|--------	|-------	|
| ![before2](https://github.com/user-attachments/assets/8076ccf8-79c7-4a60-b12b-2fe1ccf9c393) | ![after2](https://github.com/user-attachments/assets/7a96def2-030c-45c4-9c3f-403256b5da07) |
2024-09-12 20:52:50 +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