Commit graph

8974 commits

Author SHA1 Message Date
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
auto-submit[bot] bd634f3298
Reverts "Set template and migrate apps to iOS 12 minimum" (#140822)
Reverts flutter/flutter#140478
Initiated by: loic-sharma
This change reverts the following previous change:
Original Description:
1. Change templates to `IPHONEOS_DEPLOYMENT_TARGET`, `MinimumOSVersion`, and Podfile `platform :ios` to 12.0.
2. Add migrator for Podfile part to migrate `platform :ios, '11.0'` -> `platform :ios, '12.0'`
3. Compile with `-miphoneos-version-min=12.0`
4. Run the migrator on all example apps and integration tests.

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

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

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

Fixes https://github.com/flutter/flutter/issues/136060
2024-01-02 19:42:13 +00:00
Dan Field bfdc32fcd0
Revert "[Impeller] Plumb through the impeller-force-gl flag." (#140535)
Reverts flutter/flutter#123828

Fixes https://github.com/flutter/flutter/issues/140523
2024-01-02 18:28:04 +00:00
Zachary Anderson ddb8d1f670
Makes the flutter tool retry on a bad gateway network error from gradle (#140670)
Seen in https://github.com/flutter/flutter/issues/140643
2023-12-27 20:13:36 +00:00
Zachary Anderson 6664dfec2f
Disable random test order in asset_bundle_test.dart (#140666)
For https://github.com/flutter/flutter/issues/140665
2023-12-27 18:06:31 +00:00
Reid Baker 48ae5ff6f6
Use double quotes over single quotes in gradle build files (#140512)
Following https://developer.android.com/build/migrate-to-kotlin-dsl
2/n Use double quotes instead of single quotes. 

Should be a no-op change. If you see a behavioral change please flag it.
2023-12-22 16:25:06 +00:00
Andrew Kolos 9e104eb7c8
Fix flavor conditional asset bundling for macos (#140433)
Fixes https://github.com/flutter/flutter/issues/140430
Fixes https://github.com/flutter/flutter/issues/140432 while we are at it
2023-12-21 20:30:21 +00:00
Christopher Fujino 674fbd26bc
[flutter_tools] Ensure flutter daemon clients can detect preview device (#140112)
Part of https://github.com/flutter/flutter/issues/130277
2023-12-21 19:01:16 +00:00
Gustl22 f5ac225c8d
Reland: "Fix how Gradle resolves Android plugin" (#137115)
Relands #97823

When the tool migrated to `.flutter-plugins-dependencies`, the Gradle plugin was never changed.
Until now, the plugin had the heuristic that a plugin with a `android/build.gradle` file supported the Android platform.

Also applies schema of `getPluginDependencies` to `getPluginList` which uses a `List` of Object instead of `Properties`.

Fixes #97729
Cause of the error: 5f105a6ca7/packages/flutter_tools/gradle/flutter.gradle (L421C25-L421C25)

Fixes #98048
The deprecated line `include ":$name"` in `settings.gradle` (pluginEach) in old projects causes the `project.rootProject.findProject` to also find the plugin "project", so it is not failing on the `afterEvaluate` method. But the plugin shouldn't be included in the first place as it fails with `Could not find method implementation() for arguments` error in special cases.

Related to #48918, see [_writeFlutterPluginsListLegacy](27bc1cf61a/packages/flutter_tools/lib/src/flutter_plugins.dart (L248)).

Co-authored-by: Emmanuel Garcia <egarciad@google.com>
2023-12-21 16:55:04 +00:00
Michael Goderbauer 68e346e41c
Remove outdated ignores from tool (#140467)
These were not ignoring anything (anymore).
2023-12-20 22:14:32 +00:00
Reid Baker d6e435a7ac
Part 1/n migration steps for kotlin migration (#140452)
Following https://developer.android.com/build/migrate-to-kotlin-dsl
1/n Add parentheses to method calls 

Should be a no-op change. If you see a behavioral change please flag it.
2023-12-20 20:40:17 +00:00
Gustl22 da0cd69659
Revert automated changes made to deprecated settings.gradle (plugins.each) (#140037)
Restore testing deprecated settings.gradle (plugins.each).

Updated presumably by accident in #83067

Split from #137115
See also https://github.com/flutter/flutter/pull/137115#issuecomment-1781909865
2023-12-20 15:45:08 +00:00
Christopher Fujino ef1227f05d
[flutter_tools] handle FileSystemException trying to delete temp directory from core_devices.dart (#140415)
Fixes https://github.com/flutter/flutter/issues/140416, the top crasher on stable/3.16.4
2023-12-20 00:08:54 +00:00
Bartek Pacia a1e1dc3f6c
Reland "Warn when Gradle plugins are applied using the legacy apply script method (#140103)
> This PR relands #139690 which was reverted in #140102

This PR adds a deprecation message when Android build is using the legacy "apply script method" way of applying Flutter's Gradle plugins (that is: [`flutter.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/flutter.gradle) and [`app_plugin_loader.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/app_plugin_loader.gradle)).

See also:
- #121541
  - in particular https://github.com/flutter/flutter/issues/121541#issuecomment-1836947311
- #135392
  - and PR that add the migration guide: [#9857](https://github.com/flutter/website/pull/9857)

- I think either `logger.error` or `logger.quiet` must be used, because all other error levels are not shown during `flutter build apk` (and that's what most people use).
2023-12-19 16:03:23 +00:00
Polina Cherkasova 6368d65622
Upgrade to version of leak tracker that does not depend on test_widgets. (#140247)
Contributes to: https://github.com/flutter/flutter/issues/135856
2023-12-19 04:28:09 +00:00
raphire08 4659b0c402
refactored cli tool ipa method name to support --export-options-plist (#138555)
This PR changes the way the IPA method is read in the run command for `build ipa` command. If export options plist argument is provided it takes method name from plist, otherwise it uses the method name from export method argument.

*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.*
fixes [#122179](https://github.com/flutter/flutter/issues/122179)
2023-12-18 08:56:07 +00:00
Xilai Zhang c1762215ad
[github actions] minor PR to test latest github actions (#140252)
Minor fix of a typo.

A merged PR on flutter/flutter with a newer base commit is needed to test the latest version of https://github.com/flutter/flutter/blob/master/.github/workflows/easy-cp.yml. (more details in https://github.com/flutter/flutter/pull/140191#issuecomment-1857169933).

This PR has a base commit that includes the latest updates to easy-cp.yml, and would be a good candidate for testing purposes when merged
2023-12-16 03:31:21 +00:00
Elias Yishak d180c12705
Use new enabledFeature param for Analytics (#139934)
Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

This updates the `Analytics` constructor to provide it with the enabled features for the flutter-tool. This will be sent with each event for the flutter-tool.
2023-12-15 19:58:05 +00:00
Polina Cherkasova bda158adf0
Reorganize dependencies on leak_tracker. (#140233)
1. Move leak_tracker and leak_tracker_testing out of direct dependencies.
2. Move leak_tracker_flutter_testing from dev to prod dependencies for flutter_test

It is prerequisite for https://github.com/flutter/flutter/issues/135856
2023-12-15 19:33:23 +00:00
Chris Bracken d0670f0591
[macOS,iOS] CocoaPods recommended version: 1.13.0 (#135447)
Due to changes in Xcode 15, several variables such as `DT_TOOLCHAIN_DIR`
have been eliminateed in favour of others such as `TOOLCHAIN_DIR`. This
broke CocoaPods support under Xcode 15, as reported in:
https://github.com/CocoaPods/CocoaPods/issues/12012

@vashworth worked around this in Flutter in:
https://github.com/flutter/flutter/pull/132803

The CocoaPods issue was resolved by the following PR to their repo:
https://github.com/CocoaPods/CocoaPods/pull/12009
and was released in CocoaPods 1.13.0.

Also switches from an if-else chain to a switch for CocoaPodsStatus
handling.

Related: https://github.com/flutter/flutter/issues/133584
Related: https://github.com/flutter/flutter/issues/132755

## 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

Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com>
2023-12-15 11:16:52 -08:00
Polina Cherkasova 6a85684877
Increase versions of leak tracker libraries. (#140018)
Contributes to https://github.com/flutter/flutter/issues/135856
2023-12-15 05:18:23 +00:00
Gustl22 fc77dd90d4
Adapt wording for required Android SDK for plugins (#140043)
Solves https://github.com/flutter/flutter/pull/137115#discussion_r1388251047
2023-12-14 05:45:15 +00:00
Andrew Kolos 935775cb74
[reland] Support conditional bundling of assets based on --flavor (#139834)
Reland of https://github.com/flutter/flutter/pull/132985. Fixes the path to AssetManifest.bin in flavors_test_ios
2023-12-14 05:30:10 +00:00
Daco Harkes 3b370c8539
[deps] update Android SDK to 34 (#138183)
Update Android SDK from 33 to 34.

Following the engine update:

* https://github.com/flutter/engine/pull/47839
2023-12-14 00:55:57 +00:00
Lau Ching Jun c1caa24aa4
Optimize file transfer when using proxied devices. (#139968)
List of changes:
1. Optimizations in FileTransfer. a. Use `stream.forEach` instead of `await for`. b. Type cast `List<int>` to `Uint8List` instead of using `Uint8List.fromList` results in (presumably) fewer copy and faster execution. c. Iterate through `Uint8List` with regular for loop instead of for-in loop.
2. Precache the block hashes of a file, and reuse it on subsequent runs.
2023-12-14 00:11:32 +00:00
Reid Baker 3c80cc7eb9
Do not use project in do last (#139325)
- Use copy task that branches for 8.3 and above to avoid using project.exec in a dolast block. 

part 1/n for flutter/flutter/issues/138523 

This PR does not test the 8.3 branch but instead builds the ability to write a branching gradle test. 
After fixing this project.exec action there I discovered a second that needs to be removed or migrated in order for the build to work. 

Related reading https://docs.gradle.org/8.0/userguide/configuration_cache.html#config_cache:requirements
https://docs.gradle.org/current/javadoc/org/gradle/process/ExecOperations.html (not used but considered) 
https://docs.gradle.org/8.2/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:fileMode
2023-12-13 23:47:58 +00:00
auto-submit[bot] 625bc50c39
Reverts "Warn when Gradle plugins are applied using the legacy "apply script method" way" (#140102)
Reverts flutter/flutter#139690
Initiated by: hellohuanlin
This change reverts the following previous change:
Original Description:
This PR adds a deprecation message when Android build is using the legacy "apply script method" way of applying Flutter's Gradle plugins (that is: [`flutter.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/flutter.gradle) and [`app_plugin_loader.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/app_plugin_loader.gradle)).

See also:
- #121541
  - in particular https://github.com/flutter/flutter/issues/121541#issuecomment-1836947311
- #135392
  - and PR that add the migration guide: [#9857](https://github.com/flutter/website/pull/9857)

- I think either `logger.error` or `logger.quiet` must be used, because all other error levels are not shown during `flutter build apk` (and that's what most people use).
2023-12-13 23:08:25 +00:00
Bartek Pacia 4aef59befb
Warn when Gradle plugins are applied using the legacy "apply script method" way (#139690)
This PR adds a deprecation message when Android build is using the legacy "apply script method" way of applying Flutter's Gradle plugins (that is: [`flutter.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/flutter.gradle) and [`app_plugin_loader.gradle`](https://github.com/flutter/flutter/blob/3.16.0/packages/flutter_tools/gradle/app_plugin_loader.gradle)).

See also:
- #121541
  - in particular https://github.com/flutter/flutter/issues/121541#issuecomment-1836947311
- #135392
  - and PR that add the migration guide: [#9857](https://github.com/flutter/website/pull/9857)

- I think either `logger.error` or `logger.quiet` must be used, because all other error levels are not shown during `flutter build apk` (and that's what most people use).
2023-12-13 20:45:56 +00:00
Gray Mackall 9a72e1c699
Allow plugins to use compileSdkPreview (#131901)
Fixes https://github.com/flutter/flutter/issues/124748

Based (heavily) off https://github.com/flutter/flutter/pull/104662
2023-12-12 20:06:04 +00:00
flutter-pub-roller-bot e278279a48
Roll pub packages (#139969)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-12-12 10:12:26 +00:00
Christopher Fujino fac41dde7f
[flutter_tools] catch SocketException writing to ios-deploy stdin (#139784)
Fixes https://github.com/flutter/flutter/issues/139709

This adds a static helper method `ProcessUtils.writelnToStdinGuarded()`, which will asynchronously write to a sub-process's STDIN `IOSink` and catch errors.

In talking with Brian, it sounds like this is the best and most reliable way to catch `SocketException`s during these writes *to sub-process file descriptors* specifically (with a "real" hard drive file, the future returned by `.flush()` should complete with the write error).

Also, as I note in the dartdoc to `writelnToStdinGuarded()`, the behavior seems to be different between macOS and linux.

Moving forward, in any place where we want to catch exceptions writing to STDIN, we will want to use this new helper.
2023-12-12 00:32:18 +00:00
flutter-pub-roller-bot 44beb843aa
Roll pub packages (#139926)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-12-11 18:35:25 +00:00
flutter-pub-roller-bot 10a31934f2
Roll pub packages (#139864)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-12-09 15:35:26 +00:00
Victoria Ashworth 82bc9ca327
If one method of finding Dart VM fails for CoreDevice, wait for the other method (#139754)
For CoreDevices we use a combination of mDNS and device logs to find the Dart VM url. If mDNS fails first, it will cause the launch to fail even though the device logs may be able to find the url. So if one of the methods fails, wait for the other method before failing the launch.

Fixes https://github.com/flutter/flutter/issues/139685.
2023-12-08 16:39:08 +00:00
auto-submit[bot] 21766a4f9f
Reverts "Support conditional bundling of assets based on --flavor" (#139787)
Reverts flutter/flutter#132985
Initiated by: christopherfujino
This change reverts the following previous change:
Original Description:
Provides support for conditional bundling of assets through the existing `--flavor` option for `flutter build` and `flutter run`. Closes https://github.com/flutter/flutter/issues/21682. Resolves https://github.com/flutter/flutter/issues/136092

## Change
Within the `assets` section pubspec.yaml, the user can now specify one or more `flavors` that an asset belongs to. Consider this example:

```yaml
# pubspec.yaml
flutter:
  assets:
    - assets/normal-asset.png
    - path: assets/vanilla/ice-cream.png
      flavors: 
        - vanilla
    - path: assets/strawberry/ice-cream.png
      flavors:
        - strawberry
```

With this pubspec,
* `flutter run --flavor vanilla` will not include `assets/strawberry/ice-cream.png` in the build output.
* `flutter run --flavor strawberry` will not include `assets/vanilla/ice-cream.png`.
* `flutter run` will only include `assets/normal-asset.png`.

## Open questions

* Should this be supported for all platforms, or should this change be limited to ones with documented `--flavor` support (Android, iOS, and (implicitly) MacOS)? This PR currently only enables this feature for officially supported platforms.

## Design thoughts, what this PR does not do, etc.

### This does not provide an automatic mapping/resolution of asset keys/paths to others based on flavor at runtime.

The implementation in this PR represents a simplest approach. Notably, it does not give Flutter the ability to dynamically choose an asset based on flavor using a single asset key. For example, one can't use `Image.asset('config.json')` to dynamically choose between different "flavors" of `config.json` (such as `dev-flavor/config.json` or `prod-flavor/config.json`). However, a user could always implement such a mechanism in their project or in a library by examining the flavor at runtime.

### When multiple entries affect the same file and 1) at least one of these entries have a `flavors` list provided and 2) these lists are not equivalent, we always consider the manifest to be ambiguous and will throw a `ToolExit`. 

<details>
For example, these manifests would all be considered ambiguous:

```yaml
assets:
  - assets/
  - path: assets/vanilla.png
    flavors: 
      - vanilla

assets:
  - path: assets/vanilla/
    flavors: 
      - vanilla
  - path: assets/vanilla/cherry.png
     flavor:
      - cherry

# Thinking towards the future where we might add glob/regex support and more conditions other than flavor:
assets:
  - path: assets/vanilla/**
    flavors:
      - vanilla
  - path: assets/**/ios/**
    platforms: 
       - ios

# Ambiguous in the case of assets like "assets/vanilla/ios/icon.svg" since we 
# don't know if flavor `vanilla` and platform `ios` should be combined using or-logic or and-logic.
```

See [this review comment thread](https://github.com/flutter/flutter/pull/132985#discussion_r1381909942) for the full story on how I arrived at this decision.
</details>

### This does not support Android's multidimensional flavors feature (in an intuitive way)

<details>

Conder this excerpt from a Flutter project's android/app/build.gradle file:

```groovy
android {
    // ...

    flavorDimensions "mode", "api"

    productFlavors {
        free {
            dimension "mode"
            applicationIdSuffix ".free"
        }

        premium {
            dimension "mode"
            applicationIdSuffix ".premium"
        }

        minApi23 {
            dimension "api"
            versionNameSuffix "-minApi23"
        }

        minApi21 {
            dimension "api"
            versionNameSuffix "-minApi21"
        }
    }
}
```

In this setup, the following values are valid `--flavor` are valid `freeMinApi21`, `freeMinApi23`, `premiumMinApi21`, and `premiumMinApi23`. We call these values "flavor combinations". Consider the following from the Android documentation[^1]:

> In addition to the source set directories you can create for each individual product flavor and build variant, you can also create source set directories for each combination of product flavors. For example, you can create and add Java sources to the src/demoMinApi24/java/ directory, and Gradle uses those sources only when building a variant that combines those two product flavors.
> 
> Source sets you create for product flavor combinations have a higher priority than source sets that belong to each individual product flavor. To learn more about source sets and how Gradle merges resources, read the section about how to [create source sets](https://developer.android.com/build/build-variants#sourcesets).

This feature will not behave in this way. If a user utilizes this feature and also Android's multidimensional flavors feature, they will have to list out all flavor combinations that contain the flavor they want to limit an asset to:

```yaml
assets:
  - assets/free/
    flavors:
      - freeMinApi21
      - freeMinApi23
```

This is mostly due to a technical limitation in the hot-reload feature of `flutter run`. During a hot reload, the tool will try to update the asset bundle on the device, but the tool does not know the flavors contained within the flavor combination (that the user passes to `--flavor`). Gradle is the source of truth of what flavors were involved in the build, and `flutter run` currently does not access to that information since it's an implementation detail of the build process. We could bubble up this information, but it would require a nontrivial amount of engineering work, and it's unclear how desired this functionality is. It might not be worth implementing.

</details>

See https://flutter.dev/go/flavor-specific-assets for the (outdated) design document. 

<summary>Pre-launch Checklist</summary>

</details>

[^1]: https://developer.android.com/build/build-variants#flavor-dimensions
2023-12-08 06:40:28 +00:00
Andrew Kolos 016eb85177
Support conditional bundling of assets based on --flavor (#132985)
Provides support for conditional bundling of assets through the existing `--flavor` option for `flutter build` and `flutter run`. Closes https://github.com/flutter/flutter/issues/21682. Resolves https://github.com/flutter/flutter/issues/136092

## Change
Within the `assets` section pubspec.yaml, the user can now specify one or more `flavors` that an asset belongs to. Consider this example:

```yaml
# pubspec.yaml
flutter:
  assets:
    - assets/normal-asset.png
    - path: assets/vanilla/ice-cream.png
      flavors: 
        - vanilla
    - path: assets/strawberry/ice-cream.png
      flavors:
        - strawberry
```

With this pubspec,
* `flutter run --flavor vanilla` will not include `assets/strawberry/ice-cream.png` in the build output.
* `flutter run --flavor strawberry` will not include `assets/vanilla/ice-cream.png`.
* `flutter run` will only include `assets/normal-asset.png`.

## Open questions

* Should this be supported for all platforms, or should this change be limited to ones with documented `--flavor` support (Android, iOS, and (implicitly) MacOS)? This PR currently only enables this feature for officially supported platforms.

## Design thoughts, what this PR does not do, etc.

### This does not provide an automatic mapping/resolution of asset keys/paths to others based on flavor at runtime.

The implementation in this PR represents a simplest approach. Notably, it does not give Flutter the ability to dynamically choose an asset based on flavor using a single asset key. For example, one can't use `Image.asset('config.json')` to dynamically choose between different "flavors" of `config.json` (such as `dev-flavor/config.json` or `prod-flavor/config.json`). However, a user could always implement such a mechanism in their project or in a library by examining the flavor at runtime.

### When multiple entries affect the same file and 1) at least one of these entries have a `flavors` list provided and 2) these lists are not equivalent, we always consider the manifest to be ambiguous and will throw a `ToolExit`. 

<details>
For example, these manifests would all be considered ambiguous:

```yaml
assets:
  - assets/
  - path: assets/vanilla.png
    flavors: 
      - vanilla

assets:
  - path: assets/vanilla/
    flavors: 
      - vanilla
  - path: assets/vanilla/cherry.png
     flavor:
      - cherry

# Thinking towards the future where we might add glob/regex support and more conditions other than flavor:
assets:
  - path: assets/vanilla/**
    flavors:
      - vanilla
  - path: assets/**/ios/**
    platforms: 
       - ios

# Ambiguous in the case of assets like "assets/vanilla/ios/icon.svg" since we 
# don't know if flavor `vanilla` and platform `ios` should be combined using or-logic or and-logic.
```

See [this review comment thread](https://github.com/flutter/flutter/pull/132985#discussion_r1381909942) for the full story on how I arrived at this decision.
</details>

### This does not support Android's multidimensional flavors feature (in an intuitive way)

<details>

Conder this excerpt from a Flutter project's android/app/build.gradle file:

```groovy
android {
    // ...

    flavorDimensions "mode", "api"

    productFlavors {
        free {
            dimension "mode"
            applicationIdSuffix ".free"
        }

        premium {
            dimension "mode"
            applicationIdSuffix ".premium"
        }

        minApi23 {
            dimension "api"
            versionNameSuffix "-minApi23"
        }

        minApi21 {
            dimension "api"
            versionNameSuffix "-minApi21"
        }
    }
}
```

In this setup, the following values are valid `--flavor` are valid `freeMinApi21`, `freeMinApi23`, `premiumMinApi21`, and `premiumMinApi23`. We call these values "flavor combinations". Consider the following from the Android documentation[^1]:

> In addition to the source set directories you can create for each individual product flavor and build variant, you can also create source set directories for each combination of product flavors. For example, you can create and add Java sources to the src/demoMinApi24/java/ directory, and Gradle uses those sources only when building a variant that combines those two product flavors.
> 
> Source sets you create for product flavor combinations have a higher priority than source sets that belong to each individual product flavor. To learn more about source sets and how Gradle merges resources, read the section about how to [create source sets](https://developer.android.com/build/build-variants#sourcesets).

This feature will not behave in this way. If a user utilizes this feature and also Android's multidimensional flavors feature, they will have to list out all flavor combinations that contain the flavor they want to limit an asset to:

```yaml
assets:
  - assets/free/
    flavors:
      - freeMinApi21
      - freeMinApi23
```

This is mostly due to a technical limitation in the hot-reload feature of `flutter run`. During a hot reload, the tool will try to update the asset bundle on the device, but the tool does not know the flavors contained within the flavor combination (that the user passes to `--flavor`). Gradle is the source of truth of what flavors were involved in the build, and `flutter run` currently does not access to that information since it's an implementation detail of the build process. We could bubble up this information, but it would require a nontrivial amount of engineering work, and it's unclear how desired this functionality is. It might not be worth implementing.

</details>

See https://flutter.dev/go/flavor-specific-assets for the (outdated) design document. 

<summary>Pre-launch Checklist</summary>

</details>

[^1]: https://developer.android.com/build/build-variants#flavor-dimensions
2023-12-07 23:50:00 +00:00
Camille Simon 1fa54ea90a
[Android] Bump template & integration test Gradle version to 7.6.4 (#139276)
Updates Gradle version for Flutter project templates and integration tests to at least 7.6.3 (changed all of those with versions below it) to fix security vulnerability.

Part of fix for https://github.com/flutter/flutter/issues/138336.
2023-12-07 18:31:20 +00:00
Daco Harkes 6ad755536e
Native assets support for Android (#135148)
Support for FFI calls with `@Native external` functions through Native assets on Android. 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.

Mainly follows the design of the previous PRs.

For Android, we detect the compilers inside the NDK inside SDK.

And bundling of the assets is done by the flutter.groovy file.

The `minSdkVersion` is propagated from the flutter.groovy file as well.

The NDK is not part of `flutter doctor`, and users can omit it if no native assets have to be build.
However, if any native assets must be built, flutter throws a tool exit if the NDK is not installed.

Add 2 app is not part of this PR yet, instead `flutter build aar` will tool exit if there are any native assets.
2023-12-07 16:29:11 +00:00
Elias Yishak 2b218fd1fc
Migrate command usage values (#139383)
Related to the tracker issue:
- https://github.com/flutter/flutter/issues/128251

This PR migrates the `Usage.command` static method that sent custom dimensions for each command (if applicable). The screenshot below shows the different places where the `usageValues` getter is overwritten to return the necessary custom dimensions for that command.

<img width="285" alt="image" src="https://github.com/flutter/flutter/assets/42216813/e32d5100-0e17-4a4d-8f21-327a8c113a19">
2023-12-07 16:12:03 +00:00
Andrew Kolos c22c19b6e2
have Java.version return null if java --version fails or cannot be run (#139614)
## Summary
Fixes https://github.com/flutter/flutter/issues/139180, where `flutter create` could crash if the `java` binary the tool found cannot be run.

## Context

At startup, the tool searches for a Java installation[^1]. Unless the located installation is from [an Android Studio installation](e1967ecabf/packages/flutter_tools/lib/src/android/android_studio.dart (L163)), the tool does not verify that the binary is runnable. For more, see https://github.com/flutter/flutter/issues/139613, which tracks this inconsistency in behavior. 

This means that in the scenario where

1) the user does not have Android Studio installed or the java binary found within cannot be run **and**
2) the user has a) `flutter config --jdk-dir` set, b) `JAVA_HOME` set in their environment, **or** c) `java` on their system path **and**
3) the java binary we think we found during cannot be run (or `java --version` fails), **then**

the user running `flutter create` with Android enabled will hit a tool crash.

## Change

`Java.version` should return null if version checking fails for any reason. [This is documented behavior](48f57621ad/packages/flutter_tools/lib/src/android/java.dart (L136)). Therefore, we'll update the implementation to first verify that the binary is runnable. If it isn't, it will return `null`.

[^1]: We find java by calling the static `Java.find`, see: 48187028c1/packages/flutter_tools/lib/src/context_runner.dart (L271)
[^2]: This PR doesn't change this, as this would be too dangerous to cherry-pick into stable.
2023-12-06 23:13:17 +00:00
Ian Hickson fca7bc9e28
Roll dependencies (#139606)
test-exempt: rolling dependencies
2023-12-06 19:22:06 +00:00
flutter-pub-roller-bot 935c8e8efe
Roll pub packages (#139510)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-12-05 20:23:54 +00:00
Lau Ching Jun 7a9adfd1c7
Send an event when proxied DDS creates a connection. (#139530)
The event allows tools to listen and connect to the original DDS port.
2023-12-05 08:32:25 +00:00
Lau Ching Jun 63c58a33d7
Make handleJsonEvent public so that it can be overridden internally. (#139531) 2023-12-05 07:42:05 +00:00
Kristijan Žic 77503bdb91
Added support for vscode and vscode-insiders installed via Flatpak (#137123)
Closes #137122

<b>Before</b>
VS Code and VS Code Insiders installed via Flatpak aren't detected

<b>After</b>
```sh
[✓] VS Code (version 1.82.2)
    • VS Code at /var/lib/flatpak/app/com.visualstudio.code/x86_64/stable/active/files/extra/vscode
    • Flutter extension version 3.74.0

[✓] VS Code (version 1.84.0-insider)
    • VS Code at /var/lib/flatpak/app/com.visualstudio.code.insiders/x86_64/beta/active/files/extra/vscode-insiders
    • Flutter extension version 3.75.20231002
```
2023-12-04 21:59:53 +00:00
Elias Yishak 2d60241d61
[Reland] Migration for the sendTiming events for package:unified_analytics (#139299)
Relanding based on this comment:
- https://github.com/flutter/flutter/pull/139278#issuecomment-1832951108

Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

<img width="278" alt="image" src="https://github.com/flutter/flutter/assets/42216813/cee7b9be-48d6-48e5-8c39-de28d0a1f0de">

The image above shows all of the instances where we have `sendTiming`. All of the call sites have been updated to use the new `Event.timing` event from `package:unified_analytics`.
2023-12-04 21:39:18 +00:00
Pavel Mazhnik 0f67c99208
[flutter_tools] build ios-frameworks: option to exclude plugin frameworks from the build (#129739)
A lot of details are written in the feature request: https://github.com/flutter/flutter/issues/114692.

tl;dr: Options B & C from the add2app iOS guide have a limitation (build error) in case the Flutter plugin and native iOS app have a shared dependency. We can use a workaround to avoid the issue, but in this case we don't need to build frameworks for plugins.

Closes https://github.com/flutter/flutter/issues/114692
Part of https://github.com/flutter/flutter/issues/130220
2023-12-04 20:29:53 +00:00
Kristijan Žic cf71a55f7d
Added vscode-insiders path installed via snap (#137117)
Closes  #137116

<b>Before</b>
VS Code Insiders installed via Snap isn't detected.

<b>After</b>
```sh
[✓] VS Code (version 1.84.0-insider)
    • VS Code at /snap/code-insiders/current/usr/share/code-insiders
    • Flutter extension version 3.75.20231002
```
2023-12-01 20:40:49 +00:00
Mouad Debbar 7d9010c357
Typo fix in dartdoc in tool test (#139386)
The tree is red due a non-hermetic customer test from `macos_ui`. The
test was disabled in https://github.com/flutter/tests/pull/317 and an
issue was filed at https://github.com/macosui/macos_ui/issues/499.

We need this empty commit in order to re-run CI with the latest
https://github.com/flutter/tests.
2023-12-01 14:24:09 -05:00
auto-submit[bot] 6c4475e72d
Reverts "Migration for the sendTiming events for package:unified_analytics" (#139278)
Reverts flutter/flutter#138896
Initiated by: CaseyHillers
This change reverts the following previous change:
Original Description:
Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

<img width="278" alt="image" src="https://github.com/flutter/flutter/assets/42216813/cee7b9be-48d6-48e5-8c39-de28d0a1f0de">

The image above shows all of the instances where we have `sendTiming`. All of the call sites have been updated to use the new `Event.timing` event from `package:unified_analytics`.
2023-11-30 01:16:19 +00:00
Ian Hickson b417812547
Roll dependencies (#139203)
Removes video_player and scoped_model pins, rolls everything else to latest.
2023-11-29 20:12:59 +00:00
Elias Yishak 60d5c8abc5
Migration for the sendTiming events for package:unified_analytics (#138896)
Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

<img width="278" alt="image" src="https://github.com/flutter/flutter/assets/42216813/cee7b9be-48d6-48e5-8c39-de28d0a1f0de">

The image above shows all of the instances where we have `sendTiming`. All of the call sites have been updated to use the new `Event.timing` event from `package:unified_analytics`.
2023-11-29 17:42:52 +00:00
Christopher Fujino 6bf3ccd47d
[flutter_tools] fix instructions to disable CLI animations (#139094)
Fixes https://github.com/flutter/flutter/issues/139011
2023-11-27 22:00:50 +00:00
Andrew Kolos 1952a6c8a1
Add type validation to non-template .arb file parsing logic (#139035)
Resolves https://github.com/flutter/flutter/issues/138297. 

When reading from a .arb file (which contains localizations of strings in the form of a user-defined JSON string-string map), validate the type of values that we read.

See [this comment of mine on #138297](https://github.com/flutter/flutter/issues/138297#issuecomment-1827043260) to see how I arrived at this fix.
2023-11-27 20:50:24 +00:00
Bartek Pacia e8282edf4d
Update Android app project template to apply Kotlin Gradle plugin declaratively (#139006)
This PR updates the app templates generated by `flutter create` to use declarative `plugins {}` syntax for applying the Kotlin Gradle Plugin.

I realized this is missing while writing [#9857.](https://github.com/flutter/website/pull/9857)
2023-11-27 20:50:21 +00:00
stuartmorgan d628a6ff97
Give an actionable error message when a Pod requires a higher minimum OS version (#138097)
Checks `pod install` output for the case where a pod requires a higher minimum OS deployment target version than the app is set to use, and attempts to turn it into a more actionable error message. This isn't foolproof since we are parsing the Ruby rather than actually executing it, but I would expect that the vast majority of cases would end up in the most useful version (and even those that don't are still much clearer with this as the final error message text than without it).

Fixes https://github.com/flutter/flutter/issues/113762
2023-11-27 16:22:54 +00:00
Reid Baker 311193d3f1
Edge case on flutter/flutter/issues/135402 with test (#138814)
fixes flutter/flutter/issues/135402
Edge case that was reported by a user along with a test case specifically covering their output.
2023-11-27 16:14:58 +00:00
Christopher Fujino 4c978efead
[flutter_tools] Fix bad state future already completed in flutter logs (#138517)
Fixes https://github.com/flutter/flutter/issues/138436
2023-11-23 19:56:14 +00:00
Elias Yishak 48187028c1
Add commandHasTerminal parameter + apple usage event + sendException events for package:unified_analytics (#138806)
Relates to tracker issue:
- https://github.com/flutter/flutter/issues/128251

This PR includes 3 major updates:
- Adding the `commandHasTerminal` parameter for `Event.flutterCommandResult`
  - In `packages/flutter_tools/lib/src/runner/flutter_command.dart`
- Adding the new event for `sendException` from package:usage to be `Event.exception` (this event can be used by all dash tools)
  - In `packages/flutter_tools/lib/runner.dart`
- Migrating the generic `UsageEvent` which was only used for Apple related workflows for iOS and macOS. I did an initial analysis in this [sheet](https://docs.google.com/spreadsheets/d/11KJLkHXFpECMX7tw-trNkYSr5MHDG15XNGv6TgLjfQs/edit?resourcekey=0-j4qdvsOEEg3wQW79YlY1-g#gid=0) to identify all the call sites
  - Found in several files, highlighted in the sheet above
2023-11-22 12:25:10 +00:00
Andrew Kolos cf09a8a24f
In flutter doctor -v, when JRE is too out-of-date to run sdkmanager, print a helpful error message (#138762)
Closes https://github.com/flutter/flutter/issues/138132. See this issue for more information.
2023-11-21 23:16:08 +00:00
Victoria Ashworth e826c63aec
Fix file deletion crash in BuildIOSArchiveCommand.runCommand (#138734)
Fixes https://github.com/flutter/flutter/issues/138030
2023-11-20 19:25:17 +00:00
Parker Lougheed 096cdc39a9
Update links and surrounding text for new main-api docs (#138602)
Issue reference: https://github.com/flutter/flutter/issues/133877
2023-11-17 22:27:53 +00:00
Victor Eronmosele e9de448420
Enable flutter screenshot outside Flutter project directory (#138160)
This PR enables the `flutter screenshot` to work outside a Flutter project. 

This works by enabling `ScreenshotCommand` to find target devices not supported by the project. 

Before: 
```bash
$ cd $HOME # not a Flutter directory

$ flutter screenshot

No devices found yet. Checking for wireless devices...

No supported devices connected.

The following devices were found, but are not supported by this project:
sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 13 (API 33) (emulator)
macOS (desktop)             • macos         • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
Chrome (web)                • chrome        • web-javascript • Google Chrome 119.0.6045.105
If you would like your app to run on android or macos or web, consider running `flutter create .` to generate projects for these platforms.
Must have a connected device for screenshot type device
```

After: 

```bash
$ cd $HOME # not a Flutter directory

$ flutter_source screenshot

Screenshot written to flutter_01.png (313kB).
```

Fixes #115790
2023-11-17 01:08:13 +00:00
chunhtai d8a5f3d11b
Improves output file path logic in Android analyze (#136981) 2023-11-16 22:59:02 +00:00
Arpit Gandhi 428bff1dde
#60704: Pass cert for TLS localhost connection (#106635)
*Pass locally generated certificate via command line*

*Fixes: #60704*

Added ARGS: 

- web-tls-cert-path
- web-tls-cert-key-path

Passing the path of local certificate and the key to cert will allow flutter tool to create a secure debugging session on chrome

**Pre-launch Checklist**

✅   I read the [Contributor Guide](https://github.com/flutter/flutter/wiki/Tree-hygiene#overview) and followed the process outlined there for submitting PRs.
✅   I read the [Tree Hygiene](https://github.com/flutter/flutter/wiki/Tree-hygiene) wiki page, which explains my responsibilities.
✅   I read and followed the [Flutter Style Guide](https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo), including [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).
✅   I signed the [CLA](https://cla.developers.google.com/).
✅   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.
✅   All existing and new tests are passing.
2023-11-16 21:19:07 +00:00
lsaudon 9be8f4fd58
Bump cupertino_icons to 1.0.6 (#136962)
Bump cupertino_icons to 1.0.6
2023-11-16 21:15:04 +00:00
Ian Hickson 4d788b109d
Reduce animations further when --no-cli-animations is set. (#133598) 2023-11-16 21:05:22 +00:00
Dan Field c6c451ee46
Just use string interpolation for ws url for tests (#138235)
Follows up on https://github.com/flutter/flutter/pull/137969 - we don't
need decodeComponent here
2023-11-16 10:27:25 -08:00
Bruno Leroux dcdf72a670
[flutter_tools] - Add queries section to Android manifest file (#137207)
## Description

This PR adds a new section to the Android manifest file.
This section is required for https://github.com/flutter/engine/pull/44579 (because it uses `PackageManager.queryIntentActivities` API ), see:

1. https://developer.android.com/training/package-visibility?hl=en
2. https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT
3. https://developer.android.com/reference/android/content/pm/PackageManager?hl=en#queryIntentActivities(android.content.Intent,%20android.content.pm.PackageManager.ResolveInfoFlags)

## Related Issue

Android manifest update for https://github.com/flutter/flutter/issues/107603

## Tests

This PR updates the integration tests and examples Android manifest files, this will help catch error or warning related to this change.
2023-11-16 08:57:20 +00:00
Elias Yishak 04afff387f
Catch error for missing directory in FontConfigManager (#138496)
Closes:
- https://github.com/flutter/flutter/issues/138434

We will catch any errors while attempting to clear the temp directories that don't exist for the `FontConfigManager` class
2023-11-15 23:17:29 +00:00
Elias Yishak d5b67035b0
Unified analytics migration for CodeSizeAnalysis (#138351)
Part of tracker issue:
- https://github.com/flutter/flutter/issues/128251

This migrates the event being sent when the "--analyze-size" is used in a flutter invocation

The only file that had this event being sent from is `packages/flutter_tools/lib/src/base/analyze_size.dart`
2023-11-14 20:23:40 +00:00
Jackson Gardner 07d73630fb
Consume flutter.js from the engine artifacts. (#137113)
Work in progress... currently testing against presubmit.
2023-11-14 17:00:29 +00:00
Michael Goderbauer c4b706cd58
Finally remove analysis_options_user.yaml (#138261)
🫡

This was terribly outdated and has long been superseded by `package:flutter_lints`. Also, as of c033718da0 support for this was removed from the analyzer and this file is now even more useless, if that's even possible.

Fixes https://github.com/flutter/flutter/issues/82948.
2023-11-13 22:13:08 +00:00
Polina Cherkasova 793827d98a
Upgrade leak tracker. (#138283) 2023-11-13 09:47:55 -08:00
Kristijan Žic 0539c8bdee
Fixes vscode path installed via snap (#136997)
Fixes the #136996
Readresses the #54358

Before:
```sh
[✓] VS Code (version unknown)
    • VS Code at /snap/code/current
    • Flutter extension version 3.74.0
    ✗ Unable to determine VS Code version.
```

After:
```sh
[✓] VS Code (version 1.83.1)
    • VS Code at /snap/code/current/usr/share/code
    • Flutter extension version 3.74.0
```

*List which issues are fixed by this PR. You must list at least one
issue.*

## 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
2023-11-10 15:11:01 -08:00
Chris Bracken d71fe92ec4
[macOS] Suppress Xcode 15 createItemModels warning (#138243)
As of Xcode 15 on macOS Sonoma, the following message is (repeatedly)
output to stderr during builds (repros on non-Flutter apps). It is
supppressed in xcode itself, but not when run from the command-line.

```
2023-11-10 10:44:58.031 xcodebuild[61115:1017566] [MT] DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22267/IDEFoundation/Provisioning/Capabilities Infrastructure/IDECapabilityQuerySelection.swift:103
Details:  createItemModels creation requirements should not create capability item model for a capability item model that already exists.
Function: createItemModels(for:itemModelSource:)
Thread:   <_NSMainThread: 0x6000027c0280>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
```

This suppresses this message from stderr in our macOS build logs.

Issue: https://github.com/flutter/flutter/issues/135277

## 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
2023-11-10 14:14:32 -08:00
Elias Yishak 7a278ae47c
CommandResultEvent migrated (#138165)
Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

This event was only called from one file (`flutter_command.dart`). With the previous implementation, we actually sent 2 events, one for the result of the `commandPath` and another containing the `maxRss` value from `ProcessInfo`.

I have consolidated this down to just one event and used a function to safely get the `maxRss` value, or return null when if there was an error getting that integer value
2023-11-10 20:19:50 +00:00
Elias Yishak 9a76efc8e3
Update analytics constructor to include FLUTTER_HOST (#138107)
Fixes issues:
- https://github.com/flutter/flutter/issues/138035

Similar to GA3, we will now record the host running the flutter tool, such as VSCode, stored in the `FLUTTER_HOST` env variable
2023-11-10 17:44:08 +00:00
Sam Rawlins 33c0f27464
Prepare the analyze_once test for removal of analysis_options_user support (#138229)
Fixes https://github.com/flutter/flutter/issues/138227. Work towards https://github.com/flutter/flutter/issues/82948

In c033718da0, the analyzer's support for `analysis_options_user.yaml` is dropped. So no lint is reported in this test, as expected. This PR changes the test to expect no lint, and also no write the edits that trigger the lint.
2023-11-10 17:38:56 +00:00
Dan Field 9295035e83
Drop unnecessary URI encoding of websocket url in listener (#137969)
This seems like an old remnant that is now completely unnecessary.
2023-11-10 17:21:17 +00:00
flutter-pub-roller-bot bc8acbe14b
Roll pub packages (#138163)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-11-10 01:20:14 +00:00
Camille Simon c66bb0a18a
[Android] Support Android 34 (take 2) (#137967)
Re-lands https://github.com/flutter/flutter/pull/137191.

The fix for the issue causing that PR to be reverted was tested in this PR but ultimately landed separately in https://github.com/flutter/flutter/pull/138093.
2023-11-09 22:40:15 +00:00
Reid Baker 94079b9c61
Improved Java version parsing (#138155)
Fixes #135402
Add fallback logic for a different format of java version output and handle no patch versions. 
Add tests for new logic output to prevent regressions.
2023-11-09 18:38:18 +00:00
Andrew Kolos 94550c6257
prevent tool crash when IntelliJValidatorOnMac encounters an installation with a missing CFBundleIdentifier (#138095)
Fixes https://github.com/flutter/flutter/issues/138029 (see my comment there for more info)
2023-11-09 03:46:25 +00:00
flutter-pub-roller-bot 55e692229e
Roll pub packages (#138114)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-11-09 00:48:01 +00:00
Christopher Fujino a408c6d976
[flutter_tools] disable flutter build AAR for plugins (#137878)
Per discord discussion, building an AAR out of a plugin project has not worked for years, so let's just disable the functionality. Context: https://github.com/flutter/flutter/issues/137564
2023-11-08 23:12:08 +00:00
Christopher Fujino 89692884a1
[flutter_tools] Fix local engine preview device (#138046)
Fixes https://github.com/flutter/flutter/issues/137982
2023-11-08 01:53:22 +00:00
Christopher Fujino d550ba54eb
[flutter_tools] toolexit when using plugins with preview device (#136936)
Part of https://github.com/flutter/flutter/issues/130277

Without this, if a user runs an app that has plugins that call method channels with the `preview` device, the app will build successfully, however, they will get a runtime error when their dart code tries to call the method channel that does not exist in the native build (which was pre-built and thus does not include the plugin code).

This change adds a validation when injecting plugins that will tool exit if the device-id is `preview` and their project contains plugins with method channels.
2023-11-07 20:37:19 +00:00
Daco Harkes da23eae33f
[native assets] Tool exit on build failure (#137995)
If the native assets feature is enabled, and the `build.dart` invocation fails, the `flutter build` and `flutter run` should abort.

Closes: https://github.com/flutter/flutter/issues/137910
2023-11-07 16:41:19 +00:00
Elias Yishak 17e0fe1a93
Migration for HotEvent for Flutter hot runner (#137717)
Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

For this migration, the `HotEvent` was being referenced in 2 additional files outside of `lib/src/reporting/events.dart`, shown below in the screenshot

<img width="257" alt="image" src="https://github.com/flutter/flutter/assets/42216813/97986f89-2253-4db1-9deb-bbced6321a16">
2023-11-06 21:33:11 +00:00
Ivan Inozemtsev defa4bce0a
Change cast in json parsing (#137708)
`jsonDecode` decodes lists as `List<Object?>`, so the cast to `List<Object>` fails at runtime in sound null safety mode.
2023-11-06 17:29:07 +00:00
Andrew Kolos 12de94d152
Fix tool exit message shown when user provides a non-list to "assets" for a deferred component (#137837)
Fixes #136163
2023-11-06 04:01:25 +00:00
Daco Harkes 7634609062
Pin dart-lang/native dependencies (#137601)
Pin the dependencies from dart-lang/native to a specific version during testing (rather than having them auto-upgrade during pub resolution). This will prevent tests using the template to start failing if a bad version is published to pub.

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

Also bumps dep in flutter_tools.
2023-11-03 22:16:04 +00:00
auto-submit[bot] c4ce9479bb
Reverts "[Android] Support Android 34" (#137865)
Reverts flutter/flutter#137191
Initiated by: camsim99
This change reverts the following previous change:
Original Description:
Adds support for Android 34 in the following ways:

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

Part of https://github.com/flutter/flutter/issues/134220
2023-11-03 20:14:19 +00:00
Polina Cherkasova e1b420cd5b
Upgrade leak_tracker and remove some deps in allow list. (#137806) 2023-11-03 06:20:47 -07:00
Christopher Fujino b0bc023f24
[flutter_tools] do not try to build tool from dart.sh (#129186)
Fixes https://github.com/flutter/flutter/issues/121894
2023-11-03 00:42:25 +00:00
Camille Simon 675fec805a
[Android] Support Android 34 (#137191)
Adds support for Android 34 in the following ways:

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

Part of https://github.com/flutter/flutter/issues/134220
2023-11-02 22:18:11 +00:00
Reid Baker 4d21a026e5
Protect flutter analyze --suggestions from erroring on missing AGP value. (#137719)
Fixes #137600 
Protect flutter analyze --suggestions from null error when AGP value is missing
Update template with a reference to new agp definition location 
Look for AGP version being set in settings.gradle (change to templates happened in dbe0ccd885 (diff-20537fb84ee37894a3f3d9723a06bcf2674290ee25aa83332c2524a1f7546a6d)
2023-11-02 21:14:58 +00:00
Gray Mackall 969a8750a5
Provide more information in 'unsupported class file' gradle error (#136756)
Fixes https://github.com/flutter/flutter/issues/130808. Short context is that the migration guide doesn't help when a user has a newer java version than 17, and this tells them how to fix the error in that situation.

This is an alternative to https://github.com/flutter/flutter/pull/131354, because I think it is a bad idea to introduce branching in how we handle this error with some specialized regexp.
2023-11-02 21:14:56 +00:00