Commit Graph

5240 Commits

Author SHA1 Message Date
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