Commit graph

698 commits

Author SHA1 Message Date
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
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
Loïc Sharma 86135b7774
[macOS] Migrate @NSApplicationMain attribute to @main (#146848)
This migrates Flutter to use the `@main` attribute introduced in Swift 5.3. The `@NSApplicationMain` attribute is deprecated and will be removed in Swift 6. See: https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.md

This change is split into two commits:

1. a508d3e503 - This updates the macOS app template and adds a migration to replace `@NSApplicationMain` uses with `@main`. 
2. f43482786e - I ran `flutter run -d macos` on each Flutter macOS app in this repository to verify the app migrates and launches successfully.

Follow-up to https://github.com/flutter/flutter/pull/146707
Fixes https://github.com/flutter/flutter/issues/143044
2024-04-18 03:08:36 +00:00
Michael Goderbauer 63f917c36d
Bump meta to 1.14.0 (#146925)
Not sure why the auto-roller hasn't picked this up...
2024-04-17 15:25:51 -07:00
Loïc Sharma 194fefaa53
[iOS] Migrate @UIApplicationMain attribute to @main (#146707)
This migrates Flutter to use the `@main` attribute introduced in Swift 5.3. The `@UIApplicationMain` attribute is deprecated and will be removed in Swift 6. See: https://github.com/apple/swift-evolution/blob/main/proposals/0383-deprecate-uiapplicationmain-and-nsapplicationmain.md

This change is split into two commits:

1. ad18797428 - This updates the iOS app template and adds a migration to replace `@UIApplicationMain` uses with `@main`. 
2. 8ecbb2f29f - I ran `flutter run` on each Flutter iOS app in this repository to verify the app migrates and launches successfully.

Part of https://github.com/flutter/flutter/issues/143044
2024-04-16 22:13:03 +00:00
flutter-pub-roller-bot 4efdf190a8
Roll pub packages (#146842)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-04-16 22:07:27 +00:00
Chris Bracken a34086a573
[Windows] Drop support for Windows 7/8 apps in template (#146668)
Since Flutter no longer supports Windows 7.x or 8.x, this eliminates support from the Windows app template. No tests to eliminate, since Windows 7 and 8 were "best-efforts" tier and untested.

Fixes: https://github.com/flutter/flutter/issues/140830
RFC: http://flutter.dev/go/flutter-drop-win7-2024
2024-04-12 01:07:20 +00:00
Gray Mackall 22e0c89f0a
Reland "Bump to AGP 8.1/Gradle 8.3 (almost) everywhere" (#146307)
Relands https://github.com/flutter/flutter/pull/146181.

Just 3 commits:
1. a revert of the revert
2. the fix described in https://github.com/flutter/flutter/pull/146181#issuecomment-2038238869
3. updating two postsubmit tests from Java 11 to 17, as that is required for this new AGP version.

I've verified that `flutter build apk --flavor paid --debug` fails in `dev/integration_tests/flavors/` with the error in ci without (2), and succeeds with it. 

I've also verified that the `dev/benchmarks/complex_layout` app builds successfully with Java 17.

That covers all the postsubmits that failed according [to the dashboard](https://flutter-dashboard.appspot.com/#/build).
2024-04-05 19:09:20 +00:00
auto-submit[bot] 23ecc37ed2
Reverts "Bump to AGP 8.1/Gradle 8.3 (almost) everywhere (#146181)" (#146305)
Reverts: flutter/flutter#146181
Initiated by: LongCatIsLooong
Reason for reverting: https://ci.chromium.org/ui/p/flutter/builders/prod/Windows_android%20flavors_test_win/11086/overview
Original PR Author: gmackall

Reviewed By: {reidbaker, christopherfujino}

This change reverts the following previous change:
Bump almost all tests to AGP 8.1 and Gradle 8.3

Flutter gallery is excluded, because it uses discontinued plugins that in turn use old Gradle versions, and that prevents upgrading. Will take some extra work to figure out what to do there.

Should bump templates next

Entire PR generated with the lockfile generation script, except for:
1. changes within `dev/integration_tests/gradle_deprecated_settings/android/`, which must be done manually (and exclusion of the gallery for reason mentioned above).
2. Changes to many `AndroidManifest.xml` files to remove the `package` attribute and instead set that same value in the `build.gradle`, in the `namespace` attribute of the `android` closure (corresponds to an AGP behavior change, see  https://d.android.com/r/tools/upgrade-assistant/set-namespace).
3. Removes the use of the `battery` plugin in `android_embedding_v2_smoke_test` because the plugin is discontinued, unused, and blocks upgrading the AGP version for that app because the discontinued plugin itself uses a very old AGP version.
2024-04-04 21:07:17 +00:00
Gray Mackall ab520c9849
Bump to AGP 8.1/Gradle 8.3 (almost) everywhere (#146181)
Bump almost all tests to AGP 8.1 and Gradle 8.3

Flutter gallery is excluded, because it uses discontinued plugins that in turn use old Gradle versions, and that prevents upgrading. Will take some extra work to figure out what to do there.

Should bump templates next

Entire PR generated with the lockfile generation script, except for:
1. changes within `dev/integration_tests/gradle_deprecated_settings/android/`, which must be done manually (and exclusion of the gallery for reason mentioned above).
2. Changes to many `AndroidManifest.xml` files to remove the `package` attribute and instead set that same value in the `build.gradle`, in the `namespace` attribute of the `android` closure (corresponds to an AGP behavior change, see  https://d.android.com/r/tools/upgrade-assistant/set-namespace).
3. Removes the use of the `battery` plugin in `android_embedding_v2_smoke_test` because the plugin is discontinued, unused, and blocks upgrading the AGP version for that app because the discontinued plugin itself uses a very old AGP version.
2024-04-04 20:11:09 +00:00
Qun Cheng 69db714fbb
Update material_color_utilities package version to latest 0.11.1 (#145959)
This PR is to update material_color_utilities package version to the latest. `material_color_utilities/scheme/scheme_fruit_salad.dart` and `material_color_utilities/scheme/scheme_rainbow.dart` are exported after version 0.9.0.

Once this PR is merged, we don't need to explicitly import these two files like the change in PR #144805, which breaks some dependencies in `Google testing`.
2024-04-03 02:16:13 +00:00
Polina Cherkasova bca1d6ad1f
Upgrade leak_tracker. (#145997) 2024-03-29 12:31:52 -07:00
Polina Cherkasova 1a2f34ab5b
Upgrade leak_tracker. (#145940) 2024-03-29 02:39:17 +00:00
Nate 7fb35db62f
Intensive if chain refactoring (#145194)
This pull request refactors if-statements into switch expressions, as part of the effort to solve issue #144903.

Making changes beyond just swapping syntax is more difficult (and also more difficult to review, I apologize), but much more satisfying too.
2024-03-22 13:55:06 +00:00
flutter-pub-roller-bot 61b3f975a0
Roll pub packages (#145476)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-03-21 00:09:24 +00:00
Nate 26e379e0fc
Refactoring if chains into switch statements (#144905)
Based on issue #144903, this PR aims to bring the codebase more in line with the [Flutter repo style guide](https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#avoid-using-if-chains-or--or--with-enum-values):

> #### Avoid using `if` chains or `?:` or `==` with enum values

<br>

This change unfortunately increases the total line length, but it also improves readability.
2024-03-11 23:04:57 +00:00
Polina Cherkasova a04fe3169a
Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
Gray Mackall c61dc2a586
Format all kotlin according to ktlint (#143390)
Entire pr generated with [ktlint](https://github.com/pinterest/ktlint) --format. First step before enabling linting as part of presubmit for kotlin changes.
2024-02-14 17:58:18 +00:00
Polina Cherkasova b48dfca382
Upgrade leak_tracker. (#143236) 2024-02-09 14:41:22 -08:00
Bartek Pacia deaa600204
Reland "Update gradle lockfiles template (#140115)" (#143081)
Trying to reland #140115 which I had to revert in #142889 because [it broke the tree](https://github.com/flutter/flutter/pull/140115#issuecomment-1925774719).

In this PR I fixed the post-submit following tests:
2024-02-08 16:22:15 +00:00
Gray Mackall 120a01ccd2
Restore log dumps for gradle OOM crashes, and set a value for MaxMetaspaceSize (#143085)
Re-sets two jvmargs that were getting cleared because we set a value for `-Xmx`. Could help with https://github.com/flutter/flutter/issues/142957. Copied from comment here https://github.com/flutter/flutter/issues/142957:
>Two random things I ran into while looking into this that might help:
>
>1. Gradle has defaults for a couple of the jvmargs, and setting any one of them clears those defaults for the others (bug here https://github.com/gradle/gradle/issues/19750). This can cause the "Gradle daemon to consume more and more native memory until it crashes", though the bug typically has a different associated error. It seems worth it to re-set those defaults.
>2. There is a property we can set that will give us a heap dump on OOM ([-XX:HeapDumpOnOutOfMemoryError](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/clopts001.html))

Mostly just a find and replace from `find . -name gradle.properties -exec sed -i '' 's/\-Xmx4G/-Xmx4G\ \-XX:MaxMetaspaceSize=2G\ \-XX:+HeapDumpOnOutOfMemoryError/g' {} \;`, with the templates and the one test that writes from a string replaced by hand. I didn't set a value for `MaxMetaspaceSize` in the template files because I want to make sure this value doesn't cause problems in ci first (changes to the templates are essentially un-revertable for those who `flutter create` while the changes exist).
2024-02-07 19:25:39 +00:00
Chris Bracken 9f8fe3f04c
[Windows] Fix signed/unsigned int comparison (#142341)
Previously, we were comparing the signed int `target_length` (returned by WideCharToMultiByte) to a size_t string length, resulting in a signed/unsigned comparison warning as follows:

```
windows\runner\utils.cpp(54,43): warning C4018:  '>': signed/unsigned mismatch
```

WideCharToMultiByte returns:
* 0 on error
* the number of bytes written to the buffer pointed to by its fifth parameter, lpMultiByteStr, on success.

As a result it's safe to store the return value in an unsigned int, which eliminates the warning.

No changes to tests since this is dependent on end-user project settings/modifications and does not trigger a warning with default project settings.

Fixes: https://github.com/flutter/flutter/issues/134227
2024-02-07 00:09:57 +00:00
auto-submit[bot] f8a77225f3
Reverts "Update gradle lockfiles template" (#142889)
Reverts flutter/flutter#140115

Initiated by: bartekpacia

Reason for reverting: broke the tree

- [`Linux firebase_abstract_method_smoke_test`](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20firebase_abstract_method_smoke_test/15844/overview)
- [`Linux_android android_view_scroll_perf__timeline_summary`](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_android%20android_view_scroll_perf__timeline_summary/13453/overview)
- [`Linux_android platform_views

Original PR Author: bartekpacia

Reviewed By: {gmackall}

This change reverts the following previous change:
Original Description:
This PR updates almost* all Gradle buildscripts in the Flutter repo the `example` and `dev` (in particular, in `dev/integration_tests` and in `dev/benchmarks`) directories to apply Flutter's Gradle plugins using the declarative `plugins {}` block.

*almost, because:
- add-to-app (aka hybrid) apps are not migrated (related https://github.com/flutter/flutter/issues/138756)
- apps that purposefully use build files to ensure backward compatibility (e.g. [`gradle_deprecated_settings`](https://github.com/flutter/flutter/tree/3.16.0/dev/integration_tests/gradle_deprecated_settings))
2024-02-04 14:28:18 +00:00
Bartek Pacia 85888bccf2
Update gradle lockfiles template (#140115)
This PR updates almost* all Gradle buildscripts in the Flutter repo the `example` and `dev` (in particular, in `dev/integration_tests` and in `dev/benchmarks`) directories to apply Flutter's Gradle plugins using the declarative `plugins {}` block.

*almost, because:
- add-to-app (aka hybrid) apps are not migrated (related https://github.com/flutter/flutter/issues/138756)
- apps that purposefully use build files to ensure backward compatibility (e.g. [`gradle_deprecated_settings`](https://github.com/flutter/flutter/tree/3.16.0/dev/integration_tests/gradle_deprecated_settings))
2024-02-04 13:10:49 +00:00
Christopher Fujino a80333349a
Unpin test (#141427)
Fixes https://github.com/flutter/flutter/issues/140169
2024-02-01 18:53:23 +00:00
Polina Cherkasova a522b38e96
Upgrade leak_tracker. (#142162) 2024-01-24 15:33:17 -08:00
Jenn Magder 90ced90f1b
Sort Swift imports in templates (#141487)
`swift-format` alphabetizes imports.  Alphabetize them in swift template files and integration tests.

I found this as part of https://github.com/flutter/flutter/issues/41129 running `swift-import` on packages.
2024-01-16 18:07:21 +00:00
Polina Cherkasova 1f3103e50d
Upgrade leak_tracker. (#141153) 2024-01-09 12:02:35 -08:00
Jenn Magder 076cb8a328
Migrate Xcode projects last version checks to Xcode 15.1 (#140256)
Change the following in the `flutter create` templates.  I didn't make any auto-migrations for existing apps because none seem that critical:
1. Turn on `ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS` in iOS and macOS.
1. Turn on `BuildIndependentTargetsInParallel` in macOS template.  https://github.com/flutter/flutter/pull/125827/files#r1181817619 
1. Turn on `DEAD_CODE_STRIPPING` in macOS template. 
1. Set `ENABLE_USER_SCRIPT_SANDBOXING=NO` in iOS and macOS template.  `flutter` scripts don't work with this on.  This might require a migration in the future to explicitly turn this one off. However at least for now if the setting isn't present it defaults to `NO`.

Add migration for `LastUpgradeVersion` so users won't see these validation issues in Xcode.

Run migrator on all the example apps.  A few aren't Flutter apps so I edited them in Xcode.

Fixes https://github.com/flutter/flutter/issues/140253
See also https://github.com/flutter/flutter/issues/125817 and https://github.com/flutter/flutter/pull/90304.
2024-01-03 23:05:46 +00:00
Jenn Magder b08fc60024
Set template and migrate apps to iOS 12 minimum (#140823)
Reland https://github.com/flutter/flutter/pull/140478 with `ios_content_validation_test` test fix.
```
[ios_content_validation_test] Process terminated with exit code 0.
Task result:
{
  "success": true,
  "data": null,
  "detailFiles": [],
  "benchmarkScoreKeys": [],
  "reason": "success"
}

```

__________

1. Change templates to `IPHONEOS_DEPLOYMENT_TARGET`, `MinimumOSVersion`, and Podfile `platform :ios` to 12.0.
2. Add migrator for Podfile part to migrate `platform :ios, '11.0'` -> `platform :ios, '12.0'`
3. Compile with `-miphoneos-version-min=12.0`
4. Run the migrator on all example apps and integration tests.

See also https://github.com/flutter/flutter/pull/62902 and https://github.com/flutter/flutter/pull/85174 and https://github.com/flutter/flutter/pull/101963

Fixes https://github.com/flutter/flutter/issues/136060
2024-01-03 00:47:40 +00:00
Polina Cherkasova 45c611f040
Upgrade leak_tracker. (#140758) 2024-01-02 20:58:16 +00:00
auto-submit[bot] bd634f3298
Reverts "Set template and migrate apps to iOS 12 minimum" (#140822)
Reverts flutter/flutter#140478
Initiated by: loic-sharma
This change reverts the following previous change:
Original Description:
1. Change templates to `IPHONEOS_DEPLOYMENT_TARGET`, `MinimumOSVersion`, and Podfile `platform :ios` to 12.0.
2. Add migrator for Podfile part to migrate `platform :ios, '11.0'` -> `platform :ios, '12.0'`
3. Compile with `-miphoneos-version-min=12.0`
4. Run the migrator on all example apps and integration tests.

See also https://github.com/flutter/flutter/pull/62902 and https://github.com/flutter/flutter/pull/85174 and https://github.com/flutter/flutter/pull/101963

Fixes https://github.com/flutter/flutter/issues/136060
2024-01-02 20:49:19 +00:00
Jenn Magder acdbcadb9e
Set template and migrate apps to iOS 12 minimum (#140478)
1. Change templates to `IPHONEOS_DEPLOYMENT_TARGET`, `MinimumOSVersion`, and Podfile `platform :ios` to 12.0.
2. Add migrator for Podfile part to migrate `platform :ios, '11.0'` -> `platform :ios, '12.0'`
3. Compile with `-miphoneos-version-min=12.0`
4. Run the migrator on all example apps and integration tests.

See also https://github.com/flutter/flutter/pull/62902 and https://github.com/flutter/flutter/pull/85174 and https://github.com/flutter/flutter/pull/101963

Fixes https://github.com/flutter/flutter/issues/136060
2024-01-02 19:42:13 +00:00
flutter-pub-roller-bot 2d75f76b44
Roll pub packages (#140472)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-12-20 22:57:21 +00:00
Polina Cherkasova 6368d65622
Upgrade to version of leak tracker that does not depend on test_widgets. (#140247)
Contributes to: https://github.com/flutter/flutter/issues/135856
2023-12-19 04:28:09 +00:00
Polina Cherkasova bda158adf0
Reorganize dependencies on leak_tracker. (#140233)
1. Move leak_tracker and leak_tracker_testing out of direct dependencies.
2. Move leak_tracker_flutter_testing from dev to prod dependencies for flutter_test

It is prerequisite for https://github.com/flutter/flutter/issues/135856
2023-12-15 19:33:23 +00:00
Srujan Gaddam 2407f699e9
Move package:web dependency to dev dependency (#139696)
Pinning the package:web dependency constrains downstream packages from
using newer versions and making sure they support the version pinned in
Flutter. Since the usage of package:web in Flutter is light, we should
instead have a small shim like the engine and keep package:web as a dev
dependency only.
2023-12-15 08:53:27 -08:00
Polina Cherkasova 6a85684877
Increase versions of leak tracker libraries. (#140018)
Contributes to https://github.com/flutter/flutter/issues/135856
2023-12-15 05:18:23 +00:00
Camille Simon 1fa54ea90a
[Android] Bump template & integration test Gradle version to 7.6.4 (#139276)
Updates Gradle version for Flutter project templates and integration tests to at least 7.6.3 (changed all of those with versions below it) to fix security vulnerability.

Part of fix for https://github.com/flutter/flutter/issues/138336.
2023-12-07 18:31:20 +00:00
Ian Hickson fca7bc9e28
Roll dependencies (#139606)
test-exempt: rolling dependencies
2023-12-06 19:22:06 +00:00
Gray Mackall 4ce5421ca9
Update generate_gradle_lockfiles script to represent newer templates, and run it on dev/ (#135175)
Upgrades agp versions and lockfiles for `dev/`. Also changes the lockfile generation script to represent the newer form of the `settings.gradle` template, and therefore also propagates these changes.

~~Potentially related to https://github.com/flutter/flutter/issues/134419~~, but worth doing anyways. (not actually related)
2023-12-05 18:04:08 +00:00
Nate 3267fbc07a
Implement switch expressions in dev/ (#139048)
I previously made a PR (#136140) that used `switch` expressions to make some parts of the Flutter codebase easier to understand. It was assigned to the framework team, and @christopherfujino let me know that it was too large to effectively review and recommended breaking it up into smaller pull requests.

Here's a PR that only targets files in the `dev/` directory. Hopefully this will be easier to work with!

(solves issue https://github.com/flutter/flutter/issues/136139)
2023-11-28 23:40:28 +00:00
Srujan Gaddam d8ffc7390c
Pin package:web 0.4.0 (#138428)
This version is needed so that dart:js_interop can move to extension
types. Also adds some code to handle some breaking changes:

- Body -> Response. Body was an IDL interface mixin type we exposed in
dart:html. Going forward, users should either use Request or Response.
- Casts to JSAny. These are temporary until we move package:web types to
extension types. Currently, package:web types can't implement JSObject
as JSObject will move to be an extension type itself.

Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
2023-11-15 15:03:21 -08:00
Polina Cherkasova 793827d98a
Upgrade leak tracker. (#138283) 2023-11-13 09:47:55 -08:00
Chinmoy 0bde95dc06
Deprecates onWillAccept and onAccept callbacks in DragTarget. (#133691)
This PR deprecates `onWillAccept` and `onAccept` over `onWillAcceptWithDetails` and `onAcceptWithDetails`.

Fixes: #133347
2023-11-10 22:47:22 +00:00
Camille Simon c66bb0a18a
[Android] Support Android 34 (take 2) (#137967)
Re-lands https://github.com/flutter/flutter/pull/137191.

The fix for the issue causing that PR to be reverted was tested in this PR but ultimately landed separately in https://github.com/flutter/flutter/pull/138093.
2023-11-09 22:40:15 +00:00
auto-submit[bot] c4ce9479bb
Reverts "[Android] Support Android 34" (#137865)
Reverts flutter/flutter#137191
Initiated by: camsim99
This change reverts the following previous change:
Original Description:
Adds support for Android 34 in the following ways:

- Bumps integration tests compile SDK versions 33 --> 34
- Bumps template compile SDK version 33 --> 34
- Also changes deprecated `compileSdkVersion` to `compileSdk`

Part of https://github.com/flutter/flutter/issues/134220
2023-11-03 20:14:19 +00:00
Polina Cherkasova e1b420cd5b
Upgrade leak_tracker and remove some deps in allow list. (#137806) 2023-11-03 06:20:47 -07:00
Camille Simon 675fec805a
[Android] Support Android 34 (#137191)
Adds support for Android 34 in the following ways:

- Bumps integration tests compile SDK versions 33 --> 34
- Bumps template compile SDK version 33 --> 34
- Also changes deprecated `compileSdkVersion` to `compileSdk`

Part of https://github.com/flutter/flutter/issues/134220
2023-11-02 22:18:11 +00:00