Commit Graph

6670 Commits

Author SHA1 Message Date
Polina Cherkasova
2efda23a45
Pin leak_tracker. (#132261) 2023-08-09 20:25:06 -07:00
Zachary Anderson
118c2df776
Allows adding a storage 'realm' to the storage base URL (#131951)
Context: https://github.com/flutter/flutter/issues/131862

This PR injects a "realm" component to the storage base URL when the contents of the file `bin/internal/engine.realm` is non-empty.

As documented in the PR, when the realm is `flutter_archives_v2`, and `bin/internal/engine.version` contains the commit hash for a commit in a `flutter/engine` PR, then the artifacts pulled by the tool will be the artifacts built by the presubmit checks for the PR.

This works for everything but the following two cases:
1. Fuchsia artifacts are not uploaded to CIPD by the Fuchsia presubmit builds.
2. Web artifacts are not uploaded to gstatic by the web engine presubmit builds.

For (1), the flutter/flutter presubmit `fuchsia_precache` is driven by a shell script outside of the repo. It will fail when the `engine.version` and `engine.realm` don't point to a post-submit engine commit.

For (2), the flutter/flutter web presubmit tests that refer to artifacts in gstatic hang when the artifacts aren't found, so this PR skips them.
2023-08-09 23:26:05 +00:00
Victoria Ashworth
d631b26285
New tooling for iOS 17 physical devices (#131865)
This PR includes the following changes. These changes only apply to iOS 17 physical devices.

| Command | Change Description  | Changes to User Experience |
| ------------- | ------------- | ------------- |
| `flutter run --release` | Uses `devicectl` to install and launch application in release mode.  | No change.  |
| `flutter run`  | Uses Xcode via automation scripting to run application in debug and profile mode. | Xcode will be opened in the background. Errors/crashes may be caught in Xcode and therefore may not show in terminal. |
| `flutter run --use-application-binary=xxxx` | Creates temporary empty Xcode project and use Xcode to run via automation scripting in debug and profile. | Xcode will be opened in the background. Errors/crashes may be caught in Xcode and therefore may not show in terminal.  |
| `flutter install` | Uses `devicectl` to check installed apps, install app, uninstall app.  | No change.  |
| `flutter screenshot` | Will return error.  | Will return error.  |

Other changes include:
* Using `devicectl` to get information about the device
* Using `idevicesyslog` and Dart VM logging for device logs

Note:
Xcode automation scripting (used in `flutter run` for debug and profile) does not work in a headless (without a UI) interface. No known workaround.

Fixes https://github.com/flutter/flutter/issues/128827, https://github.com/flutter/flutter/issues/128531.
2023-08-09 19:25:12 +00:00
Lau Ching Jun
d5a0fcd5af
Locate the template directory using a TemplatePathProvider. (#132156)
So that the paths can be overridden.
2023-08-08 21:43:00 +00:00
Mouad Debbar
ad0dbc8de5
[web] Remove usage of ui.webOnlyInitializePlatform() (#131344)
Part of https://github.com/flutter/flutter/issues/126831
2023-08-07 21:27:11 +00:00
Victoria Ashworth
b39604e02d
Check for simulator runtime in flutter doctor (#131795)
Redo of https://github.com/flutter/flutter/pull/130728 - code is the same as before. That PR was stuck in Google testing and then I messed up the rebase so started over.

----

Starting in Xcode 15, the simulator is no longer included in Xcode and must be downloaded and installed separately. This adds a validation to `flutter doctor` to warn when the needed simulator runtime is missing.

Validation message looks like:
```
[!] Xcode - develop for iOS and macOS (Xcode 15.0)
    ! iOS 17.0 Simulator not installed; this may be necessary for iOS and macOS development.
      To download and install the platform, open Xcode, select Xcode > Settings > Platforms,
      and click the GET button for the required platform.

      For more information, please visit:
        https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes
```

It may also show an error like this when something goes wrong when checking for the simulator:
```
[!] Xcode - develop for iOS and macOS (Xcode 15.0)
    ✗ Unable to find the iPhone Simulator SDK.
```

Note: I'm unsure of in the future if the SDK and the simulator runtime will need to match the exact version or just the major. For now, it only checks against the major version.

Part 3 of https://github.com/flutter/flutter/issues/129558.
2023-08-04 17:14:06 +00:00
Andrew Kolos
30692ee4b7
make --dart-define override redundant values in --dart-define-from-file (#131088)
Fixes #130604
2023-08-04 04:00:12 +00:00
Christopher Fujino
55bb3e5538
[flutter_tools] set terminal.singleCharMode to false after attach finishes (#131723)
Fixes https://github.com/flutter/flutter/issues/131511

Similar fix to 84c8abd0f6 (diff-38f3e3415d9806f22a78060fafb3206d1a006f74631fac04e7a680a64e06ccf0)
2023-08-02 17:42:52 +00:00
Alex Li
f2db93df01
🐛 Treat empty ARB content as empty map when decoding (#131242)
Fixes #128932.
2023-08-01 01:27:54 +00:00
Sumit Bikram Maity
1d59196baf
Appended period remove & Uri parsing fix. (#131293)
Fixed code for the Uri as it includes the period at the end as the part of Uri parsing previously.

As for example:
```
A crash report has been written to /Users/andrewkolos/Desktop/asset_transformers_test/flutter_03.log.
``` 

Many terminals are unable to follow the link because it includes the period in the end as part of it. This PR simply removes the period in the end so that it is clickable in many systems (e.g. by `alt` -clicking on it in an embedded bash terminal, VSCode).

```
A crash report has been written to /Users/andrewkolos/Desktop/asset_transformers_test/flutter_03.log
``` 

Fixes:  #131166
2023-07-31 20:42:11 +00:00
Jay Mehta
efc9e16ea3
Fixed regex to show missing assets file error (#131160)
Added Regex to match error message from verbos build as suggested by @stuartmorgan [here](https://github.com/flutter/flutter/pull/98137#discussion_r810559589).
Modified Windows Build Test

Fixes #97065
2023-07-31 20:42:09 +00:00
Danny Tuppeny
0386f910d1
[flutter_tools/dap] Improve rendering of structured errors via DAP (#131251)
In the legacy VS Code DAP, we would deserialise the Flutter.Error event
and provide some basic colouring (eg. stack frames are faded if not from
user code and the text is split between stdout/stderr to allow the
client to colour it).

In the new DAPs we originally used `renderedErrorText` which didn't
support either of these. This change adds changes to use the structured
data (with some basic parsing because the source classes are in
package:flutter and not accessible here) to provide a similar
experience.

It would be nicer if we could use the real underlying Flutter classes
for this deserialisation, but extracting them from `package:flutter` and
removing all dependencies on Flutter is a much larger job and I don't
think should hold up providing improved error formatting for the new
DAPs.

Some comparisons:


![1_comparison](https://github.com/flutter/flutter/assets/1078012/74e7e6d6-c8d0-471f-b584-37ae148b0ce7)


![2_comparison](https://github.com/flutter/flutter/assets/1078012/21888934-6f2f-4048-86d7-bdf92d5c7301)
2023-07-31 13:03:26 +01:00
Ian Hickson
3396ec7b88
Device discovery output cleanup (#131223)
Fixes https://github.com/flutter/flutter/issues/6538
2023-07-28 21:37:00 +00:00
Alex Li
7d64c676dd
️ Add ssh://git@github.com/flutter/flutter.git as a standard remote (#131333)
Resolves #98020.
2023-07-27 22:09:03 +00:00
Alex Li
eab2087a0f
🐛 Only format Dart files for gen-l10n (#131232)
Improves #119596. The tests remain valid, so no tests were updated in the request.

This does not resolve issue #128932, it's handled by another part of the code.
2023-07-27 20:04:07 +00:00
Christopher Fujino
43afac1e29
Reduce usage of testUsingContext (#131078)
Part of https://github.com/flutter/flutter/issues/47161
2023-07-24 17:22:25 +00:00
Valentin Vignal
be7c7e3e45
Suggest a potential valid name for the flutter project when using flutter create (#130900)
Fixes https://github.com/flutter/flutter/issues/109775

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-07-21 19:09:25 +00:00
Lau Ching Jun
d1d78bc917
Make PollingDeviceDiscovery start the initial poll faster. (#130755)
This will speed up the initial population of the device list.
2023-07-20 05:01:24 +00:00
Tae Hyung Kim
c6b93b2db7
Relax syntax for gen-l10n (#130736)
To preserve backward compatibility with the old parser which would
ignore syntax errors, this PR introduces a way to treat the special
characters `{` and `}` in the following way:
1. If we encounter a `{` which searching for a string token and this `{`
is not followed by a valid placeholder, then we treat the `{` as a
string and continue lexing for strings.
2. If we encounter a `}` while not within some expression (i.e.
placeholders, arguments, plurals, or selects), then we treat the `}` as
a string and continue lexing for strings.

This makes it so that
```
"helloWorld": "{ } { placeholder }",
"@@helloWorld": {
  "placeholders": {
    "placeholder" {}
  }
}
```
treats the `{ }` as a string while `{ placeholder } ` is treated as a
placeholder.

Fixes https://github.com/flutter/flutter/issues/122404.
2023-07-18 13:59:48 -07:00
hellohuanlin
1b07c3d798
[tools/ios_build_ipa] fallback to CFBundleName if CFBundleDisplayName is absent (#130752)
The display name will fallback to CFBundleName if CFBundleDisplayName is absent. 

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

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

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-07-17 22:21:07 +00:00
Lau Ching Jun
d64cc47920
Make ProxiedDevices a subclass of PollingDeviceDiscovery. (#130640)
The daemon ignores all device discovery that is not a PollingDeviceDiscovery. Make ProxiedDevices a PollingDeviceDiscovery so that it can be used in flutter daemon.

Note that there is a TODO item added in the test, which I intend to attempt fixing in a subsequent PR.
2023-07-17 17:40:12 +00:00
Pavel Mazhnik
3a1190a5a8
[flutter_tools] Support coverage collection for dependencies (#129513)
PR provides a new option to the `test` command to include coverage info of specified packages.  
It helps collecting coverage info in test setups where test code lives in separate packages or for multi-package projects.
At present, only current package is included to the final report.

Usage:

Consider an app with two packages: `app`, `common`.
Some of the tests in `app` use (indirectly) code that is located in `common`. When running with `--coverage` flag, that code is not included in the coverage report by default. To include `common` package in report, we can run:

```sh
flutter test --coverage --coverage-package app --coverage-package common
```

Note that `--coverage-package` accepts regular expression. 

Fixes https://github.com/flutter/flutter/issues/79661
Fixes https://github.com/flutter/flutter/issues/101486
Fixes https://github.com/flutter/flutter/issues/93619
2023-07-17 08:42:13 +00:00
Pavel Mazhnik
1c1c273bca
[web] remove unnecessary awaits from flutter.js (#130204)
Fixed types for `_getNewServiceWorker` and `_waitForServiceWorkerActivation` functions.  
These functions currently expect a Promise as an argument, but we're actually passing in an already resolved value:
```js
.then(this._getNewServiceWorker)
.then(this._waitForServiceWorkerActivation);
```
2023-07-14 19:10:55 +00:00
gmackall
9391923276
Add an android migrator to upgrade minSdkVersions 16,17,18 to flutter.minSdkVersion (#129729)
This migrator will upgrade the minSdkVersion used in the [module-level build.gradle](https://developer.android.com/build#module-level) file to flutter.minSdkVersion. 

The PR also makes a small refactor to `AndroidProject` to add a getter for the module level build.gradle file, and uses that getter in places where we were getting that file (previously it was being gotten directly via `hostAppGradleRoot.childDirectory('app').childFile('build.gradle')`.

Part of the work for deprecating support for the Jelly Bean android apis.
2023-07-14 16:57:06 +00:00
Christopher Fujino
b91aedb175
Fix StateError during hot reload when no Dart isolates found (#130537)
Fixes https://github.com/flutter/flutter/issues/116262
2023-07-14 16:13:57 +00:00
Matan Lurey
03749051e8
Always escape when writing pubspec.yaml's 'description' field. (#130096)
Closes https://github.com/flutter/flutter/issues/80013.

**Before**:

```
$ flutter create test1 --description "a: b"
Creating project test1...
Error detected in pubspec.yaml:
Error on line 2, column 15: Mapping values are not allowed here. Did you miss a colon earlier?
  ╷
2 │ description: a: b
  │               ^
  ╵
Please correct the pubspec.yaml file at /Users/matan/Developer/scratch/test1/pubspec.yaml
```

**After**:

```
$ flutter create test1 --description "a: b"
Creating project test1...
Resolving dependencies in test1... 
Got dependencies in test1.
Wrote 129 files.

All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev

In order to run your application, type:

  $ cd test1
  $ flutter run

Your application code is in test1/lib/main.dart.
```

---

It's worth noting that this _always_ escapes a non-empty project description, which means that descriptions that were not previously wrapped in `"`s' will be. I'm not sure how worth it is to do a _conditional_ escape (i.e. only escape if not escaping would cause a problem), but willing to change.

Side-note: I had no idea where to list this test in the (very large) `create_test.dart`, so I did my best :)
2023-07-13 22:53:51 +00:00
Piotr FLEURY
99efd1b585
Fix .env regex constants (#130072)
Set `.env` regex list as constants.

This pull request fixes the nit related in this comment: https://github.com/flutter/flutter/pull/128668#discussion_r1253377454
2023-07-13 22:00:55 +00:00
Mouad Debbar
87d5214da6
[web] Migrate web-only initialization APIs (#129856)
- `ui_web.warmupEngine`
- `ui_web.setPluginHandler`
- `ui_web.debugEmulateFlutterTesterEnvironment`
2023-07-13 20:12:10 +00:00
Victoria Ashworth
2892b57558
Reland "Print pretty error when xcodebuild fails due to missing simulator #130286" (#130506)
Reland https://github.com/flutter/flutter/pull/130286 with fix.

It failed the first time because of a discrepancy between the master branch and my branch (see https://github.com/flutter/flutter/pull/130504#issue-1803449182 for more info).
2023-07-13 19:36:10 +00:00
Victoria Ashworth
ab86c79c3a
Revert "Print pretty error when xcodebuild fails due to missing simulator" (#130504)
Reverts flutter/flutter#130286
2023-07-13 17:19:56 +00:00
Victoria Ashworth
604010e9e2
Print pretty error when xcodebuild fails due to missing simulator (#130286)
Starting in Xcode 15, the simulator is no longer included in Xcode and must be downloaded and installed separately.

If you try to run flutter and the simulator is missing, you'll get an error like
```
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
               		{ id:B1234A5C-67B8-901D-B2CB-FE34F56BDE78 }

               	Ineligible destinations for the "Runner" scheme:
               		{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 17.0 is not installed. To use with Xcode, first download and install the platform }
```

Print a pretty error to make it easier for developers to know what to do.

Part 2 of https://github.com/flutter/flutter/issues/129558.
2023-07-13 16:51:13 +00:00
Jonah Williams
60c1f37609
[flutter_tools] remove desktop device restrictions on Impeller. (#130430)
All current desktop backends will support Impeller after https://github.com/flutter/engine/pull/43388 lands.
2023-07-13 16:26:02 +00:00
Tae Hyung Kim
d75735eea6
Use platform specific line separator in gen-l10n (#130090)
Currently files are not generated with `\r\n` in windows. This PR should
fix the issue.

Fixes https://github.com/flutter/flutter/issues/109761.
2023-07-12 12:50:53 -07:00
Tae Hyung Kim
dabd7b3bb5
Throw error on unexpected positional arguments (#130274)
This PR fixes ignoring when random positional arguments added to the
`flutter gen-l10n`.

So we are no longer able to call `flutter gen-l10n hello world` or
`flutter gen-l10n --format false`.

Fixes https://github.com/flutter/flutter/issues/118203
2023-07-10 12:12:23 -07:00
Victoria Ashworth
6c2023162f
Change resultBundlePath representation from File to Directory (#130156)
`resultBundlePath` is meant to be a directory. In the `xcodebuild --help`, it describes it as a directory: 
```
-resultBundlePath PATH     specifies the directory where a result bundle describing what occurred will be placed
```

This PR changes our usage of it from a file to a directory so that it gets deleted correctly between reruns.

Fixes https://github.com/flutter/flutter/issues/129954.
2023-07-10 17:47:51 +00:00
Chuan-Yen Chiang
0cb6a03d92
fix: duplicated Intellij IDE message when running flutter doctor (#129030)
This PR fixes the duplicated message from `flutter doctor` when install `Intellij IDE` from `JetBrains Toolbox`. 

The solution is based on the #98276. Add a function to skip the creation of the validator for `Mac` when the key word `JetBrainsToolboxApp` is in the `info.plist`.

Before: 
<img width="918" alt="Screenshot 2023-06-16 at 21 04 43" src="https://github.com/flutter/flutter/assets/3291319/2f5ef0c6-0d29-4d02-97ed-257f29965a1a">

After: 
<img width="924" alt="Screenshot 2023-06-16 at 21 13 15" src="https://github.com/flutter/flutter/assets/3291319/dcdca845-41a1-4896-a5ac-5bca724af676">

fix #98276
2023-07-08 00:35:53 +00:00
Caique Ribeiro de Oliveira
3f2d798bd6
Fix XCode download link (#129795)
<img width="919" alt="image" src="https://github.com/flutter/flutter/assets/42003129/4bc8c3b8-29af-4b98-9232-47a583523e3c">
I was installing Flutter and noticed that the download link for Xcode is incorrect. They might have changed it, but the current link doesn't exist.
2023-07-07 18:09:57 +00:00
Victoria Ashworth
6683468f0b
Add debugging for iOS startup test flakes (#130099)
Adding debugging for https://github.com/flutter/flutter/issues/129836.

Takes a screenshot when startup test takes too long (10 minutes).

Also, removes some old debugging and add new debugging message.
2023-07-07 16:49:00 +00:00
Helin Shiah
0b44577f16
Add new hot reload case string (#130008)
This change is for an internal IDE client to send a custom hot reload
request, as custom requests from the client must start with `$/`.

## 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. (this PR is linked internally)
- [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-07-05 15:16:33 -04:00
Piotr FLEURY
168d807734
Add .env file support for option --dart-define-from-file (#128668)
# Proposal

I suggest to make possible to specify .env files to the --dart-define-from-file in addition to the Json format.

# Issue

Close #128667
2023-07-05 16:35:08 +00:00
Nate Bosch
34c092f2b3
Remove an unnecessary assert (#129796)
The type variable `T`, when used as an expression, will always be a
`Type`. The type test `T is! List` is always true (as is `T is Type`).

This expression will become a warning in the analyzer in some upcoming
release of the Dart SDK.

This `assert` was added in a PR which reapplied an earlier PR, however
the earlier PR did not include this assert. I do not see any discussion
indicating the intent of this assert.

The impact of testing this `T` in any way is low - this is a private
class so we can see all the uses and know that the only type bound to
`T` is `Uri`. Avoid the upcoming diagnostic and remove the assert
entirely. This maintains existing behavior but ignores the potential
intent for the check.
2023-06-30 18:07:54 +00:00
Martin Kustermann
7068a2088e
Prepare for utf8.encode() to return more precise Uint8List type (#129769)
To avoid analyzer warnings when utf8.encode() will return the more
precise Uint8List type, we use const Utf8Encoder().convert() which
already returns Uint8List

See https://github.com/dart-lang/sdk/issues/52801
2023-06-29 22:44:57 +02:00
Tae Hyung Kim
ff838bca89
Add locale-specific DateTime formatting syntax (#129573)
Based on the [message format
syntax](https://unicode-org.github.io/icu/userguide/format_parse/messages/#examples)
for
[ICU4J](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/MessageFormat.html).
This adds new syntax to the current Flutter messageFormat parser which
should allow developers to add locale-specific date formatting.

## Usage example
```
  "datetimeTest": "Today is {today, date, ::yMd}",
  "@datetimeTest": {
    "placeholders": {
      "today": {
        "description": "The date placeholder",
        "type": "DateTime"
      }
    }
  }
```
compiles to
```
  String datetimeTest(DateTime today) {
    String _temp0 = intl.DateFormat.yMd(localeName).format(today);
    return 'Today is $_temp0';
  }
```

Fixes https://github.com/flutter/flutter/issues/127304.
2023-06-29 09:23:34 -07:00
Ben Konyi
5ea2be69ca
Reland "Fix issue where DevTools would not be immediately available when using --start-paused (#126698)" (#129368)
**Original Description:**

> Service extensions are unable to handle requests when the isolate they
were registered on is paused. The DevTools launcher logic was waiting
for some service extension invocations to complete before advertising
the already active DevTools instance, but when --start-paused was
provided these requests would never complete, preventing users from
using DevTools to resume the paused isolate.
> 
> Fixes https://github.com/flutter/flutter/issues/126691

**Additional changes in this PR:**

The failures listed in https://github.com/flutter/flutter/pull/128117
appear to be related to a shutdown race. It's possible for the test to
complete while the tool is in the process of starting and advertising
DevTools, so we need to perform a check of `_shutdown` in
`FlutterResidentDevtoolsHandler` before advertising DevTools.

Before the original fix, this check was being performed immediately
after invoking the service extensions, which creates an asynchronous gap
in execution. With #126698, the callsite of the service extensions was
moved and the `_shutdown` check wasn't, allowing for the tool to attempt
to advertise DevTools after the DevTools server had been cleaned up.

---------

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
2023-06-28 00:16:13 +05:30
Oleh Prypin
71228e02c6
Prepare for making intl toBeginningOfSentenceCase non-nullable (#127488)
I intend to edit `toBeginningOfSentenceCase`'s return value to be non-nullable because it really is never null. That will mean that non-null asserts around it will become flagged as unnecessary, although right now they are necessary. So, apply a workaround - instead use a function that does a non-null assert without triggering any lints even after it becomes unnecessary.
2023-06-23 03:25:45 +00:00
David Iglesias
34b42acf1b
[web] Hides that Flutter uses requireJS in debug. (#129032)
Flutter web uses requireJS in `debug` mode to assemble a DDC-compiled app from a bunch of small files ("modules").

This caused that `canvaskit.js` (and all other modules that used a browserify-like loading header) didn't work because they attempted to use the `define` function provided by Flutter's instance of `requireJS` (which kept the defined modules private, rather than as globals on the page, as the users of the JS expected).

A [fix](https://github.com/flutter/engine/pull/27342) was added to `flutter/engine` to trick loaders into *not* using the `requireJS` module loader, but a recent change in the fix's js-interop layer *subtly* changed its JS output on the page (objects went from `undefined` to `null`), causing this:

* https://github.com/flutter/flutter/issues/126131 (and others)

This PR hides a bit of code that is commonly used by module loaders to decide that they may use the `define` function provided by requireJS (so the engine workaround can be removed).

## Next steps

* https://github.com/flutter/engine/pull/42941

## Issues

Partially addresses: https://github.com/flutter/flutter/issues/126131 (and others)

## Tests

* Added a unit test to ensure the `delete` stays
* Manually tested with the Gallery app in `debug` mode with a bunch of user-supplied scripts that currently fail to load.
  * Also tested hot restart as suggested by @nshahan
2023-06-23 02:09:12 +00:00
Christopher Fujino
6f3b07811b
[flutter_tools] delete flutter format command (#129360)
On the current stable branch (3.10.x), `flutter format` no longer works, and gives an error. This change just deletes the code.

Fixes https://github.com/flutter/flutter/issues/115809
2023-06-22 21:28:55 +00:00
gmackall
51f659825e
Unpin path_provider_android (#129205)
Unpins path_provider_android where it is pinned. Follows the same steps as https://github.com/flutter/flutter/pull/128898.

Fixes https://github.com/flutter/flutter/issues/116376
2023-06-22 21:22:49 +00:00
Elias Yishak
18b94b7f57
Prevent crashes on range errors when selecting device (#129290)
Prevent the cli from crashing when a user selects a number that is not valid for `flutter run` device selection

Fixes issue:
- https://github.com/flutter/flutter/issues/129191

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-06-22 15:52:25 +00:00
Christopher Fujino
5cef69dd49
[flutter_tools] add a gradle error handler for could not open cache directory (#129222)
Works around part of https://github.com/flutter/flutter/issues/128866
2023-06-21 20:13:40 +00:00
Elias Yishak
5d8cc978b9
Refactor Analytics global getter to point to context only (#129196)
Refactor the globals getter for `Analytics` to be in the context instead of having a default fallback. The current state of the tool creates a new instance every time `globals.analytics` was called

Addresses issue:
- https://github.com/flutter/flutter/issues/128535
2023-06-21 15:27:32 +00:00
Victoria Ashworth
25e98b54d7
Fix duplicate devices from xcdevice with iOS 17 (#128802)
This PR fixes issue of duplicate entries from `xcdevice list` cause devices to not show in `flutter devices`, `flutter run`, etc.

When a duplicate entry is found, use the entry without errors as the authority. If both have errors, use the one with the higher SDK as the authority.

Fixes https://github.com/flutter/flutter/issues/128719.
2023-06-20 18:16:27 +00:00
Lau Ching Jun
3291750082
Use the new getIsolatePauseEvent method from VM service to check for pause event. (#128834)
The `getIsolate` method returns the full list of libraries which can be huge for large apps. Using the more speficic API to only fetch what we need improves hot reload performance.

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

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

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-06-20 16:42:28 +00:00
Christopher Fujino
3f68b25b46
[flutter_tools] fix cast error when dart-defines-json file includes null (#128909)
Fixes https://github.com/flutter/flutter/issues/128787
2023-06-16 18:12:22 +00:00
Danny Tuppeny
dc4541fa05
[flutter_tools] Add support for vmServiceFileInfo when attaching (#128503)
When building the new SDK DAPs, this functionality was missed from the Flutter adapter (but added to the Dart CLI adapter).

As well as passing a VM Service URI directly, we support passing a file that can be polled for it.

This uses the same mechanism we use to obtain the VM Service URI from a Dart debug session (we run `dart --write-service-info=foo.json my_file.dart` and then poll that file which the VM will write) and is useful for users that have their own mechanism for launching an app (for example using custom Flutter embedders - see https://github.com/Dart-Code/Dart-Code/issues/3353) to provide a VM Service URI once the app is up and running.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4577.
2023-06-16 18:00:21 +00:00
Dery Rahman Ahaddienata
6b5766d41e
Fix dart pub cache clean command on pub.dart (#128171)
Command instruction for clearing dart pub cache is somewhat wrong. Instead of `clear`, `clean` is the correct one. Ref: https://dart.dev/tools/pub/cmd/pub-cache

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

(Edited by @andrewkolos. Changed "related to" issue to "fixes" to link this PR to the issue).
2023-06-15 20:38:04 +00:00
Christopher Fujino
735fc29622
[flutter_tools] refactor license collector (#128748)
Improve debugging for https://github.com/flutter/flutter/issues/128680

In the linked issue, I cannot explain how we are getting a type error. However, this refactor eliminates the null check operator (by iterating over `MapEntries` rather than the keys) in hopes that there will be a more descriptive error in the future. The correctness of this change is verified by the existing tests in https://github.com/flutter/flutter/blob/master/packages/flutter_tools/test/general.shard/license_collector_test.dart
2023-06-15 20:25:19 +00:00
Ian Hickson
8c5a70f367
flutter update-packages --cherry-pick-package (#128917)
Fixes https://github.com/flutter/flutter/issues/101525
2023-06-15 19:26:53 +00:00
Christopher Fujino
3246808cd2
[flutter_tools] cache flutter sdk version to disk (#124558)
Fixes https://github.com/flutter/flutter/issues/112833

Most of the actual changes here are in [packages/flutter_tools/lib/src/version.dart](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605), while the rest is largely just addressing changes to the constructor of `FlutterVersion` which now has different dependencies.

This change makes `FlutterVersion` an interface with two concrete implementations:

1. `_FlutterVersionGit` which is mostly the previous implementation, and
2. `_FlutterVersionFromFile` which will read a new `.version.json` file from the root of the repo

The [`FlutterVersion` constructor](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605R70) is now a factory that first checks if `.version.json` exists, and if so returns an instance of `_FlutterVersionFromGit` else it returns the fallback `_FlutterVersionGit` which will end up writing `.version.json` so that we don't need to re-calculate the version on the next invocation.

`.version.json` will be deleted in the bash/batch entrypoints any time we need to rebuild he tool (this will usually be because the user did `flutter upgrade` or `flutter channel`, or manually changed the commit with git).
2023-06-15 00:20:30 +00:00
Arne Molland
6d2b5ea30e
Fix inconsistently suffixed macOS flavored bundle directory (#127997)
The current implementation of macOS flavor support (#119564) assumes a bundle directory that differs from both the iOS implementation and the official documentation. The [documentation](https://docs.flutter.dev/deployment/flavors) instructs developers to suffix their Xcode build configurations with `-<flavor>`, but the implementation assumes a space:

5fd9ef4240/packages/flutter_tools/lib/src/macos/application_package.dart (L174-L178)

Whereas the iOS implementation, which is the reference for the docs, assumes a `-<flavor>` suffix:

a257efc284/packages/flutter_tools/lib/src/ios/xcodeproj.dart (L482-L488)

This change replaces the empty space with the `-` character which is in line with the documentation and iOS implementation, as well as removing the sentence-casing applied to the flavor name; every bundle built with a flavor keeps the original flavor name in its filename.

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

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-06-14 23:43:17 +00:00
gmackall
944d6c8fef
Unpin flutter_plugin_android_lifecycle (#128898)
Unpins flutter_plugin_android_lifecycle where it is pinned. I then 
1. ran `flutter update-packages --force-upgrade` (but only committed the changes within `dev/integration_tests/gradle_deprecated_settings/`, which is where it had been pinned) 
2. followed by `./gradlew :generateLockfiles` from `dev/integration_tests/gradle_deprecated_settings/android/` (the lockfile was what was causing the CI dependency resolution failure, so this second step is the fix for that).

See the reason it was pinned: https://github.com/flutter/flutter/pull/121847#discussion_r1124797112 followed by the PR that pinned it: https://github.com/flutter/flutter/pull/122043

Fixes https://github.com/flutter/flutter/issues/122039
2023-06-14 20:58:37 +00:00
Christopher Fujino
d499533602
[flutter_tools] Suppress git output in flutter channel (#128475)
Fixes https://github.com/flutter/flutter/issues/128025
2023-06-13 19:28:06 +00:00
Jonah Williams
9af6bae6b9
[flutter_tools] pass through enable impeller flag to macOS. (#128720)
Allow passing through the --enable-impeller flag to macOS.
2023-06-12 20:56:59 +00:00
Andrew Kolos
cfe4fedca2
rename generated asset manifest file back to AssetManifest.bin (from AssetManifest.smcbin) (#128529)
Closes https://github.com/flutter/flutter/issues/128456, which is now linked to in a code comment in this change.
Reopens https://github.com/flutter/flutter/issues/124883.

This effectively reverts https://github.com/flutter/flutter/pull/126077 and is intended to be cherry-picked into stable.
2023-06-09 21:20:50 +00:00
William Hesse
0d39f6466d
[testing] Make the FLUTTER_STORAGE_BASE_URL warning non-fatal (#128335)
Presubmit testing and CI testing of Flutter using a custom storage location for engine artifacts must be able to use the --fatal-warnings flag without failing due to the custom artifact location.

This change adds an option that makes this warning non-fatal. The new --no-fatal-storage-url-warning flag makes the --fatal-warnings flag ignore the warning that a custom artifact download URL is being used by setting the environment variable FLUTTER_STORAGE_BASE_URL.

Bug: #127683

- [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 `///`).
2023-06-09 11:06:13 +00:00
Danny Tuppeny
46007d61d2
[flutter_tools] [DAP] Don't try to restart/reload if app hasn't started yet (#128267)
The editor is set to hot-reload-on-save by default so saving while the debug session is starting currently prints an error:

Failed to Hot Reload: app 'null' not found

![image](https://github.com/flutter/flutter/assets/1078012/a125b455-a46d-4993-98d8-5d8ae7237a00)

This change skips the call to `app.restart` if the app hasn't started yet to avoid printing an error.
2023-06-09 09:41:07 +00:00
Christopher Fujino
0d95243fb2
[flutter_tools] Precache after channel switch (#118129)
Fixes https://github.com/flutter/flutter/issues/44118
2023-06-09 01:46:24 +00:00
Tess Strickland
840d7dd68a
Use --target-os for appropriate precompiled targets. (#127567)
This PR adds uses of the `--target-os` command line argument when
building kernel sources for precompiled applications for supported
target operating systems. The Dart CFE then:

* treats `Platform.operatingSystem` as if it were defined as the
constant string provided as an argument to the flag,
* treats `Platform.pathSeparator` as the appropriate separator for that
operating system,
* attempts to constant evaluate the initializer for any field annotated
with the `vm:platform-const` pragma, and
* attempts to constant evaluate all calls to a method annotated with the
`vm:platform-const` pragma.

The `vm:platform-const` pragma can appear in either library or user
code. If the attempt to constant evaluate the field initializer or
method call fails, then an error is thrown at kernel compilation time.

Addresses #14233.

The tests in
`packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart`
have been adjusted properly to account for the new passed command line
arguments.
2023-06-08 13:17:18 +02:00
chunhtai
5328bd9ae0
Adds vmservices to retrieve android applink settings (#125998)
fixes https://github.com/flutter/flutter/issues/120408

Added two gradle tasks, one for grabing the application id, one for grabbing app link domains.

Added a new vmservices to call these two gradle tasks and return the result.

The expected work flow is that the devtool will first call a vmservices to grab all avaliable build variants. It will then choose one of the build variant and call this new services to get application id and app link domains.
2023-06-07 22:43:11 +00:00
Alexander Aprelev
09c0706734
Roll engine, patch expression evaluation (#128255)
Roll to engine to 4f4486b00be28183b482bbb74bbed25f4db153fe  pick up dart to 3.1.0-169.0.dev.
Changes since last roll
```
4f4486b00b Roll dart to 3.1.0-169.0.dev (#42602)
```

Manual roll since rolling to dart 3.1.0-169.0.dev requires patching to expression evaluation in flutter tools
2023-06-07 19:48:42 +00:00
Andrew Kolos
96afa500db
[tools] allow explicitly specifying the JDK to use via a new config setting (#128264)
Closes https://github.com/flutter/flutter/issues/106416.

This PR adds a new `flutter config` setting named `jdk-dir`. When set, the tool will use the JDK found at this location for all Java-dependent tool operations such as building Android apps via gradle and running Android SDK tools.
2023-06-07 04:52:17 +00:00
Andrew Kolos
759ebef689
Do not try to load main/default asset image if only higher-res variants exist (#128143)
Fixes https://github.com/flutter/flutter/issues/127090.

https://github.com/flutter/flutter/pull/122505 did a few things to speed up the first asset load that a flutter app performs. One of those things was to not include the main asset in its own list of variants in the asset manifest. The idea was that we know that the main asset always exists, so including it in its list of variants is a waste of storage space and loading time (even if the cost was tiny).

However, the assumption that the main asset always exists is wrong. From [Declaring resolution-aware image assets](https://docs.flutter.dev/ui/assets-and-images#resolution-aware), which predates https://github.com/flutter/flutter/pull/122505:

> Each entry in the asset section of the pubspec.yaml should correspond to a real file, with the exception of the main asset entry. If the main asset entry doesn’t correspond to a real file, then the asset with the lowest resolution is used as the fallback for devices with device pixel ratios below that resolution. The entry should still be included in the pubspec.yaml manifest, however.

For example, it's valid to declare `assets/image.png` as an asset even if only `assets/3x/image.png` exists on disk.

This fix restores older behavior of including a main asset as a variant of itself in the manifest if it exists.

This fix also includes a non-user-visible behavior change:
* `"dpr"` is no longer a required field in the asset manifest's underlying structure. For the main asset entry, we do not include `"dpr"`. It makes less sense for the tool to decide what the default target dpr for an image should be. This should be left to the framework.
2023-06-07 03:19:15 +00:00
Christopher Fujino
44e7206aa1
[flutter_tools] never tree shake 0x20 (space) font codepoints on web (#128302)
Always pass the space code point (`0x20`) to the font subsetter when targetting web because the web engine relies on that character to calculate a font's height.

Fixes #127270
2023-06-06 21:06:15 +00:00
Victoria Ashworth
cd18c8c02f
Workaround for Dart VM timeout (#127875)
Workaround solution for: https://github.com/flutter/flutter/issues/121231
See https://github.com/flutter/flutter/issues/120808#issuecomment-1551826299 Error Case 2 for more information.

Sometimes the `ios-deploy` process does not return the logs from the application. We've been unable to figure out why. This is a solution to workaround that by using `idevicesyslog` alongside `ios-deploy` as a backup in getting the log for the Dart VM url. As explained in https://github.com/flutter/flutter/issues/120808#issuecomment-1551826299, when error case 2 happens, the `idevicesyslog` does successfully find the Dart VM.

Also, in the comments of the code it mentions `syslog` is not written on iOS 13+, this was added in response to this issue: https://github.com/flutter/flutter/issues/41133.

However, `idevicesyslog` does in fact work (at least for iOS 16), we use it to collect device logs for our CI tests already: 1dc26f80f0/dev/devicelab/lib/framework/devices.dart (L998-L1006)
2023-06-02 17:17:57 +00:00
Michael Goderbauer
95cd3c0340
Make --flutter-repo analyze whole repo (#127990)
Fixes https://github.com/flutter/flutter/issues/127989.
2023-06-02 17:17:54 +00:00
Zachary Anderson
fdb71de7a0
Revert "Fix issue where DevTools would not be immediately available when using --start-paused" (#128117)
Reverts flutter/flutter#126698

There are a bunch of tool crashes on CI that start with this commit. I'm
not sure this PR is the cause because there is no backtrace from the
tool on the crashes. The only error message is `Oops; flutter has exited
unexpectedly: "Null check operator used on a null value`.
2023-06-02 07:31:07 -07:00
Ben Konyi
35174cc2b7
Fix issue where DevTools would not be immediately available when using --start-paused (#126698)
Service extensions are unable to handle requests when the isolate they were registered on is paused. The DevTools launcher logic was waiting for some service extension invocations to complete before advertising the already active DevTools instance, but when --start-paused was provided these requests would never complete, preventing users from using DevTools to resume the paused isolate.

Fixes https://github.com/flutter/flutter/issues/126691
2023-06-01 22:35:02 +00:00
Andrew Kolos
13db2e4a76
[tool] In flutter doctor -v, warn when Android Studio version could not be detected. (#126395)
Fixes #122081.

When validating an Android Studio installation, add a warning validation message when we are unable to detect the version. This is because we have logic throughout the tool (JDK/JRE-searching) that is at higher risk of failing when we don't know the version.
2023-06-01 14:51:30 +00:00
Andrew Kolos
06e2b18173
[tools] use Java class for all java-searching behavior (#127354)
Fixes #124252, finishing work on the umbrella tracking issue, #126126.

Essentially, after this PR, no (non-test) code should be be referencing/invoking the java home or binary paths.
2023-06-01 04:19:19 +00:00
Loïc Sharma
071ea49248
[Windows] Address feedback for show window comment (#127998)
Address Tong's feedback here: https://github.com/flutter/flutter/issues/127695#issuecomment-1564884872

Follow-up to: https://github.com/flutter/flutter/pull/127046
2023-05-31 23:42:54 +00:00
Tae Hyung Kim
5596a0cdab
Fix gen-l10n format: true so that it applies to when it gets called via build target (#127886) 2023-05-31 15:25:54 -07:00
Nate Bosch
0b9cd86546
Remove more test_api/src imports (#127716)
Replace imports of `src/remote_listener.dart` with `backend.dart` which exports `RemoteListener`.

Remove the unused imports of `src/backend/stack_trace_formatter.dart` (no uses of `StackTraceFormatter`) and
`src/backend/suite_channel_manager.dart` (no uses of `SuiteChannelManager`).
2023-05-26 23:47:35 +00:00
Phil Quitslund
5bf6318688
Update collection-fors to prefer final (as per updated prefer_final_in_for_each) (#127511)
The newly updated lint will soon flag for-each in collections.

See discussion: https://github.com/dart-lang/linter/pull/4383

/cc @goderbauer
2023-05-26 23:34:36 +00:00
Victoria Ashworth
8e6a9e3a9e
Revert "Log all lines from ios-deploy (#127502)" (#127684)
This reverts commit a19b3436ee.

We added this logging to try and determine if the reason for Dart VM errors (https://github.com/flutter/flutter/issues/121231) was caused by some issue with the streams.
A recent test proves that is not the case:
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20platform_view_ios__start_up/11046/overview
The test shows the Dart VM url in the device log. However, the test log does NOT show a log for the Dart VM url but does show the stack trace, which all come from the main stream, which means it's not an issue with the secondary streams not receiving the log.

So reverting the debugging we added.
2023-05-26 20:11:54 +00:00
Victoria Ashworth
a19b3436ee
Log all lines from ios-deploy (#127502)
Reland https://github.com/flutter/flutter/pull/127222 that was reverted in https://github.com/flutter/flutter/pull/127405.

Fixed `Mac_ios microbenchmarks_ios` test failure by not echoing logs twice.
2023-05-24 19:46:16 +00:00
Victoria Ashworth
555326b228
Revert "Replace rsync when unzipping artifacts on a Mac (#126703)" (#127430)
This reverts commit 2b3cd7f4d9.

Fixes https://github.com/flutter/flutter/issues/127281.
2023-05-24 19:21:05 +00:00
Ian Hickson
9c7a9e779f
Give channel descriptions in flutter channel, use branch instead of upstream for channel name (#126936)
## How we determine the channel name

Historically, we used the current branch's upstream to figure out the current channel name. I have no idea why. I traced it back to https://github.com/flutter/flutter/pull/446/files where @abarth implement this and I reviewed that PR and left no comment on it at the time.

I think this is confusing. You can be on a branch and it tells you that your channel is different. That seems weird.

This PR changes the logic to uses the current branch as the channel name.

## How we display channels

The main reason this PR exists is to add channel descriptions to the `flutter channel` list:

```
ianh@burmese:~/dev/flutter/packages/flutter_tools$ flutter channel
Flutter channels:
  master (tip of tree, for contributors)
  main (tip of tree, follows master channel)
  beta (updated monthly, recommended for experienced users)
  stable (updated quarterly, for new users and for production app releases)
* foo_bar

Currently not on an official channel.
ianh@burmese:~/dev/flutter/packages/flutter_tools$
```

## Other changes

I made a few other changes while I was at it:

* If you're not on an official channel, we used to imply `--show-all`, but now we don't, we just show the official channels plus yours. This avoids flooding the screen in the case the user is on a weird channel and just wants to know what channel they're on.
* I made the tool more consistent about how it handles unofficial branches. Now it's always `[user branch]`.
* I slightly adjusted how unknown versions are rendered so it's clearer the version is unknown rather than just having the word "Unknown" floating in the output without context.
* Simplified some of the code.
* Made some of the tests more strict (checking all output rather than just some aspects of it).
* Changed the MockFlutterVersion to implement the FlutterVersion API more strictly.
* I made sure we escape the output to `.metadata` to avoid potential injection bugs (previously we just inlined the version and channel name verbatim with no escaping, which is super sketchy).
* Tweaked the help text for the `downgrade` command to be clearer.
* Removed some misleading text in some error messages.
* Made the `.metadata` generator consistent with the template file.
* Removed some obsolete code to do with the `dev` branch.

## Reviewer notes

I'm worried that there are implications to some of these changes that I am not aware of, so please don't assume I know what I'm doing when reviewing this code. :-)
2023-05-23 19:59:20 +00:00
Christopher Fujino
11cb29174f
[flutter_tools] delete entitlements files after copying to macos build dir (#127417)
Fixes https://github.com/flutter/flutter/issues/126705

Follow up fix after https://github.com/flutter/flutter/pull/126875 did NOT work.
2023-05-23 19:12:11 +00:00
Victoria Ashworth
d452ce9635
Revert "Log all output of ios-deploy" (#127405)
Reverts flutter/flutter#127222
2023-05-23 16:37:36 +00:00
Victoria Ashworth
7fa45ea486
Log all output of ios-deploy (#127222)
Log all output of `ios-deploy` to try and determine if the issue of https://github.com/flutter/flutter/issues/121231 is with stream or with `ios-deploy`.

Note: This will cause some duplicate logs like example below but only in verbose mode

```
(lldb) 2023-05-19 13:48:19.107935-0500 Runner[2521:390363] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(35)] Using the Impeller rendering backend.
(lldb) 2023-05-19 13:48:19.107935-0500 Runner[2521:390363] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(35)] Using the Impeller rendering backend.
2023-05-19 13:48:19.156866-0500 Runner[2521:390612] flutter: The Dart VM service is listening on http://127.0.0.1:63508/IsFnhXJykCM=/
VM Service URL on device: http://127.0.0.1:63508/IsFnhXJykCM=/
```
2023-05-23 15:25:10 +00:00
Jackson Gardner
758ea6c096
Fix wasm-opt location when using local_web_sdk (#127355)
We were looking up the wrong path for `wasm-opt` previously when using the `local-web-sdk` flag.
2023-05-22 23:08:11 +00:00
LouiseHsu
e345a830ba
Show warning when attempting to flutter run on an ios device with developer mode turned off (#125710)
This PR adds a warning when a user attempt to `flutter run -d <device id>` on a device without developer mode enabled.
<img width="738" alt="Screenshot 2023-05-09 at 3 53 18 AM" src="https://github.com/flutter/flutter/assets/36148254/6f473a6a-5a0d-438b-9e6f-06d09eb1f3a9">

Also handles multiple partial matches.
<img width="788" alt="Screenshot 2023-05-09 at 3 52 24 AM" src="https://github.com/flutter/flutter/assets/36148254/60c82b3c-d501-4a01-95ad-d6309fe39576">

Fixes https://github.com/flutter/flutter/issues/111988
2023-05-22 22:06:15 +00:00
Ian Hickson
487ed57388
Suggest that people move to "beta" when they upgrade on "master" (#127146)
Similar to https://github.com/flutter/flutter/pull/126972 but for master
upgrades.

Co-authored-by: Tim Sneath <timsneath@google.com>
2023-05-22 15:03:14 -07:00
Christopher Fujino
7e1a0d4086
[flutter_tools] delete entitlements files after copying to macos build dir (#126875)
Fixes https://github.com/flutter/flutter/issues/126705
2023-05-22 20:00:39 +00:00
Andrew Kolos
80a4f9b159
Reland "[tool] Move Java functions to their own file" (#126577)
Relands #126086, which was reverted by #126569.
2023-05-20 06:29:21 +00:00
Loïc Sharma
ce61eda70c
[Windows] Ensure window is shown (#127046)
## Background

The Windows runner has a race at startup:

1. **Platform thread**: creates a hidden window
2. **Platform thread**: launches the Flutter engine
3. **UI/Raster threads**: renders the first frame
4. **Platform thread**: Registers a callback to show the window once the next frame has been rendered.

Steps 3 and 4 happen in parallel and it is possible for step 3 to complete before step 4 starts. In this scenario, the next frame callback is never called and the window is never shown.

As a result the `windows_startup_test`'s test, which [verifies that the "show window" callback is called](1f09a8662d/dev/integration_tests/windows_startup_test/windows/runner/flutter_window.cpp (L60-L64)), can flake if the first frame is rendered before the show window callback has been registered.

## Solution

This change makes the runner schedule a frame after it registers the next frame callback. If step 3 hasn't completed yet, this no-ops as a frame is already scheduled. If step 3 has already completed, a new frame will be rendered, which will call the next frame callback and show the window.

Part of https://github.com/flutter/flutter/issues/119415

See this thread for alternatives that were considered: https://github.com/flutter/engine/pull/42061#issuecomment-1550080722
2023-05-19 22:25:55 +00:00
Phil Quitslund
d0c0439b8d
fixes to anticipate next Dart linter release (#127211)
The upcoming linter release notices null literals as unnecessary argument values and flags more `type_literal_in_constant_pattern` cases. 

See breakages: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8780744067138629361/+/u/analyze_flutter_flutter/stdout
2023-05-19 21:27:24 +00:00
Christopher Fujino
e310475fc7
[flutter_tools] only try to take a screenshot from flutter drive if the --screenshot flag is passed (#127150)
Fixes https://github.com/flutter/flutter/issues/123621
2023-05-19 19:14:17 +00:00
Chris Yang
972b447434
[tool] delete xcresult bundle file before each xcode retry. (#127144)
xcodebuild command generates a xcresult bundle file on each run, however, it doesn't delete the file generated from previous run and will throw an error if the exact file already exists.

In tool, we manually delete the file after each `flutter build` or `flutter run` command. However, there are some internal logic where xcodebuild retries multiple times. 

This PR deletes the xcresult bundle file at the start of each retry if it exists.

Fixes https://github.com/flutter/flutter/issues/127119
2023-05-19 17:18:15 +00:00
Victoria Ashworth
b9e8b0a827
[iOS] Dispose of log readers and port forwarders if launch fails (#127140)
When tests run in our CI using `flutter drive`, if there is a failure it will loop and try again.

434b81f1a5/packages/flutter_tools/lib/src/drive/drive_service.dart (L177-L186)

However, it's using the same `device` instance for each iteration. So what was happening was when it would fail to launch, it would tell its listeners that it was cancelled.
434b81f1a5/packages/flutter_tools/lib/src/ios/ios_deploy.dart (L486-L489) 

Then when the next iteration started, the `vmServiceDiscovery` would immediately return with null because the `deviceLogReader` would be cached from the previous iteration and would already be cancelled. Therefore, bypassing and cancelling the timer.

434b81f1a5/packages/flutter_tools/lib/src/ios/devices.dart (L585-L591)

434b81f1a5/packages/flutter_tools/lib/src/ios/devices.dart (L627)

In addition, it seems like sometimes the stop would fail and therefore the the drain would never get the signal that it was done and therefore would hang forever. There was no indication that the stop had failed though because the logs were going to the stream that had no listeners since `deviceLogReader` was already cancelled.
434b81f1a5/packages/flutter_tools/lib/src/ios/ios_deploy.dart (L563-L576)

Fixes https://github.com/flutter/flutter/issues/127141
2023-05-19 16:44:58 +00:00