Commit graph

8974 commits

Author SHA1 Message Date
auto-submit[bot] 7f2b238c55
Reverts "Add FlutterMacOS.xcframework artifact (#143244)" (#144253)
Reverts flutter/flutter#143244

Initiated by: vashworth

Reason for reverting: Increased `flutter_framework_uncompressed_bytes` - see https://github.com/flutter/flutter/issues/144251

Original PR Author: vashworth

Reviewed By: {jmagman}

This change reverts the following previous change:
Original Description:
Replace `FlutterMacOS.framework` cached artifact with `FlutterMacOS.xcframework`. Also, update usage of `FlutterMacOS.framework` to use `FlutterMacOS.xcframework`.

Part of https://github.com/flutter/flutter/issues/126016.
2024-02-27 20:47:26 +00:00
Martin Kustermann 616a0260fe
[web] Make flutter web profile builds always keep wasm symbols (#144130)
So far `flutter build web --wasm` was always stripping wasm symbols
except if `--no-strip-wasm` is passed.

=> Ensure that in profile mode we also keep the symbols
2024-02-27 21:21:42 +01:00
Victoria Ashworth d1d9605974
Remove force Xcode debug workflow (#144185)
Now that all tests are on Xcode 15 and iOS 17, we no longer need to force test Xcode debug workflow.

Related https://github.com/flutter/flutter/issues/144020.
2024-02-27 18:18:07 +00:00
Victoria Ashworth 42252cd4c6
Add FlutterMacOS.xcframework artifact (#143244)
Replace `FlutterMacOS.framework` cached artifact with `FlutterMacOS.xcframework`. Also, update usage of `FlutterMacOS.framework` to use `FlutterMacOS.xcframework`.

Part of https://github.com/flutter/flutter/issues/126016.
2024-02-27 16:47:53 +00:00
Jia Hao c30f998eb5
[flutter_tools] Fix missing stack trace from daemon (#144113)
When the daemon throws an exception, the receiving client is unable to surface stack traces from the daemon.

This is because it is sent with the `trace` key here:

1e8dd1e4d6/packages/flutter_tools/lib/src/daemon.dart (L308)

But the client tries to read it with the `stackTrace` key here:

1e8dd1e4d6/packages/flutter_tools/lib/src/daemon.dart (L343)

Thanks to @mraleph for spotting this!

*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.*

b/326825892
2024-02-27 08:39:49 +00:00
Gustl22 b4f925e85a
refactor: Differentiate pubspec and resolution errors for plugins (#142035)
Part of #137040 and #80374

- Differentiate pubspec and resolution errors
- Rename platform to platformKey
- Add TODO for rework logic of flag [throwOnPluginPubspecError]
- Swap for loop: handle by platform and then by plugin
2024-02-26 19:45:18 +00:00
Victoria Ashworth 45c8881eb2
Update copyDirectory to allow links to not be followed (#144040)
In other words, copy links within a directory as links rather than copying them as files/directories. 

Fixes https://github.com/flutter/flutter/issues/144032.
2024-02-26 16:07:22 +00:00
MarkZ ee94fe262b
Adding support for DDC modules when running Flutter Web in debug mode (#141423)
### Context:

DDC modules are abstractions over how libraries are loaded/updated. The entirety of google3 uses the DDC/legacy module system due to its flexibility extensibility over the other two (ES6 and AMD/RequireJS). Unifying DDC's module system saves us from duplicating work and will allow us to have finer grained control over how JS modules are loaded. This is a a prerequisite to features such as hot reload.

### Overview:

This change plumbs a boolean flag through flutter_tools that switches between DDC (new) and AMD (current) modules. This mode is automatically applied when `--extra-front-end-options=--dartdevc-module-format=ddc` is specified alongside `flutter run`. Other important additions include:
* Splitting Flutter artifacts between DDC and AMD modules
* Adding unit tests for the DDC module system
* Additional bootstrapper logic for the DDC module system

We don't expect to see any user-visible behavior or performance differences.

This is dependent on [incoming module system support in DWDS](https://github.com/dart-lang/webdev/pull/2295) and [additional artifacts in the engine](https://github.com/flutter/engine/pull/47783).

This is part of a greater effort to deprecate the AMD module system: https://github.com/dart-lang/sdk/issues/52361
2024-02-24 00:26:04 +00:00
Andrew Kolos 37c8df1690
allow optional direct injection of Config instance into DevFS (#144002)
In service of https://github.com/flutter/flutter/issues/143348

This will make testing of asset transformation hot reload behavior easier (specifically in that we can avoid having to write a test that looks like this: 5d02c27248/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart (L167-L249)
2024-02-23 23:39:49 +00:00
Andrew Kolos 4e814a5f3c
Enable asset transformation for flutter build for iOS, Android, Windows, MacOS, Linux, and web (also flutter run without hot reload support) (#143815)
See title. These are are the platforms that use the `CopyAssets` `Target` as part of their build target.

Partial implementation of https://github.com/flutter/flutter/issues/143348.
2024-02-23 22:48:08 +00:00
Nate c53a18f4e4
Implementing null-aware operators throughout the repository (#143804)
This pull request fixes #143803 by taking advantage of Dart's null-aware operators.

And unlike `switch` expressions ([9 PRs](https://github.com/flutter/flutter/pull/143634) and counting), the Flutter codebase is already fantastic when it comes to null-aware coding. After refactoring the entire repo, all the changes involving `?.` and `??` can fit into a single pull request.
2024-02-23 19:02:22 +00:00
Tirth 3053b6ce5b
Fixed Small Typo in Emulators Test Name (#143578)
Fixed Small Typo in Emulators Test Name. I filed #140656 and it was fixed in #142853. I noticed this one there and decided to send a fix.
2024-02-22 18:35:21 +00:00
Derek Xu dfb5888e8f
Support using lightweight Flutter Engines to run tests (#141726)
This PR implements the functionality described above and hides it behind
the `--experimental-faster-testing` flag of `flutter test`.

### The following are some performance measurements from test runs
conducted on GitHub Actions

run 1 logs:
https://github.com/derekxu16/flutter_test_ci/actions/runs/8008029772/attempts/1
run 2 logs:
https://github.com/derekxu16/flutter_test_ci/actions/runs/8008029772/attempts/2
run 3 logs:
https://github.com/derekxu16/flutter_test_ci/actions/runs/8008029772/attempts/3

**length of `flutter test --reporter=expanded test/animation
test/foundation` step**

run 1: 54s
run 2: 52s
run 3: 56s

average: 54s

**length of `flutter test --experimental-faster-testing
--reporter=expanded test/animation test/foundation` step**

run 1: 27s
run 2: 27s
run 3: 29s

average: 27.67s (~48.77% shorter than 54s)

**length of `flutter test --reporter=expanded test/animation
test/foundation test/gestures test/painting test/physics test/rendering
test/scheduler test/semantics test/services` step**

run 1: 260s
run 2: 270s
run 3: 305s

average: 278.33s


**length of `flutter test --experimental-faster-testing
--reporter=expanded test/animation test/foundation test/gestures
test/painting test/physics test/rendering test/scheduler test/semantics
test/services` step**

from a clean build (right after deleting the build folder):

run 1: 215s
run 2: 227s
run 3: 245s

average: 229s (~17.72% shorter than 278.33s)

Note that in reality, `test/material` was not passed to `flutter test`
in the trials below. All of the test files under `test/material` except
for `test/material/icons_test.dart` were listed out individually

**length of `flutter test --reporter=expanded test/material` step**

run 1: 408s
run 2: 421s
run 3: 451s

average: 426.67s

**length of `flutter test --experimental-faster-testing
--reporter=expanded test/material` step**

run 1: 382s
run 2: 373s
run 3: 400s

average: 385s (~9.77% shorter than 426.67s)

---------

Co-authored-by: Dan Field <dnfield@google.com>
2024-02-22 13:32:29 -05:00
Reid Baker b09a015ff5
Add aab as alias for appbundle (#143855)
- **Fix #143778 add aab as alias to appbundle**

Fixes #143778
2024-02-21 18:19:41 +00:00
Kevin Moore bc334396db
[flutter_tools] enable wasm compile on beta channel (#143779)
Wasm compilation is now available on `master` and `beta` channels.
2024-02-21 01:20:04 +00:00
Andrew Kolos b491f16d9c
instead of exiting the tool, print a warning when using --flavor with an incompatible device (#143735)
Fixes https://github.com/flutter/flutter/issues/143574 by printing a warning (instead of exiting) when `--flavor` is used with a target platform that doesn't have flavors support.
2024-02-20 21:02:49 +00:00
Gustl22 9620e3f69c
Reland (2): "Fix how Gradle resolves Android plugin" (#142498)
Previous PR: #137115, 
Revert: #142464
Fixes #141940
Closes #142487
2024-02-19 18:07:33 +00:00
Jason Simmons 8036488776
Add an override annotation to the lineTerminator setter in the MemoryStdout fake class (#143646)
This is required by a new API recently added to Dart.

See https://github.com/flutter/flutter/issues/143614
2024-02-17 16:41:27 +00:00
Brian Quinlan e8dcf1909e
Implement lineTerminator in MemoryStdout Fake (#143608)
https://dart-review.googlesource.com/c/sdk/+/326761/24/sdk/lib/io/stdio.dart#380
added a `lineTerminator` field to `Stdout`.

Add that field to the fake in packages/test.

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

## 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] 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
2024-02-16 15:46:01 -08:00
Michael Goderbauer 546bdec7ef
Fix implementation imports outside of lib (#143594)
Work towards https://github.com/dart-lang/linter/issues/4859

There are libraries outside a `lib/` directory, which violate `implementation_imports`.

Supersedes https://github.com/flutter/flutter/pull/143560.
2024-02-16 22:38:10 +00:00
Andrew Kolos 3a18473bd6
add parsing of assets transformer declarations in pubspec.yaml (#143557)
In service of https://github.com/flutter/flutter/issues/143348.

This PR enables parsing of the pubspec yaml schemes for assets with transformations as described in #143348.
2024-02-16 22:24:59 +00:00
Andrew Kolos 9a6bda87d9
rebuild the asset bundle if a file has been modified between flutter test runs (#143569)
Fixes https://github.com/flutter/flutter/issues/143513
Should be cherry-picked to beta.
2024-02-16 22:21:08 +00:00
Martin Kustermann d4b1b6e744
Reland "Disentangle and align flutter build web --wasm flags (#143517)" (#143549)
Update: Accidentally use `--O4` instead of `-O4` in `dev/devicelab/lib/tasks/web_benchmarks.dart` update.

Original description:

* Make `flutter build web` have one option that determins the
optimization level: `-O<level>` / `--optimization-level=<level>` =>
Defaulting to -O4 => Will apply to both dart2js and dart2wasm

* Deprecate `--dart2js-optimization=O<level>`

* Disentagle concept of optimization from concept of static symbols =>
Add a `--strip-wasm` / `--no-strip-wasm` flag that determins whether
static symbols are kept in the resulting wasm file.

* Remove copy&past'ed code in the tests for wasm build tests

* Cleanup some artifacts code, now that we no longer use `wasm-opt`
inside flutter tools
2024-02-16 00:19:38 +00:00
Bartek Pacia c4b0322d57
Android Gradle file templates: make it easier to convert them to Kotlin DSL in the future (#142146)
This PR will make it easier for future Flutter-Android apps/plugins/modules etc. to migrate to Gradle Kotlin DSL.

This PR is similar to #140452 but concerns public Gradle templates instead of Flutter's internal Gradle code. It should be a no-op change.

**before**

![before](https://github.com/flutter/flutter/assets/40357511/5d0cb2bb-a693-43bc-aa10-b8f431e0c68c)

**after**

![after](https://github.com/flutter/flutter/assets/40357511/e4a945a5-866f-42f7-813b-b08b26bb89dc)
2024-02-15 23:42:13 +00:00
Danny Tuppeny 86613d198e
[flutter_tool] [dap] Forward Flutter progress events to DAP client (#142524)
Builds can be slow and the legacy debug adapter would handle Flutter's `app.progress` events to update the toast notification during builds. This was lost in the new adapters - we should only a single "Launching.." notification for the whole progress.

This change listens to `app.progress` events and forwards those with `finished=false` to the client if the launch progress is still active.

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

https://github.com/flutter/flutter/assets/1078012/8c60cf08-e034-4a72-b31e-9c61dca388bf
2024-02-15 22:22:48 +00:00
auto-submit[bot] 86ca31d005
Reverts "Disentangle and align flutter build web --wasm flags (#143517)" (#143547)
Reverts flutter/flutter#143517

Initiated by: dnfield

Reason for reverting: broke CI, see https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20web_benchmarks_skwasm/3446/overview

Original PR Author: mkustermann

Reviewed By: {eyebrowsoffire}

This change reverts the following previous change:
Original Description:
* Make `flutter build web` have one option that determins the optimization level: `-O<level>` / `--optimization-level=<level>` => Defaulting to -O4 => Will apply to both dart2js and dart2wasm

* Deprecate `--dart2js-optimization=O<level>`

* Disentagle concept of optimization from concept of static symbols => Add a `--strip-wasm` / `--no-strip-wasm` flag that determins whether static symbols are kept in the resulting wasm file.

* Remove copy&past'ed code in the tests for wasm build tests

* Cleanup some artifacts code, now that we no longer use `wasm-opt` inside flutter tools
2024-02-15 22:05:18 +00:00
Martin Kustermann 178898e45d
Disentangle and align flutter build web --wasm flags (#143517)
* Make `flutter build web` have one option that determins the
optimization level: `-O<level>` / `--optimization-level=<level>` =>
Defaulting to -O4 => Will apply to both dart2js and dart2wasm

* Deprecate `--dart2js-optimization=O<level>`

* Disentagle concept of optimization from concept of static symbols =>
Add a `--strip-wasm` / `--no-strip-wasm` flag that determins whether
static symbols are kept in the resulting wasm file.

* Remove copy&past'ed code in the tests for wasm build tests

* Cleanup some artifacts code, now that we no longer use `wasm-opt`
inside flutter tools
2024-02-15 21:39:58 +01:00
Hossein Yousefi 97ab92ee35
Modify plugin_ffi and package_ffi template (#143376)
* Use `dart run` instead of `flutter pub run` in the documentation as it is now deprecated.
* Use `int64_t` instead of `intptr_t` for `sum` examples.
2024-02-15 10:37:30 +00:00
Michael Goderbauer 3f09b23338
cleanup now-irrelevant ignores for deprecated_member_use (#143403)
Follow-up to https://github.com/flutter/flutter/pull/143347.
2024-02-14 21:08:25 +00:00
Daco Harkes db83bc6e59
Roll native_assets_builder to 0.5.0 (#143472)
Roll of https://github.com/dart-lang/native/pull/964, which separates the `KernelAsset`s (the asset information embedded in the Dart kernel snapshot) from `Asset`s (the assets in the `build.dart` protocol). See the linked issue for why they ought to be different instead of shared.

This PR does not change any functionality in Flutter.

(Now that https://github.com/flutter/flutter/pull/143055 has landed, we can land breaking changes.)

For reference, the same roll in the Dart SDK: https://dart-review.googlesource.com/c/sdk/+/352642
2024-02-14 20:23:23 +00: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
Anas ca03beda4d
[tools] Add column header for emulators information (#142853)
Add column information as table header for `flutter emulators` command.

**Before:**

```
2 available emulators:

Pixel_3_API_30   • Pixel 3 API 30   • Google • android
Resizable_API_33 • Resizable API 33 • Google • android

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager
```

**After:**

```
2 available emulators:

Id               • Name             • Manufacturer • Platform

Pixel_3_API_30   • Pixel 3 API 30   • Google       • android
Resizable_API_33 • Resizable API 33 • Google       • android

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager
```

fixes #140656
2024-02-14 12:49:24 +00:00
Martin Kustermann abadf9ff8c
Use dart compile wasm for wasm compilations (#143298)
* Flags to `dart compile wasm`

Some options are not relevant to a standalone user of `dart compile
wasm` (e.g. specyfing dart-sdk, platform file etc). => Those aren't
offered by the `dart compile wasm` tool directly. => We use the
`--extra-compiler-option=` instead which passes through arbitrary
options to the dart2wasm compiler. => We don't maintain compatibility of
those options, if we update them we'll ensure to also update flutter
tools

* Binaryen optimization passes

This change will mean we use the binaryen flags from Dart SDK which are
slightly different from the ones in flutter.

* Optimization configuration

This change will also start using the more standardized `-O` flag for
determining optimization levels. The meaning of those flags have been
mostly aligned with dart2js (with some differences remaining).

* Minimization

Using the new optimization flags, namely `-O4` for `--wasm-opt=full`,
will automatically enable the new `--minify` support. Minification is
Dart semantics preserving but changes the `<obj>.runtimeType.toString()`
to use minified names (just as in dart2js).

* Code size changes

  Overall this change will reduce wonderous code size by around 10%.

Issue https://github.com/dart-lang/sdk/issues/54675
2024-02-14 11:15:14 +01:00
Andrew Kolos 14bcc694ff
Fix AssetsEntry::equals (#143355)
In service of https://github.com/flutter/flutter/issues/143348.

**Issue.** The `equals` implementation of `AssetsEntry` is incorrect. It compares `flavors` lists using reference equality. This PR addresses this.

This also adds a test to make sure valid asset `flavors` declarations are parsed correctly.

While we are here, this PR also includes a couple of refactorings:
  * `flutter_manifest_test.dart` is a bit large. To better match our style guide, I've factored out some related tests into their own file.
  *  A couple of changes to the `_validateListType` function in `flutter_manifest.dart`:
      * The function now returns a list of errors instead of accepting a list to append onto. This is more readable and also allows callers to know which errors were found by the call.
      * The function is renamed to `_validateList` and now accepts an `Object?` instead of an `YamlList`. If the argument is null, an appropriate error message is contained in the output. This saves callers that are only interested in validation from having to write their own null-check, which they all did before.
      * Some error strings were tweaked for increased readability and/or grammatical correctness.
2024-02-14 00:11:24 +00:00
Jackson Gardner 5a9fa1e7bf
Dual compile reland (#143262)
This is an attempt at a reland of https://github.com/flutter/flutter/pull/141396

The main changes here that are different than the original PR is fixes to wire up the `flutter test` command properly with the web renderer.
2024-02-13 20:02:10 +00:00
Andrew Kolos e8a75aa088
refactor: remove implicit globals dependencies in writeBundle (#143343)
This is in service of https://github.com/flutter/flutter/pull/141194

This will make it easier to get the `flutter run -d <browser>` and `flutter build fuschia` cases easier to get under test.
2024-02-13 19:38:37 +00:00
Matan Lurey 66367dd888
Remove message about pub cache that is not actionable (#143357)
... and neither the pub nor tools team think it's important.

Fixes https://github.com/flutter/flutter/issues/140628.
2024-02-13 11:15:15 -08:00
Gray Mackall 8ba086a277
[Re-re-land] Enforce a policy on supported Gradle, Java, AGP, and KGP versions (#143341)
This is a direct revert of (the revert of (the reland of (the policy pr))): https://github.com/flutter/flutter/pull/143132. 

The only change is:
1. to put a conditional all on one line, because the packages repository has a test that uses an old flutter project to make sure nothing regresses. The old project uses an old gradle version, and the old gradle version bundles an old groovy version, and the old groovy version has a bug where lines that start with `&&` don't always work: https://issues.apache.org/jira/browse/GROOVY-7218 (I enjoy that the revert reason ends up providing another strong justification to go forward with the policy). Also thanks to @reidbaker for pointing out this bug.
2. I also made a slight formatting change to the messages that print when out of the support bounds, which I think looks slightly better.

I tested this with on a branch that included a revert of https://github.com/flutter/flutter/pull/142008, and was able to recreate the failure and verify that it was resolved by 1).
2024-02-13 15:44:17 +00:00
Reid Baker ace3e58f0a
Revert "[Re-land] Enforce a policy on supported Gradle, Java, AGP, and KGP versions" (#143314)
Reverts flutter/flutter#143132
2024-02-12 18:04:05 +00:00
Polina Cherkasova b48dfca382
Upgrade leak_tracker. (#143236) 2024-02-09 14:41:22 -08:00
Jenn Magder 2fc19619e8
Set plugin template minimum iOS version to 12.0 (#143167)
Fixes https://github.com/flutter/flutter/issues/140474

See https://github.com/flutter/flutter/pull/122625 where this was done 11->12.
2024-02-09 18:32:10 +00:00
Gustl22 2299ec781f
Set default flutter source directory for gradle builds (#142934)
See [#142498](https://github.com/flutter/flutter/pull/142498#discussion_r1478602032)
See this discussion: https://discord.com/channels/608014603317936148/1186378330178601000
2024-02-08 22:28:39 +00:00
Gray Mackall 4b0abc7771
[Re-land] Enforce a policy on supported Gradle, Java, AGP, and KGP versions (#143132)
Re land of https://github.com/flutter/flutter/pull/142000. 
Differences:
1. Fixed the test that was failing in postsubmit. The reason was that the Flutter Gradle Plugin was being applied after KGP in that test, so we couldn't find the KGP version. This caused a log, and the test expects no logs. I moved FGP to after KGP
2. Added to the logs for when we can't find AGP. Change is from
>  "Warning: unable to detect project AGP version. Skipping version checking."

to 
> ~"Warning: unable to detect project AGP version. Skipping version checking. \nThis may be because you have applied the Flutter Gradle Plugin after AGP."~

update: the above is wrong, changed to 
> "Warning: unable to detect project KGP version. Skipping version checking. \nThis may be because you have applied AGP after the Flutter Gradle Plugin."

3. Added a note to the app-level build.gradle templates that FGP must go last
> // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugin.
2024-02-08 22:10:58 +00:00
Jackson Gardner 2efeeb47bc
Revert Dual Web Compile changes (#143175)
Dual Web Compile has had some issues where `flutter test` is not respecting the `--web-renderer` flag for some reason. I haven't gotten entirely to the bottom of the issue, but for now we need to rever these changes while I investigate. This reverts the following PRs:

https://github.com/flutter/flutter/pull/143128
https://github.com/flutter/flutter/pull/141396

While doing this revert, I had a few merge conflicts with https://github.com/flutter/flutter/pull/142760, and I tried to resolve the merge conflicts within the spirit of that PR's change, but @chingjun I might need your input on whether the imports I have modified are okay with regards to the change you were making.
2024-02-08 21:45:09 +00:00
Zachary Anderson fbc9f2d5bf
[flutter_tool] Retry a gradle build on connection timeout (#143084)
This PR will likely not help with the issue on our CI discussed in
https://github.com/flutter/flutter/issues/142637, but will do one retry
for our users if they hit the same issue.
2024-02-08 12:39:00 -08:00
Daco Harkes 4e70bfae2b
Reland "Move native assets to isolated/ directory" (#143055)
Reland of https://github.com/flutter/flutter/pull/142709.

The revert of the revert is in the first commit, the fix in the commit on top.

The move of the fakes for packages/flutter_tools/test/general.shard/resident_runner_test.dart was erroneous before, as it was trying to use setters instead of a private field. This PR changes the private `_devFS` field in the fake to be a public `fakeDevFS` in line with other fakes.

## Original PR description

Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-08 17:49:48 +00:00
Jackson Gardner 71c6cd0cb9
Pass along web renderer into debugging options in the test command. (#143128)
We need to pass along the web renderer in the debugging options to make sure that the resident web runner sets up the targets correctly.
2024-02-08 01:21:07 +00:00
auto-submit[bot] cc4e07954d
Reverts "Improve build output for all platforms" (#143125)
Reverts flutter/flutter#128236

Initiated by: vashworth

Reason for reverting: Causing `Mac_pixel_7pro run_release_test` and `Mac_arm64_android run_release_test` to fail: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_pixel_7pro%20run_release_test/547/overview 
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64_android%20run_release_test/10516/overview

Original PR Author: guidezpl

Reviewed By: {christopherfujino, loic-sharma}

This change reverts the following previous change:
Original Description:
Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-02-07 22:44:19 +00:00
Pierre-Louis 2fceeb0e3c
Improve build output for all platforms (#128236)
Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-02-07 22:22:25 +00:00
auto-submit[bot] d60643e82f
Reverts "Enforce a policy on supported Gradle, Java, AGP, and KGP versions" (#143114)
Reverts flutter/flutter#142000

Initiated by: vashworth

Reason for reverting: Causing `Mac_pixel_7pro run_release_test` and `Mac_arm64_android run_debug_test_android` to fail: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_pixel_7pro%20run_release_test/539/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64_android%20run_debug_test_android/6682/overview

Original PR Author: gmackall

Reviewed By: {reidbaker, camsim99, bartekpacia}

This change reverts the following previous change:
Original Description:
Policy per https://flutter.dev/go/android-dependency-versions.

https://github.com/flutter/flutter/issues/140913

~Still a WIP while I clean up some error handling, remove some prints, and figure out a Java test (more difficult than the others because I believe we can only install one java version per ci shard).~

~Also it looks like there are errors that I need to fix when this checking is applied to a project that uses the old way of applying AGP/KGP using the top-level `build.gradle` file (instead of the new template way of applying them in the `settings.gradle` file).~ Done, this is why [these lines exist](9af6bae6b9/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy (L72-L88)) in `flutter.groovy`. They just needed to be added
2024-02-07 21:22:26 +00:00
Gray Mackall 337bc79b0c
Enforce a policy on supported Gradle, Java, AGP, and KGP versions (#142000)
Policy per https://flutter.dev/go/android-dependency-versions.

https://github.com/flutter/flutter/issues/140913

~Still a WIP while I clean up some error handling, remove some prints, and figure out a Java test (more difficult than the others because I believe we can only install one java version per ci shard).~

~Also it looks like there are errors that I need to fix when this checking is applied to a project that uses the old way of applying AGP/KGP using the top-level `build.gradle` file (instead of the new template way of applying them in the `settings.gradle` file).~ Done, this is why [these lines exist](9af6bae6b9/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy (L72-L88)) in `flutter.groovy`. They just needed to be added
2024-02-07 20:56:07 +00:00
Jackson Gardner 2aef6c570c
Fix inputs and outputs for WebReleaseBundle (#143023)
Since `WebReleaseBundle` is responsible for copying over the outputs from the subtargets, so it needs to be reflected in inputs and outputs so that things will be recopied when something changes.
2024-02-07 20:00:02 +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
Andrew Kolos 34c2080b9d
Remove redundant rootDirectoryPath parameter in DevFS::update (#143034)
Resolves #143041
2024-02-07 18:04:31 +00:00
Jason Simmons db141ecd28
Copy the flutter version JSON file into the simulated Flutter SDK used by update_packages (#143035)
Dart pub now expects that file to be present in a Flutter SDK (see
https://dart.googlesource.com/pub/+/dce232ec195df802a730eb3a66163e28d2ec6444)
2024-02-06 20:00:08 -08: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] ceca606662
Reverts "Move native assets to isolated/ directory" (#143027)
Reverts flutter/flutter#142709

Initiated by: vashworth

Reason for reverting: `Mac tool_tests_general` started failing on this commit: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20tool_tests_general/15552/overview

Original PR Author: dcharkes

Reviewed By: {christopherfujino, chingjun, reidbaker}

This change reverts the following previous change:
Original Description:
Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-07 00:01:18 +00:00
Daco Harkes a069e62e8a
Move native assets to isolated/ directory (#142709)
Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-06 20:59:49 +00:00
Ann Marie Mossman e5a922fed4
Update AGP version validation code to support KGP and kotlin build files. (#142357)
Addresses: https://github.com/flutter/flutter/issues/141410
2024-02-05 21:47:39 +00:00
Alexander Dahlberg f3ee371285
Fixed test in language_version_test.dart that failed when shuffling, … (#142904)
…and removed the no-shuffle tag.

This PR fixes #142376 by fixing the flaky test in language_version_test.dart and removes the no-shuffle tag.
 
## The Problem
The test expected the language version that is set at the top of the test file ('2.13' set in language_version_test.dart – line 14) but defaulted to the language version set in the file it is testing ('2.12' is set in language_version.dart).

This problem was hidden when some other test ran before this test and set up the language version correctly.
 
## The Fix
Make the test itself load the default language version we are testing against.
2024-02-05 20:25:39 +00:00
Bartek Pacia 6facb96953
Reland "Add support for Gradle Kotlin DSL (#140744)" (#142752)
This PR attempts to:
- reland #140744
- reland #141541 (which is also in #142300 - I will close it once this PR is merged)
2024-02-02 20:19:42 +00:00
Lau Ching Jun ac7879e2aa
Avoid depending on files from build_system/targets other than from top level entrypoints in flutter_tools. (#142760)
Add a new `BuildTargets` class that provides commonly used build targets. And avoid importing files from `build_system/targets` except from the top level entrypoints or from top level commands.

Also move `scene_importer.dart` and `shader_compiler.dart` into `build_system/tools` because they are not `Target` classes, but wrapper for certain tools.

With this change, we can ignore all files in `build_system/targets` internally and make PR #142709 easier to land internally. See cl/603434066 for the corresponding internal change.

Related to:
https://github.com/flutter/flutter/pull/142709
https://github.com/flutter/flutter/issues/142041

Also note that I have opted to add a new variable in `globals.dart` for `BuildTargets` in this PR, but I know that we are trying to get rid of globals. Several alternatives that I was considering:

1. Add a new field in `BuildSystem` that returns a `BuildTargets` instance. Since `BuildSystem` is already in `globals`, we can access build targets using `globals.buildSystem.buildTargets` without adding a new global variable.
2. Properly inject the `BuildTargetsImpl` instance from the top level `executable.dart` and top level commands.

Let me know if you want me to do one of the above instead. Thanks!
2024-02-02 18:23:08 +00:00
Jackson Gardner ba626dc83a
Wasm/JS Dual Compile with the flutter tool (#141396)
This implements dual compile via the newly available flutter.js bootstrapping APIs for intelligent build fallback.
* Users can now use the `FlutterLoader.load` API from flutter.js
* Flutter tool injects build info into the `index.html` of the user so that the bootstrapper knows which build variants are available to bootstrap
* The semantics of the `--wasm` flag for `flutter build web` have changed:
  - Instead of producing a separate `build/web_wasm` directory, the output goes to the `build/web` directory like a normal web build
  - Produces a dual build that contains two build variants: dart2wasm+skwasm and dart2js+CanvasKit. The dart2wasm+skwasm will only work on Chrome in a cross-origin isolated context, all other environments will fall back to dart2js+CanvasKit.
  - `--wasm` and `--web-renderer` are now mutually exclusive. Since there are multiple build variants with `--wasm`, the web renderer cannot be expressed via a single command-line flag. For now, we are hard coding what build variants are produced with the `--wasm` flag, but I plan on making this more customizable in the future.
* Build targets now can optionally provide a "build key" which can uniquely identify any specific parameterization of that build target. This way, the build target can invalidate itself by changing its build key. This works a bit better than just stuffing everything into the environment defines because (a) it doesn't invalidate the entire build, just the targets which are affected and (b) settings for multiple build variants don't translate well to the flat map of environment defines.
2024-02-02 01:52:28 +00:00
Victoria Ashworth e5c286e02e
Upload DerivedData logs in CI (#142643)
When the Dart VM is not found within 10 minutes in CI on CoreDevices (iOS 17+), stop the app and upload the logs from DerivedData. The app has to be stopped first since the logs are not put in DerivedData until it's stopped.

Also, rearranged some logic to have CoreDevice have its own function for Dart VM url discovery.

Debugging for https://github.com/flutter/flutter/issues/142448.
2024-02-01 21:31:28 +00:00
Christopher Fujino a80333349a
Unpin test (#141427)
Fixes https://github.com/flutter/flutter/issues/140169
2024-02-01 18:53:23 +00:00
Andrew Kolos 31116770ed
improve error message when --base-href argument does not start with / (#142667)
Resolves https://github.com/flutter/flutter/issues/137700.

In particular, see [this comment from the thread](https://github.com/flutter/flutter/issues/137700#issuecomment-1920241979) to see exactly what this PR is addressing.
2024-02-01 03:23:05 +00:00
Christopher Fujino a1a801a48d
[flutter_tools] add debugging to ios/core_devices.dart (#142187)
Add debugging for #141892 to detect when the temp file mysteriously
disappears after running devicectl.
2024-01-31 15:36:15 -08:00
Dan Field c417c4623c
Refactor ShaderTarget to not explicitly mention impeller or Skia (#141460)
Refactors `ShaderTarget` to make it opaque as to whether it's using Impeller or SkSL and instead has it focus on the target platform it's generating for.

ImpellerC includes SkSL right now whether you ask for it or not. 

The tester target also might need SkSL or Vulkan depending on whether `--enable-impeller` is passed.
2024-01-31 21:30:02 +00:00
LouiseHsu 42317804ee
Show Mac Designed For iPad in 'flutter devices' (#141718)
Addresses https://github.com/flutter/flutter/issues/141290 by allow Mac Designed For IPad Devices to appear with 'flutter devices'.

<img width="573" alt="Screenshot 2024-01-29 at 12 23 24 AM" src="https://github.com/flutter/flutter/assets/36148254/35709a93-56fc-44c9-98d5-cf45afce967d">
<img width="725" alt="Screenshot 2024-01-29 at 12 26 01 AM" src="https://github.com/flutter/flutter/assets/36148254/b6cbcfce-44db-42c6-ac01-0ab716d30373">
2024-01-31 19:34:07 +00:00
Camille Simon 995e3fad7c
Revert "Reland: "Fix how Gradle resolves Android plugin" (#137115)" (#142464)
This reverts commit f5ac225c8d, i.e. https://github.com/flutter/flutter/pull/137115.

This is a continuation of https://github.com/flutter/flutter/pull/142266 that was redone based on feedback to make this easier to revert in the future. The exact steps I took to create this revert:

1. Revert commit noted above
2. Fix merge conflicts, that notably involved reverting some changes in https://github.com/flutter/flutter/pull/140744 ~and https://github.com/flutter/flutter/pull/141417~ (fixed my merge to avoid the second PR from being affected)
3. Delete `packages/flutter_tools/test/integration.shard/android_plugin_skip_unsupported_test.dart` as this was added in the commit noted above

cc @Gustl22 since I couldn't tag as a reviewer
2024-01-29 22:44:24 +00:00
Andrew Kolos 83bdde2bd3
Catch file system exceptions when trying to parse user-provided asset file paths (#142214)
Fixes #141211
2024-01-29 18:43:57 +00:00
Zachary Anderson 6a6874ecf9
Update Android minSdkVersion to 21 (#142267)
This PR increases Android's `minSdkVersion` to 21.

There are two changes in this PR aside from simply increasing the number
from 19 to 21 everywhere.

First, tests using `flutter_gallery` fail without updating the
lockfiles. The changes in the PR are the results of running
`dev/tools/bin/generate_gradle_lockfiles.dart` on that app.

Second, from
[here](https://developer.android.com/build/multidex#mdex-pre-l):
> if your minSdkVersion is 21 or higher, multidex is enabled by default
and you don't need the multidex library.

As a result, the `multidex` option everywhere is obsolete. This PR
removes all logic and tests related to that option that I could find.
`Google testing` and `customer_tests` pass on this PR, so it seems like
this won't be too breaking if it is at all. If needed I'll give this
some time to bake in the framework before landing the flutter/engine
PRs.

Context: https://github.com/flutter/flutter/issues/138117,
https://github.com/flutter/flutter/issues/141277, b/319373605
2024-01-29 09:49:09 -08:00
Zachary Anderson 4601341b50
Add no-shuffle to language_version_test.dart (#142378) 2024-01-27 10:57:39 -08:00
Andrew Kolos 907bbe1bbe
refactor asset bundle code to not depend on the global Cache.flutterRoot (#142277)
Fixes https://github.com/flutter/flutter/issues/142285.

Part of work on https://github.com/flutter/flutter/pull/141194.

This is a refactor. There should be no changes in tool behavior.
2024-01-26 22:01:26 +00:00
Christopher Fujino 97fef98b47
[flutter_tools] remove await runZonedGuarded() in tests (#142336)
For context https://github.com/flutter/flutter/issues/142338
2024-01-26 21:58:03 +00:00
Daco Harkes 8bc0901076
Roll deps from dart-lang/native in templates (#142322)
Update packages from https://github.com/dart-lang/native to the last published stable versions in templates.
2024-01-26 21:42:33 +00:00
Andrew Kolos 69c98bd960
Remove duplicate global declaration of UserMessages (#142281)
Fixes https://github.com/flutter/flutter/issues/142286

This is a refactor. No code behavior changes should be observed.
2024-01-26 21:41:16 +00:00
Jenn Magder 91f0878fed
Move iOS content validation devicelab test into tool integration test (#142272)
The archiving was running in devicelab because certs are needed to codesign (see #73577).  However now the certs are available in chromium bots.  Move the archiving test into the existing tool integration test, and delete the devicelab variant.

arm64:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8757886514651624673/+/u/run_test.dart_for_tool_host_cross_arch_tests_shard_and_subshard_None/test_stdout#L6074_4
x64:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8757886514651624689/+/u/run_test.dart_for_tool_host_cross_arch_tests_shard_and_subshard_None/test_stdout#L6389_2

Part of https://github.com/flutter/flutter/issues/142070
2024-01-26 18:04:09 +00:00
Bartek Pacia 370f40e6df
flutter.groovy: update for Gradle Kotlin DSL compatibility (#142144)
This PR fixes 2 small mistakes in `FlutterExtension`:
- all fields must be `public` in order to be used in Gradle Kotlin DSL the same as in Gradle Groovy DSL
- using `logger` instead of `project.logger` throws an error when executed

This PR re-adds a subset of changes from #141541 which broke the tree and has been reverted.
2024-01-26 09:46:18 +00:00
Pierrick Bouvier 37c3978b34
Enable native compilation for windows-arm64 (#141930)
It's now possible to natively compile a flutter app for windows-arm64. Cross-compilation is not yet implemented.

Uses arm64 artifacts now available for Dart/Flutter. Platform detection is based on Abi class, provided by Dart. Depending if Dart is an arm64 or x64 binary, the Abi is set accordingly. Initial bootstrap of dart artifacts (update_dart_sdk.ps1) is checking PROCESSOR_ARCHITECTURE environment variable, which is the way to detect host architecture on Windows.

This is available only for master channel (on other channels, it fallbacks to windows-x64).

On windows-x64, it produces an x64 app. On windows-arm64, it produces an arm64 app.
2024-01-26 00:08:20 +00:00
Sigurd Meldgaard a0e43d3053
Don't show legacy welcome message when analytics are disabled (#140956)
The legacy welcome message would be printed even if `CI=true` confusing
parsers of the output.

This fixes: https://github.com/flutter/flutter/issues/139737

---------

Co-authored-by: eliasyishak <42216813+eliasyishak@users.noreply.github.com>
2024-01-25 16:29:42 +01:00
Andrew Kolos 295a9a2031
provide command to FakeCommand::onRun (#142206)
Part of work on [#101077](https://github.com/flutter/flutter/pull/141194). This is done as a separate PR to avoid a massive diff.

## Context
1. The `FakeCommand` class accepts a list of patterns that's used to match a command given to its `FakeProcessManager`. Since `FakeCommand` can match a list of patterns, not just specifically strings, it can be used to match commands where the exact value of some arguments can't (easily) known ahead of time. For example, a part of the tool may invoke a command with an argument that is the path of a temporarily file that has a randomly-generated basename.
2. The `FakeCommand` class provides on `onRun` parameter, which is a callback that is run when the `FakeProcessManager` runs a command that matches the `FakeCommand` in question.

## Issue
In the event that a `FakeCommand` is constructed using patterns, the test code can't know the exact values used for arguments in the command. This PR proposes changing the type of `onRun` from `VoidCallback?` to `void Function(List<String>)?`. When run, the value `List<String>` parameter will be the full command that the `FakeCommand` matched.

Example:
```dart
FakeCommand(
  command: <Pattern>[
    artifacts.getArtifactPath(Artifact.engineDartBinary),
    'run',
    'vector_graphics_compiler',
    RegExp(r'--input=/.*\.temp'),
    RegExp(r'--output=/.*\.temp'),
  ],
  onRun: (List<String> command) {
    final outputPath = (() { 
      // code to parse `--output` from `command`
    })();
    testFileSystem.file(outputPath).createSync(recursive: true);
  },
)
```
2024-01-25 07:51:25 +00:00
David Iglesias 703e12f524
[ci] Adds test for web hot restart with const App. (#141824)
This PR adds a test that reproduces the problem described in the linked issue: hot restart on the web seems to not update if the app being run is `const`.

The new test is expected to fail, until the `const` issue with hot restart in the web is resolved.

Expected failure mode is a 15s timeout in the following test:

```
02:31 +3 ~1 -1: Hot reload (index.html: Default) (with `const MyApp()`)): newly added code executes during hot restart [E]
  TimeoutException after 0:00:15.000000: Future not completed
  dart:async  _startMicrotaskLoop
  ...
```

(And then a bunch of output that I'm not 100% sure is intended :))

## Issues

* #141588
2024-01-25 01:49:08 +00:00
Polina Cherkasova a522b38e96
Upgrade leak_tracker. (#142162) 2024-01-24 15:33:17 -08:00
Jo Jaeyong 23385468a8
Support wireless debugging for iOS 12 or earlier (#141439)
`idevicesyslog` requires the `--network` flag to obtain logs for iOS devices when wirelessly paired. 

When running Flutter on devices with iOS 12 or earlier versions, [the `idevicesyslog` command is used.](5931b4f21d/packages/flutter_tools/lib/src/ios/devices.dart (L1269-L1277)).

Related Issue: #15072
Related PRs: #118104, #118895, #60623
2024-01-24 22:14:08 +00:00
Jackson Gardner a668aa7f99
Revert "Add abifilters to our gradle templates" (#142089)
Reverts flutter/flutter#135529

This had some failures in postsubmit:

https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20gradle_plugin_light_apk_test/17054/overview
and 

https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20gradle_plugin_fat_apk_test/17262/overview

We should revert and then investigate.
2024-01-23 19:05:20 -08:00
Gray Mackall 512335230c
Add abifilters to our gradle templates (#135529)
Fixes https://github.com/flutter/flutter/issues/135173, and could also be interpreted as fixing https://github.com/flutter/flutter/issues/83596 based on @chinmaygarde 's comment.
2024-01-23 23:19:23 +00:00
Andrew Kolos cbe0ceafe2
consolidate AssetBundle::entries and AssetBundle::entryKinds into a new type, AssetBundleEntry (#142029)
Part of work on https://github.com/flutter/flutter/pull/141194

The [`AssetBundle`](0833929c99/packages/flutter_tools/lib/src/asset.dart (L80)) class contains two members, `entries` and `entryKinds`. `entries` contains asset data indexed by asset key. `entryKinds` contains the "kinds" of these assets, again indexed by asset key.

**Change.** Rather than have two separate maps, this PR proposes combining these maps into one by wrapping the asset data and kind into a single data type `AssetBundleEntry`.

**Purpose.** In https://github.com/flutter/flutter/pull/141194, I am considering associating more information with an asset. In particular, what transformers are meant to be applied to it when copying it to the build output. Rather than adding another map member onto `AssetBundle` (e.g. `entryTransformers`), I decided to make things neater by introducing the `AssetBundleEntry` type.
2024-01-23 22:00:46 +00:00
Christopher Fujino 1cee81c40a
[flutter_tools] fix language_version_test and enable shuffle (#142009)
Part of https://github.com/flutter/flutter/issues/85160
2024-01-23 20:31:53 +00:00
Lau Ching Jun f52eaaea08
Allow overriding the native assets yaml file in the resident runner. (#142016)
This is used when the native assets are built by a separate build system.

Context: b/286799303
2024-01-23 19:49:10 +00:00
auto-submit[bot] b258ca011e
Reverts "hello_world app: migrate to Gradle Kotlin DSL" (#142018)
Reverts flutter/flutter#141541
Initiated by: yusuf-goog
This change reverts the following previous change:
Original Description:
This PR introduces the first app in this repo that fully uses Gradle Kotlin DSL.

It also fixes a bug I found in the process – fields of `FlutterExtensions` must be `public`.
2024-01-23 00:01:17 +00:00
Gustl22 a98e43a871
refactor: Rename filterPluginsByPlatform, cleanup Platform Strings (#141780)
Part of #137040 and #80374

- Rename _filterPluginsByPlatform to _createPluginMapOfPlatform
- Move method in chronological order
- Cleanup platform strings
2024-01-22 21:54:06 +00:00
Bartek Pacia e593cdfb80
hello_world app: migrate to Gradle Kotlin DSL (#141541)
This PR introduces the first app in this repo that fully uses Gradle Kotlin DSL.

It also fixes a bug I found in the process – fields of `FlutterExtensions` must be `public`.
2024-01-22 21:47:20 +00:00
Matan Lurey 3b1e96e074
Remove duplicate code as suggested by natebosch. (#141988)
See https://github.com/flutter/flutter/pull/141821/files#r1462288131.
2024-01-22 13:08:36 -08:00
Matan Lurey 0b2269447f
Do not hang on test failures of tests within flutter_tools (#141821)
Fixes https://github.com/flutter/flutter/issues/141823

Before this change, when a test would fail, the terminal would hang (by default for 30s) until killed by the test runner.

Basically, [`runZonedGuarded`](https://api.flutter.dev/flutter/dart-async/runZonedGuarded.html) _does_ document (though not clearly) that a returned future should not be awaited:

```txt
The zone will always be an error-zone ([Zone.errorZone](https://api.flutter.dev/flutter/dart-async/Zone/errorZone.html)), so returning a future created inside the zone, and waiting for it outside of the zone, will risk the future not being seen to complete.
```

For example, you can see other places in Dart and Flutter that we circumvent that problem:

- 5987563e4a/packages/flutter_tools/test/general.shard/base/async_guard_test.dart (L279-L306)
- b04c9c127f/lib/src/dartdoc.dart (L258-L264)
- d1afda52d2/lib/web_ui/dev/browser_process.dart (L20-L22)

I'm open to suggestions on how to test this :)

/cc @natebosch @jakemac53 @lrhn if you have any color commentary for us.
2024-01-22 19:49:59 +00:00
Daco Harkes 634b326efc
Reapply "Native assets: roll deps" (#141748) (#141864)
Fixes https://github.com/flutter/flutter/issues/141827

Reland: https://dart-review.googlesource.com/c/sdk/+/346960 has rolled into g3, so the imports should now resolve in g3 as well.

> [!CAUTION]
> _Do NOT merge if "Google Testing" bot didn't run!_

Rolls the packages from https://github.com/dart-lang/native in the native assets implementation.

Most notable we're refactoring `package:native_assets_cli` for `build.dart` use.
Therefore, all imports to that package for Flutter/Dart should be to the implementation internals that are no longer visible for `build.dart` writers. Hence all the import updates.

No behavior in Flutter apps should change.

This PR also updates the template to use the latests version of `package:native_assets_cli` which no longer exposes all the implementation details.
2024-01-22 10:42:15 +00:00
Christopher Fujino 92094802fe
[flutter_tools] update analyze_once_test.dart to be null-safe (#141790)
Fixes https://github.com/flutter/flutter/issues/141743

I should have made this change in https://github.com/flutter/flutter/pull/124039, but it escaped my grep search.
2024-01-21 07:54:05 +00:00
林洵锋 f340d207f6
Adjust the position of require File.expand_path (#141521)
On `Podfile`:

```ruby
flutter_application_path = '../flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'OCProject' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for OCProject
  # install_all_flutter_pods(flutter_application_path)
  # install_flutter_engine_pod(flutter_application_path)
  # install_flutter_application_pod(flutter_application_path)
  install_flutter_plugin_pods(flutter_application_path)

end

post_install do |installer|
  flutter_post_install(installer)
end
```
Encountering the following error after executing `pod install`:

```shell
pod install

[!] Invalid `Podfile` file: undefined method `flutter_relative_path_from_podfile' for #<Pod::Podfile:0x000000010e74c520 @defined_in_file=#<Pathname:/Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile>, @internal_hash={}, @root_target_definitions=[#<Pod::Podfile::TargetDefinition label=Pods>], @current_target_definition=#<Pod::Podfile::TargetDefinition label=Pods>>

  relative = flutter_relative_path_from_podfile(export_script_directory)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.

 #  from /Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile:17
 #  -------------------------------------------
 #    # install_flutter_plugin_pods(flutter_application_path)
 >    install_flutter_application_pod(flutter_application_path)
 #
 #  -------------------------------------------
```

The `flutter_relative_path_from_podfile` method is in `flutter_tools/bin/podhelper.rb`, but now `flutter_tools/bin/podhelper.rb` is only required in `install_all_flutter_pods` in `podhelper.rb.tmpl`.

Sometimes we only need to use the `install_flutter_plugin_pods` method in podhelper.rb. For example, using `Shorebird` in an iOS hybird app scenario, we need to build `Flutter.xcframework` and `App.xcframework` and embed them into the iOS native project. In order to avoid unnecessary conflicts, use `install_flutter_plugin_pods` method to install Flutter plugin pods.

[Shorebird - Code Push In Hybrid Apps](https://docs.shorebird.dev/guides/hybrid-app/ios)

So I adjust the position of `require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)`.
2024-01-21 06:18:26 +00:00
Reid Baker 684247a3c7
Use Integer instead of int in map in flutter.groovy (#141895)
packages Roller breakage 
https://ci.chromium.org/ui/p/flutter/builders/try/Linux_android%20android_build_all_packages%20master/5504/overview
Fixes flutter/flutter/issues/141897
```
FAILURE: Build failed with an exception.

* Where:
Script '/b/s/w/ir/x/w/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy' line: 168

* What went wrong:
Could not compile script '/b/s/w/ir/x/w/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy'.
> startup failed:
  script '/b/s/w/ir/x/w/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy': 168: primitive type parameters not allowed here;
     solution: use the corresponding wrapper type, such as Integer for int @ line 168, column 41.
     e static final Map<String, int> ABI_VERS
```

Covered by tests in packages.
2024-01-19 20:57:08 +00:00
Daco Harkes 2e229be2ff
Native assets: package in framework on iOS and MacOS (#140907)
Packages the native assets for iOS and MacOS in frameworks.

Issue:

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

## Details

* [x] This packages dylibs from the native assets feature in frameworks. It packages every dylib in a separate framework.
* [x] The dylib name is updated to use `@rpath` instead of `@executable_path`.
* [x] The dylibs for flutter-tester are no longer modified to change the install name. (Previously it was wrongly updating the install name to the location the dylib would have once deployed in an app.)
* [x] Use symlinking on MacOS.
2024-01-19 20:29:13 +00:00
Ian Hickson 77c3807c80
Revert "Make tests more resilient to Skia gold failures and refactor flutter_goldens for extensive technical debt removal (#140101)" (#141814)
Reverts https://github.com/flutter/flutter/pull/140101

That PR somehow made non-matching gold tests not fail at HEAD.

Fixes https://github.com/flutter/flutter/issues/141880
- Blocked by https://github.com/flutter/flutter/issues/140169
  - https://github.com/flutter/flutter/pull/141427
2024-01-19 20:29:11 +00:00
Zachary Anderson d4707d12d5
Roll engine to 9a6c64de8a4694cef59a338cd33ac1a9e7d23d9d (#141870)
Includes the Engine roll from
https://github.com/flutter/flutter/pull/141841

A new version of Dart is having trouble with the tool integration test
test `passing one file with errors are detected`:
https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20tool_integration_tests_2_4/31851/overview.

However the analysis server emits the expected errors when we give it
both the file without issues and the file with issues.

My guess is that the analysis server has changed it's behavior slightly
when supplied with a single malformed file.

Since the Dart roll is >20 dev versions behind, and this is the only
failing presubmit test, and it's testing something a bit weird, I
suggest we investigate the right way to test the thing that test was
attempting to cover as a follow-up.
2024-01-19 09:38:01 -08:00
auto-submit[bot] 1901d6fa10
Reverts "Enable native compilation for windows-arm64 " (#141809)
Reverts flutter/flutter#137618
Initiated by: Jasguerrero
This change reverts the following previous change:
Original Description:
It's now possible to natively compile a flutter app for
windows-arm64. Cross-compilation is not yet implemented.

Uses arm64 artifacts now available for Dart/Flutter.
Platform detection is based on Abi class, provided by Dart. Depending if
Dart is an arm64 or x64 binary, the Abi is set accordingly.
Initial bootstrap of dart artifacts (update_dart_sdk.ps1) is checking
PROCESSOR_ARCHITECTURE environment variable, which is the way to detect
host architecture on Windows.

This is available only for master channel (on other channels, it
fallbacks to windows-x64).

On windows-x64, it produces an x64 app. On windows-arm64, it produces an
arm64 app.
2024-01-18 22:48:16 +00:00
Pierrick Bouvier 540559204e
Enable native compilation for windows-arm64 (#137618)
It's now possible to natively compile a flutter app for
windows-arm64. Cross-compilation is not yet implemented.

Uses arm64 artifacts now available for Dart/Flutter.
Platform detection is based on Abi class, provided by Dart. Depending if
Dart is an arm64 or x64 binary, the Abi is set accordingly.
Initial bootstrap of dart artifacts (update_dart_sdk.ps1) is checking
PROCESSOR_ARCHITECTURE environment variable, which is the way to detect
host architecture on Windows.

This is available only for master channel (on other channels, it
fallbacks to windows-x64).

On windows-x64, it produces an x64 app. On windows-arm64, it produces an
arm64 app.
2024-01-18 19:15:23 +00:00
Jesús S Guerrero 1997bec685
Revert "Native assets: roll deps" (#141748)
b/320767653

Reverts flutter/flutter#141684
2024-01-18 18:13:21 +00:00
yaakovschectman 3123d98132
Add check for Bank of Brazil security module to Windows Flutter Doctor validators (#141135)
Add a warning to Flutter Doctor if Topaz OFD is found as a process on
the system.
The protection module used by the Bank of Brazil has been identified as
causing build failures when using VS with CMake for Windows (see
https://github.com/flutter/flutter/issues/121366#issuecomment-1845703728).
Disabling the software allows the build to succeed again.

If a running process is found by `flutter doctor` whose path contains
`Topaz OFD\Warsaw\core.exe`, a warning message is generated to convey
this.

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

## 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].
- [ ] 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] 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

---------

Co-authored-by: Elias Yishak <42216813+eliasyishak@users.noreply.github.com>
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
2024-01-18 12:32:49 -05:00
Reid Baker c479109e75
Fix gradle lints No semantic change should be present. (#141692)
Move static methods together.
Fix property uses of duplicate strings.
Add types wherever obvious
Fix format depth
Add whitespace to top and bottom of classes
Ignore line length for file
Ignore prefer single quote for file
Ignore correction for getFoo used instead of foo

Loosely related to flutter/flutter/issues/123934
2024-01-18 16:33:10 +00:00
Andrew Kolos 0833929c99
Catch UnsupportedError thrown when user provides an asset directory path containing invalid characters (#141214)
Fixes https://github.com/flutter/flutter/issues/140092
2024-01-18 08:35:59 +00:00
Andrew Kolos 5757500931
Make test file systems/platforms used in asset_bundle_test.dart less dependent on the host platform (#141657)
Part of work on https://github.com/flutter/flutter/pull/141214. See [this discussion](https://github.com/flutter/flutter/pull/141214#discussion_r1446727495) for the inspiration for this PR.

## Issue
Many tests in [packages/flutter_tools/test/general.shard/asset_bundle_test.dart](4cd0a3252d/packages/flutter_tools/test/general.shard/asset_bundle_test.dart) aren't hermetic. When setting up fake `FileSystem` and `Platform` objects, the host OS is referenced:

f2745e97d5/packages/flutter_tools/test/general.shard/asset_bundle_test.dart (L35-L40)

f2745e97d5/packages/flutter_tools/test/general.shard/asset_bundle_test.dart (L43)

To improve hermeticity here, we could instead run each once _per_ valid combination of file system style and platform. However, it is unclear if these tests even depend on the file system style (integration tests should catch most cases where this might matter). As a result, I think it's sufficient to improve hermeticity by always assuming a Linux environment, which is generally our default (as `MemoryFileSystem` does, and most of our fakes of `Platform` do by default).

In general, if a test needs to run other kinds of environments, it should make this clear, ideally through the test name.
2024-01-17 21:23:01 +00:00
Daco Harkes f5442bf937
Native assets: roll deps (#141684)
Rolls the packages from https://github.com/dart-lang/native in the native assets implementation.

Most notable we're refactoring `package:native_assets_cli` for `build.dart` use.
Therefore, all imports to that package for Flutter/Dart should be to the implementation internals that are no longer visible for `build.dart` writers. Hence all the import updates.

No behavior in Flutter apps should change.

This PR also updates the template to use the latests version of `package:native_assets_cli` which no longer exposes all the implementation details.
2024-01-17 21:20:36 +00:00
Greg Spencer 4e3be0bf8e
Fix the --empty flag to not try working with non-app templates (#141632)
## Description

This adds a check to make sure that the `--empty` flag isn't applied to non-app templates.

## Related Issues
 - Fixes https://github.com/flutter/flutter/issues/141592

## Tests
 - Added a test.
2024-01-17 16:51:03 +00:00
Christopher Fujino 4cd0a3252d
[flutter_tools] Fix analyze size on arm64 (#141317)
Fixes https://github.com/flutter/flutter/issues/140659
2024-01-17 00:15:28 +00:00
Anis Alibegić e063f56832
Fixed few typos (#141543)
I continued [my mission](https://github.com/flutter/flutter/pull/141431) to find as many typos as I could. This time it's a smaller set than before.

There is no need for issues since it's a typo fix.
2024-01-16 21:40:08 +00:00
Reid Baker 2b890af939
handle rc versions of gradle in version compare (#141612)
- handle number format exceptions and strip rc information from version compare
- add test that handles rc format

part 2/n https://github.com/flutter/flutter/issues/138523

Helpfully pointed out by [asaarnak](https://github.com/asaarnak) https://github.com/flutter/flutter/pull/139325#issuecomment-1892554584
2024-01-16 19:29:26 +00:00
Bartek Pacia 2442603cfc
Delete redundant settings.ext.flutterSdkPath (#141509)
This line is a leftover. Removing it is a no-op.
2024-01-16 19:19:24 +00:00
Bartek Pacia 1e5acbcb55
Reference GitHub issue in TODO comment (#141582)
[Source](https://github.com/flutter/flutter/pull/133598#discussion_r1446033128)

For future readers.
2024-01-16 18:56:19 +00:00
Bartek Pacia e1d6f7e822
migrate {min,target,compile}SdkVersion to {min,target,compile}Sdk (#141537)
Inspired by #137621.
2024-01-16 18:39:12 +00: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
Spt 3d112429cc
Solve the problem that <Flutter/Flutter.h> cannot be imported when a pod transitive depends on Flutter (#125610)
![image](https://user-images.githubusercontent.com/8318578/234780282-89b18d27-df49-4b4e-88b5-c9d17cf3334f.png)
![image](https://user-images.githubusercontent.com/8318578/234780668-901ab816-5b6b-4d87-a6f4-120b5852580c.png)
If a pod transitive depends on a pod containing a framework, cocoapods will add the path of the framework to its FRAMEWORK_SEARCH_PATHS.
So I modified the relevant logic in podhelper, hoping to be consistent with the behavior of cocoapods.

Fixes https://github.com/flutter/flutter/issues/126251.
2024-01-16 15:36:38 +00:00
OutdatedGuy a8cb8af857
Added newline at end of .gitignore files (#141270)
Added missing required newline at end of some `.gitignore` files. All other `.gitignore` files ends with a newline except the changed ones, hence the PR.

> *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.*

**Not listing any issues because of trivial fixes as mentioned above.**
2024-01-12 23:22:11 +00:00
Anis Alibegić 81d80c587d
Fixed a lot of typos (#141431)
Fair amount of typos spotted and fixed. Some of them are in comments, some of them are in code and some of them are in nondart files.

There is no need for issues since it's a typo fix.

I have doubts about [packages/flutter_tools/lib/src/ios/core_devices.dart](https://github.com/flutter/flutter/compare/master...anisalibegic:flutter:master#diff-fdbc1496b4bbe7e2b445a567fd385677af861c0093774e3d8cc460fdd5b794fa), I have a feeling it might broke some things on the other end, even though it's a typo.
2024-01-12 22:10:25 +00:00
Christopher Fujino 9e9af67b9a
unpin web_socket_channel and roll pub packages (#141424)
Fixes https://github.com/flutter/flutter/issues/141032

We pinned to web_socket_channel v2.4.1 because v2.4.2 was retracted, however v2.4.3 is now available.
2024-01-12 19:13:08 +00:00
Bartek Pacia dbf5f04b86
FlutterExtension: make fields non-static (#141463)
There's no issue for this PR. I can create one if requested.

## Summary

This PR makes public fields of `FlutterExtension` non-static. The aim is to make migrating from Gradle Groovy DSL to Gradle Kotlin DSL easier for Flutter developers, because...

### Without this PR

**android/app/build.gradle.kts**

```kotlin
plugins {
    id "com.android.application"
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "io.flutter.examples.hello_world"
    compileSdk = FlutterExtension.compileSdkVersion

    defaultConfig {
        applicationId = "io.flutter.examples.hello_world"
        minSdk = FlutterExtension.minSdkVersion
        targetSdk = FlutterExtension.targetSdkVersion
        // ...
    }
}
// ...
```

Groovy and Java allow accessing static fields of a class through its instance, but Kotlin is being more "correct" and disallows that.

### With this PR

Thanks to this PR, the user won't have to replace `flutter` with FlutterExtension in some places, thus decreasing possible confusion.

```kotlin
plugins {
    id "com.android.application"
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "io.flutter.examples.hello_world"
    compileSdk = flutter.compileSdkVersion

    defaultConfig {
        applicationId = "io.flutter.examples.hello_world"
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        // ...
    }
}
// ...
```
2024-01-12 18:49:21 +00:00
hangyu 4b914bd17c
[deep link] Update a gradle task to add flag check and intent filter check to the AppLinkSettings (#141231)
These check result is used in devtool deep link validation
issue: https://github.com/flutter/flutter/issues/120408

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] 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
2024-01-12 10:36:26 -08:00
Bartek Pacia fd827e3a88
Expose versionCode and versionName from local.properties in FlutterExtension (#141417)
This PR has no issue. I got this cool idea and decided to quickly try it out, and it works.

### Summary

This will allow Flutter Developers to have less code in their Android Gradle buildscripts.

```diff
 plugins {
     id "com.android.application"
     id "dev.flutter.flutter-gradle-plugin"
     id "kotlin-android"
 }

-def localProperties = new Properties()
-def localPropertiesFile = rootProject.file("local.properties")
-if (localPropertiesFile.exists()) {
-    localPropertiesFile.withReader("UTF-8") { reader ->
-        localProperties.load(reader)
-    }
-}
-
-def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
-if (flutterVersionCode == null) {
-    flutterVersionCode = "1"
-}
-
-def flutterVersionName = localProperties.getProperty("flutter.versionName")
-if (flutterVersionName == null) {
-    flutterVersionName = "1.0"
-}
-
-def keystorePropertiesFile = rootProject.file("keystore.properties")
-def keystoreProperties = new Properties()
-
 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

 android {
         applicationId "pl.baftek.discoverrudy"
         minSdk 21
         targetSdk 34
-        versionCode flutterVersionCode.toInteger()
-        versionName flutterVersionName
+        versionCode flutter.versionCode()
+        versionName flutter.versionName()
     }
```

The boilerplate that loads 'local.properties' can live in Flutter Gradle Plugin.

### Concerns

I was worried about lifecycle/ordering issues, so I tested it.

To Flutter Gradle Plugin, I added:

```diff
 class FlutterPlugin implements Plugin<Project> {
     //...

     @Override
     void apply(Project project) {
+        project.logger.quiet("Start applying FGP")
         // ...
     }
 }
```

and to my `android/app/build.gradle` I added:

```diff
 android {
+    logger.quiet("Start evaluating android block")
     namespace "pl.bartekpacia.awesomeapp"
     compileSdk 34
 
     defaultConfig {
         applicationId "pl.baftek.discoverrudy"
         minSdk 21
         targetSdk 34
         versionCode flutter.versionCode()
         versionName flutter.versionName()
     }
```

Gradle first applies the plugins (which sets versionCode and versionName on FlutterExtension), and then it executes the `android {}` extension block:

```
$ ./gradlew :app:assembleDebug

> Configure project :app
Start applying FGP
Start evaluating android block

BUILD SUCCESSFUL in 2s
383 actionable tasks: 10 executed, 373 up-to-date
```

So ordering is fine.
2024-01-12 18:18:32 +00:00
Jonah Williams f2745e97d5
When Impeller is enabled for flutter tester choose correct shader target. (#141391)
When compiling shaders for flutter tester, include Vulkan shaders when targeting Impeller.
2024-01-12 17:49:54 +00:00
Bartek Pacia 0a1af8a192
Add support for Gradle Kotlin DSL (#140744)
This PR resolves #140548. It's based on my work in #118067.
2024-01-12 02:20:06 +00:00
Andrew Kolos c355219154
make asset_test.dart tests not dependent on context (#141331)
Part of work on https://github.com/flutter/flutter/issues/141330, which is a part of work on https://github.com/flutter/flutter/issues/140092

This is a refactoring; there should be no behavioral changes in these tests.
2024-01-11 18:08:07 +00:00
Jonah Williams 35903620c8
Add impeller key to skia gold client, Turn on a framework test shard that will run unit tests with --enable-impeller (#141341)
Redo of https://github.com/flutter/flutter/pull/140985 due to CLA issues.
2024-01-11 17:57:00 +00:00
Dan Field 9f2e681e7b
[Tool][Impeller] Make impellerc produce Vulkan and GLES shaders for Android. (#140976)
This should wait for some upstream work, just don't want to lose it locally for now. I'll switch this from draft and update the description when it's ready.
2024-01-11 17:49:59 +00:00
Christopher Fujino 0f5cd7855d
[flutter_tools] fix flutter create -t skeleton (#141233)
Fixes https://github.com/flutter/flutter/issues/139138

This had been broken since https://github.com/flutter/flutter/pull/130090 merged, however, the test happened run with flutter_tools/pubspec.yaml in the current working directory.
2024-01-10 18:50:07 +00:00
Derek Xu eff2e7dbb1
Unpin package:vm_service (#141279) 2024-01-10 12:47:25 -05:00
stuartmorgan 32fd2cbf73
Replace deprecated exists in podhelper.rb (#141169)
The recently landed https://github.com/flutter/flutter/pull/140222 accidentally used the deprecated `exists?` instead of the non-deprecated `exist?` (which other code in this file is already, correctly, using).

Fixes https://github.com/flutter/flutter/issues/141167
2024-01-09 22:25:57 +00:00
Polina Cherkasova 1f3103e50d
Upgrade leak_tracker. (#141153) 2024-01-09 12:02:35 -08:00
Daco Harkes b2ef2802d2
Native assets support for Android Add2app (#140802)
Support for FFI calls with @Native external functions through Native assets on Android add to app. This enables bundling native code without any build-system boilerplate code.

For more info see:

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

## Implementation details for Android add2app

The `.so` files are bundled with the same mechanism that bundles `libapp.so`.
2024-01-09 08:47:53 +00:00
Christopher Fujino 6edbce9e07
Manual pub roll pinning web socket channel (#141040)
Work around https://github.com/flutter/flutter/issues/141032

Otherwise a re-land of https://github.com/flutter/flutter/pull/140979

Fixes https://github.com/flutter/flutter/issues/137163 & https://github.com/flutter/flutter/issues/139181
2024-01-05 22:29:58 +00:00
Andrew Kolos e90e4888b8
in flutter run, throw tool exit when --flavor is provided but is not supported on the target device (#139045)
Fixes https://github.com/flutter/flutter/issues/134197
2024-01-05 21:47:58 +00:00
Andrew Kolos 8c11aa030d
add flavor-conditional asset bundling support to flutter test (#140944)
Fixes https://github.com/flutter/flutter/issues/140932
2024-01-05 21:47:55 +00:00
TabooSun e8436970e6
Gen l10n add named argument option (#138663)
Add an option to use named argument for generated method.

Fix #116308
2024-01-05 21:28:08 +00:00
auto-submit[bot] c2286a7642
Reverts "manual pub roll to pick up dds fixes" (#141033)
Reverts flutter/flutter#140979
Initiated by: loic-sharma
This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/137163
Fixes https://github.com/flutter/flutter/issues/139181
2024-01-05 19:10:19 +00:00
Danny Tuppeny 2d3166b7f9
Pin package:vm_service (#140972)
vm_service 14 should not be used yet (see
https://github.com/flutter/flutter/pull/140916#issuecomment-1877383354)
but when trying to unpin pkg:test it was upgraded. This pins it to
v13.0.0.
2024-01-04 21:10:44 +00:00
Christopher Fujino e256d49117
manual pub roll to pick up dds fixes (#140979)
Fixes https://github.com/flutter/flutter/issues/137163
Fixes https://github.com/flutter/flutter/issues/139181
2024-01-04 19:43:06 +00:00
stuartmorgan 24e06232a7
Fix local engine use in macOS plugins (#140222)
Currently podhelper.rb will always point plugin builds at the cached engine artifacts, even when using `--local-engine`. In most cases this is fine, since when the final build actually runs it will be using the engine bundled into the app build, which will be the correct local engine build. When trying to test a local engine build with API additions against a local plugin modified to use those additions to ensure that they are working as expected, however, compilation will fail, because the new APIs won't be present in the plugin build.

This fixes that for macOS, and adds a TODO for iOS (which is more complicated to fix due to the host vs target build distinction).

macOS portion of https://github.com/flutter/flutter/issues/132228
2024-01-04 15:40:08 +00:00
Jenn Magder 5d4f5f77b8
Remove deprecated bitcode stripping from tooling (#140903)
Bitcode has been removed https://github.com/flutter/flutter/issues/107887, clean up the leftover commands.
2024-01-03 23:15:23 +00: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
Jonah Williams 0d378ed5ab
[flutter_tools] add support for --enable-impeller to test device. (#140899)
This allows unit tests to use the impeller backend, which can be useful for Scubas/golden tests.
2024-01-03 19:14:49 +00:00
Elliott Brooks 55ba27d3bc
Link to wiki page about updating dependencies in each pubspec.yaml file (#140826)
Added a minimal wiki page about how to use the `update-packages` tool: https://github.com/flutter/flutter/wiki/Updating-dependencies-in-Flutter

This PR adds a link to that wiki page at the top of each pubspec.yaml file
2024-01-03 18:28:52 +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
Andrew Kolos 3ac2dba58d
Fix setup race in asset bundle tests (#140832)
Fixes https://github.com/flutter/flutter/issues/140665 by replacing use of `setUpAll` and `teardownAll` with `setUp` and `teardown` respectively.

My theory has to how this issue happened (and how this PR fixes it) is that `setUpAll` is not guaranteed to run after any `setUp` in any parent test groups. However, `setUp` is guaranteed to run after any set-up callbacks in parent groups. From the [documentation](https://api.flutter.dev/flutter/flutter_test/setUp.html): 

> If this is called within a test group, it applies only to tests in that group. The body will be run after any set-up callbacks in parent groups or at the top level.

Meanwhile, [`setUpAll`](https://api.flutter.dev/flutter/flutter_test/setUpAll.html) has a weaker documented guarantee that applies only to other `setUpAll` calls:

> If this is called within a test group, The body will run before all tests in that group. It will be run after any [setUpAll](https://api.flutter.dev/flutter/flutter_test/setUpAll.html) callbacks in parent groups or at the top level. It won't be run if none of the tests in the group are run.
2024-01-03 00:15:51 +00:00
Polina Cherkasova 45c611f040
Upgrade leak_tracker. (#140758) 2024-01-02 20:58:16 +00:00