Commit Graph

4899 Commits

Author SHA1 Message Date
Daco Harkes
aa36db1d29
Native assets support for MacOS and iOS (#130494)
Support for FFI calls with `@Native external` functions through Native assets on MacOS and iOS. 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 MacOS and iOS.

Dylibs are bundled by (1) making them fat binaries if multiple architectures are targeted, (2) code signing these, and (3) copying them to the frameworks folder. These steps are done manual rather than via CocoaPods. CocoaPods would have done the same steps, but (a) needs the dylibs to be there before the `xcodebuild` invocation (we could trick it, by having a minimal dylib in the place and replace it during the build process, that works), and (b) can't deal with having no dylibs to be bundled (we'd have to bundle a dummy dylib or include some dummy C code in the build file).

The dylibs are build as a new target inside flutter assemble, as that is the moment we know what build-mode and architecture to target.

The mapping from asset id to dylib-path is passed in to every kernel compilation path. The interesting case is hot-restart where the initial kernel file is compiled by the "inner" flutter assemble, while after hot restart the "outer" flutter run compiled kernel file is pushed to the device. Both kernel files need to contain the mapping. The "inner" flutter assemble gets its mapping from the NativeAssets target which builds the native assets. The "outer" flutter run get its mapping from a dry-run invocation. Since this hot restart can be used for multiple target devices (`flutter run -d all`) it contains the mapping for all known targets.

### Example vs template

The PR includes a new template that uses the new native assets in a package and has an app importing that. Separate discussion in: https://github.com/flutter/flutter/issues/131209.

### Tests

This PR adds new tests to cover the various use cases.

* dev/devicelab/bin/tasks/native_assets_ios.dart
  * Runs an example app with native assets in all build modes, doing hot reload and hot restart in debug mode.
* dev/devicelab/bin/tasks/native_assets_ios_simulator.dart
  * Runs an example app with native assets, doing hot reload and hot restart.
* packages/flutter_tools/test/integration.shard/native_assets_test.dart
  * Runs (incl hot reload/hot restart), builds, builds frameworks for iOS, MacOS and flutter-tester.
* packages/flutter_tools/test/general.shard/build_system/targets/native_assets_test.dart
  * Unit tests the new Target in the backend.
* packages/flutter_tools/test/general.shard/ios/native_assets_test.dart
* packages/flutter_tools/test/general.shard/macos/native_assets_test.dart
  * Unit tests the native assets being packaged on a iOS/MacOS build.

It also extends various existing tests:

* dev/devicelab/bin/tasks/module_test_ios.dart
   * Exercises the add2app scenario.
* packages/flutter_tools/test/general.shard/features_test.dart
   * Unit test the new feature flag.
2023-09-10 08:07:13 +00:00
chunhtai
f851e7faf0
Add ios analyzer command for universal links (#134155)
ios version of https://github.com/flutter/flutter/pull/131009/files
2023-09-08 19:22:44 +00:00
Christopher Fujino
195dca02c0
[flutter_tools] Fix "FormatException: Invalid date format" during version freshness check (#134088)
Fixes https://github.com/flutter/flutter/issues/134067
2023-09-06 17:22:13 +00:00
Victoria Ashworth
6c5642167f
Retry connecting to device in CI after lost connection (#133769)
Sometimes `ios-deploy` loses connection to the device after installing, starting debugserver, and launching. This is shown with an error message like:
```
Process 579 exited with status = -1 (0xffffffff) lost connection
```
This happens frequently in our CI system: https://github.com/flutter/flutter/issues/120808

Usually in CI, on retry it'll work and pass - so this is an attempt to retry without failing the test first. It's not guaranteed to fix since we're unable to recreate this error locally.
2023-09-05 21:48:50 +00:00
Christopher Fujino
85bece2689
[flutter_tools] Fix TypeError when a FileSystemException happens during flutter doctor (#133373)
Fixes https://github.com/flutter/flutter/issues/133086
2023-09-05 18:00:07 +00:00
Christopher Fujino
33210218ba
[flutter_tools] Fix flutter upgrade not finding git tags (#133778)
Fixes https://github.com/flutter/flutter/issues/133441
2023-08-31 22:01:10 +00:00
chunhtai
0b3b8cd551
Removes ios universal link vmservices and let xcodeproject to dump js… (#133709)
…on file

The deeplink validation tool will become an static app so it can't no longer access vm services.

The goal will be then to turn them into flutter analyze command similar to `flutter analyze --android --[options]` that static app can use on.

This pr only removes vm services and turn the api to dump a output file instead of printing everything to stdout.
2023-08-31 21:50:54 +00:00
Loïc Sharma
b4753c328d
Improve doctor output on incomplete Visual Studio installation (#133390)
Flutter doctor warns if the user is updating Visual Studio or has paused
a Visual Studio update. The current output recommends reinstalling
Visual Studio. This is unnecessary as the user should be able to use the
Visual Studio Installer app to complete the installation:


![image](https://github.com/flutter/flutter/assets/737941/49547413-ece1-4214-a971-f512bc39419f)

This message is covered by this existing test:


229b74d987/packages/flutter_tools/test/general.shard/windows/visual_studio_validator_test.dart (L68-L81)

## 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-08-31 14:37:46 -07:00
Christopher Fujino
1519553bed
[flutter_tools] print out the unzipping method used by update_dart_sdk.ps1 (#133364)
in case there are future issues with unzipping the dart sdk, such as https://github.com/flutter/flutter/issues/132592, we should log out what tool we are using to try to extract the archive.
2023-08-31 21:06:47 +00:00
Pierrick Bouvier
792e26df95
[Windows] Add target architecture to build path (#131843)
To implement windows-arm64 support, it is needed to add architecture as a subdirectory (https://github.com/flutter/flutter/issues/129805).

In short, when performing a flutter windows build, we have:
- Before: build/windows/runner/Release/gallery.exe
- After: build/windows/x64/runner/Release/gallery.exe

This convention follows what flutter linux build does.

Addresses: https://github.com/flutter/flutter/issues/129805
Addresses: https://github.com/flutter/flutter/issues/116196

Design doc: [flutter.dev/go/windows-arm64](https://flutter.dev/go/windows-arm64)
2023-08-31 09:09:02 -07:00
Ian Hickson
89310edaa2
Use a fake stopwatch to remove flakiness. (#133229)
Fixes https://github.com/flutter/flutter/issues/133215
2023-08-29 12:49:33 -07:00
Lau Ching Jun
22a61b947f
Allow passing verbose log from flutter daemon. (#132828)
It would be helpful for debugging if we can choose to also receive remote verbose logs.
2023-08-25 04:26:56 +00:00
Ian Hickson
d6bf1447f4
Update the tool to know about all our new platforms (#132423)
...and add a test so we remember to keep it in sync.
2023-08-24 21:54:59 +00:00
Andrew Kolos
e1967ecabf
handle exceptions raised while searching for configured android studio (#133180)
Fixes #133055
2023-08-24 17:36:19 +00:00
Christopher Fujino
12cf9de68b
Fix mac tool_integration_tests with Xcode 15 (#133217)
Fixes https://github.com/flutter/flutter/issues/132990
2023-08-24 17:03:17 +00:00
chunhtai
4930613999
Add android analyzer commands for applinks (#131009)
Since applink validation tool is going to be a static tool, It won't have access to vmservices.

[flutter.dev/go/static-tooling-in-devtools](http://flutter.dev/go/static-tooling-in-devtools)

I remove the vm services and also update the deeplink task to also include path pattern and custom scheme
http://go/android-applink-apis (internal only)
2023-08-23 21:11:51 +00:00
Christopher Fujino
9e59a68c98
[flutter_tools] Fix legacy version file not being ensured (#133097)
Fixes https://github.com/flutter/flutter/issues/133093

When I introduced the new, more robust version file `//flutter/bin/cache/version.json` in https://github.com/flutter/flutter/pull/124558, I changed `class FlutterVersion` into an abstract interface, implemented by `_FlutterVersionFromGit` (which is essentially the previous behavior) and `_FlutterVersionFromFile`, which merely reads the data it would have computed via git from `//flutter/bin/cache/version.json`.

While doing this, I made `_FlutterVersionFromGit.ensureVersionFile()` to be a no-op, since I assumed this would not be necessary since we already had a version file in the cache. However, this method was what was previously responsible for ensuring `//flutter/version` existed on disk. This means that if, for whatever reason, the user had `//flutter/bin/cache/flutter.version.json` present but NOT `//flutter/version`, the tool would have never created that file, and they would hit the tool crash seen in https://github.com/flutter/flutter/issues/133093.

This fixes the tool by ensuring `//flutter/version` exists regardless of if we're hydrating `FlutterVersion` from `//flutter/bin/cache/flutter.version.json` or not.
2023-08-23 18:31:06 +00:00
Ian Hickson
487bd69078
Support disabling animations in the CLI (#132239) 2023-08-23 03:35:22 +00:00
Matan Lurey
a021015ef6
Always require --local-engine-host if --local-engine (#133003)
Closes #132245.
2023-08-22 01:32:14 +00:00
Jackson Gardner
6f227c0784
Space character should be optional when tree shaking fonts (#132880)
Addresses the other part of https://github.com/flutter/flutter/issues/132711
2023-08-19 02:04:15 +00:00
chunhtai
61242fa13b
Updates app link gradle tasks and remove vm services (#131805)
1. Remove vm service registration
2. combine print<variant>ApplicationId and print<variant>AppLinkDomain into one task dump<variant>AppLinkSettings, which dump all the data in a json file

The deeplink validation tool will be a static app in devtool instead of regular app. A Static app doesn't require a running app; therefore, we can't call these API through vmservices. I decided to convert these API into flutter analyzer command, which will be done in a separate PR https://github.com/flutter/flutter/pull/131009.

The reason these print tasks are converted into file dumps is to reduce the amount of data encoding and decoding. Instead of passing data through stdout, the devtool can read the files generated by gradle tasks instead.
2023-08-18 18:42:58 +00:00
Victoria Ashworth
b52297da06
Fix Xcode 15 build failure due to DT_TOOLCHAIN_DIR (#132803)
Starting in Xcode 15, when building macOS, DT_TOOLCHAIN_DIR cannot be used to evaluate LD_RUNPATH_SEARCH_PATHS or LIBRARY_SEARCH_PATHS. `xcodebuild` error message recommend using TOOLCHAIN_DIR instead.

Since Xcode 15 isn't in CI, I tested it in a one-off `led` test:
* [Pre-fix failure](04e485a0b1/+/build.proto)
* [Post-fix success](d454a3e181/+/build.proto)

Fixes https://github.com/flutter/flutter/issues/132755.
2023-08-18 15:24:55 +00:00
Tae Hyung Kim
312ef54115
[flutter_tools] Generate localizations on flutter pub get (#132172)
Currently, flutter pub get generates localizations if there exists an l10n.yaml file where synthetic-package is not false. However, for any user who needs to turn off synthetic-package, their localizations are not generated. This PR should make the behavior more consistent. (Also it seems good to make it so that running flutter pub get once resolves all the dependencies so that people can get to work without running flutter gen-l10n manually.)

Fixes https://github.com/flutter/flutter/issues/84979.
2023-08-18 15:01:09 +00:00
Navaron Bracke
03664d0acb
Fix description in index.html / manifest.json getting double quoted (#131842)
This PR adjusts the quoting of the project description not not apply twice in the index.html / manifest.json of web builds.

*List which issues are fixed by this PR. You must list at least one issue.*
Fixes https://github.com/flutter/flutter/issues/131834

*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-08-18 02:58:20 +00:00
Jason Simmons
579991cbb3
Fix the name of the local-engine-host flag in the warning message (#132808) 2023-08-18 00:11:57 +00:00
Loïc Sharma
9e67e0e4a1
[Windows] Allow overwriting the cache's Dart SDK archive license file… (#132777)
Relands https://github.com/flutter/flutter/pull/132669 after it was reverted by https://github.com/flutter/flutter/pull/132773. The test failures were fixed separately by https://github.com/flutter/flutter/pull/132766

Tracking issue: https://github.com/flutter/flutter/issues/132592
Cherrypick issue: https://github.com/flutter/flutter/issues/132718
2023-08-17 18:45:18 +00:00
yaakovschectman
e10d74b4d5
Revert "[Windows] Allow overwriting the cache's Dart SDK archive license file" (#132773)
Reverts flutter/flutter#132669

Introduced failure on `windows/mac/linux framework_library_tests`.

```
05:41 +7318 ~22 -1: /b/s/w/ir/x/w/flutter/packages/flutter/test/material/menu_bar_theme_test.dart: (tearDownAll) [E]                                                                                   
  Expected: leak free
    Actual: <Instance of 'Leaks'>
     Which: contains leaks:
            # The text is generated by leak_tracker.
            # For leak troubleshooting tips open:
            # https://github.com/dart-lang/leak_tracker/blob/main/doc/TROUBLESHOOT.md
            notDisposed:
              total: 3
              objects:
                ValueNotifier<_OverlayEntryWidgetState?>:
                  test: Constructor parameters override theme parameters
                  identityHashCode: 407433615
                FocusScopeNode:
                  test: Constructor parameters override theme parameters
                  identityHashCode: 513181650
                FocusScopeNode:
                  test: Constructor parameters override theme parameters
                  identityHashCode: 704743556
            
  package:matcher                                                                   expect
  package:flutter_test/src/widget_tester.dart 458:18                                expect
  package:leak_tracker_flutter_testing/src/leak_tracking_flutter_testing.dart 81:5  _tearDownTestingWithLeakTracking
  ===== asynchronous gap ===========================
  dart:async                                                                        _CustomZone.registerBinaryCallback
  package:leak_tracker_flutter_testing/src/leak_tracking_flutter_testing.dart 59:9  configureLeakTrackingTearDown.<fn>
```
2023-08-17 17:26:17 +00:00
Loïc Sharma
7ee864ee37
[Windows] Allow overwriting the cache's Dart SDK archive license file (#132669)
https://github.com/flutter/engine/pull/43974 added a license file to the Dart SDK's ZIP archive. As a result, extracting the Dart SDK now needs to overwrite the cache's `LICENSE.dart_sdk_archive.md` file.

This is a short-term solution that will be cherry-picked for the next [3.14 beta release](https://github.com/flutter/flutter/issues/132267). Addresses https://github.com/flutter/flutter/issues/132592.

The long-term solution is tracked by https://github.com/flutter/flutter/issues/132702
2023-08-17 16:08:08 +00:00
Matan Lurey
b66878a61e
Treat missing --local-engine-host as fatal on CI-like systems. (#132707)
Partial work towards https://github.com/flutter/flutter/issues/132245.

The goal here is to "sniff" out any missing pieces that would block engine builds, rolls, benchmarks and so on before requiring humans to provide the parameter. The implementation is based on a [short discussion with @christopherfujino](https://discord.com/channels/608014603317936148/608022056616853515/1141503921546875110):

@matanlurey:

> Not sure whether to post here or ⁠hackers-infra-🌡 , but is there a way to (and is it advisable to) detect whether the tool is running in a CI environment? I'd like to "soft enforce" --local-engine-host being provided strictly on CI, make sure that lands well, and then "upgrade" it to being non-CI invocations as well (re: https://github.com/flutter/flutter/issues/132245).
>
> Also happy to get talked out of this idea 🙂

@christopherfujino:

> we have a check, lemme find it
> whether or not it is advisable, idk
> https://github.com/flutter/flutter/blob/flutter-3.14-candidate.0/packages/flutter_tools/lib/src/base/bot_detector.dart#L30
>
> (...)
>
> is your desire to get early signal before enforcing t his for humans to prevent functionality churn of landing and reverting and re-landing? 
>
> (yes)
>
> uhh, sure, that's advisable 🙂
2023-08-17 00:41:03 +00:00
Matan Lurey
223ae5d3ac
Add support for LOCAL_ENGINE_HOST to Linux/Mac/Win builds. (#132579)
Partial work towards https://github.com/flutter/flutter/issues/132245.

I also couldn't help myself to do a very minor refactor and add some comments to `LocalEngineInfo` because I was getting confused myself implementing it.
2023-08-16 22:24:51 +00:00
Matan Lurey
6579844528
Update flutter_tools internals related to Gradle/XCode to set --local-engine-host. (#132346)
Partial work towards https://github.com/flutter/flutter/issues/132245.

I made a minor refactor to test-only code because it was too confusing
to have 2 optional parameters that are technically required together,
but otherwise all other changes *should* be pass throughs. That being
said, I can't say I totally understand the Gradle stuff so I could use a
hand double checking that.
2023-08-15 07:28:18 -07:00
Matan Lurey
491ba2307f
Update dev/bots/test.dart (and friends) to provide --local-engine-host. (#132354)
Partial work towards https://github.com/flutter/flutter/issues/132245.

As far as I can tell, this just plumbs flags downwards and has no
semantic changes.
2023-08-14 13:21:14 -07:00
Victoria Ashworth
ec0b7443c4
Fix log filtering and CI tests for iOS 17 physical devices (#132491)
Fixes a couple of issues introduced in new iOS 17 physical device tooling: https://github.com/flutter/flutter/pull/131865.

1) Duplicate messages were being filtered out too aggressively. 

For example, if on the counter app, you printed "Increment!" on button click, it would only print once no matter how many times you clicked.

Sometimes more than one log source is used at a time and the original intention was to filter duplicates between two log sources, so it wouldn't print the same message from both logs. However, it would also filter when the same message was added more than once via the same log.

The new solution distinguishes a "primary" and a "fallback" log source and prefers to use the primary source unless it's not working, in which it'll use the fallback. If the fallback is faster than the primary, the primary will exclude the logs received by the fallback in a 1-to-1 fashion to prevent too-aggressive filtering. Once a flutter-message has been received by the primary source, fallback messages will be ignored.

Note: iOS < 17 did not regress.

2) There was a race condition between the shutdown hooks and exiting XcodeDebug that was causing a crash when deleting a file that doesn't exist. This only affects CI  - for the new integration tests and when testing with iOS 17 physical devices.
2023-08-14 17:30:55 +00:00
Polina Cherkasova
a7b69b069f
Unpin leak_tracker and handle breaking changes in API. (#132352) 2023-08-14 10:05:20 -07:00
Matan Lurey
b4d5c8f425
Update flutter_tools/bin/*.(dart|sh) to provide, if set, --local-engine-host. (#132336)
Partial work towards https://github.com/flutter/flutter/issues/132245.

Other than updating error messages, and passing `$LOCAL_ENGINE_HOST`
downwards, this PR should not change the behavior of any existing
workflows or code (i.e. it's purely additive).
2023-08-10 15:25:57 -07:00
Ian Hickson
a2e2574941
Remove the fast reassemble / single widget reload feature (#132255)
Fixes https://github.com/flutter/flutter/issues/132157
2023-08-10 21:48:06 +00:00
Danny Eldering
82e2de0650
Fix: use --web-launch-url and --web-hostname arguments in flutter drive (#131763)
Implement expected functionalities when supplying `--web-launch-url` and/or `--web-hostname` arguments to `flutter drive`.
- `--web-launch-url` now sets the starting url for the (headless) browser
  - Which for example means you can start at a certain part of the app at the start of your integration test
- `--web-hostname` now sets the hostname where the target of flutter drive will be hosted
  - Which allows you to set something other than localhost (allowing access via a reverse-proxy for example)

Fixes #118028
2023-08-10 20:53:08 +00:00
Christopher Fujino
a6118612ac
Fix flutter attach local engine (#131825)
Fixes: https://github.com/flutter/flutter/issues/124970
Part of https://github.com/flutter/flutter/issues/47161

Before this change, there were two places we overrode the `Artifacts` in a Zone:

1. if/when we parse local-engine CLI options: 1cf3907407/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart (L281)
2. an additional override for fuchsia platform dill (no longer used, deleted in this PR): 1cf3907407/packages/flutter_tools/lib/src/commands/attach.dart (L274)

Note 1 above creates a new instance of `Artifacts.getLocalEngine()`. In this flow, there exist two instances of `Artifacts`:

1. The default fallback instance of `CachedArtifacts` (which gets all artifacts from flutter/bin/cache), instantiated in context_runner.dart: 1cf3907407/packages/flutter_tools/lib/src/context_runner.dart (L137)
2. An instance of `CachedLocalEngineArtifacts` created in the command runner once the CLI options have been parsed: 1cf3907407/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart (L281)

The regression happened when we direct injected the Artifacts 1 from above BEFORE we parsed the local-engine flag, and then used this in the second zone override, and then when creating the `FlutterDevice` there are multiple calls to `globals.artifacts` returned it when it should have returned Artifacts 2: 1cf3907407/packages/flutter_tools/lib/src/resident_runner.dart (L80)

Device.artifactOverrides was originally introduced in https://github.com/flutter/flutter/pull/32071, but is no longer used, so I deleted it.

I also removed direct injection of `Artifacts` to the attach sub-command, because that class now no longer references artifacts.

I believe the ideal true fix for this would be to:

1. Migrate all leaf calls to `globals.artifacts` to use direct injection (in this case, the offending invocations were in [`FlutterDevice.create()`](1cf3907407/packages/flutter_tools/lib/src/resident_runner.dart (L80-L218)), but I'm not sure that something else would not have broken later)
2. Ensure we are always direct injecting the desired instance of `Artifacts`--that is, if the user desires local engine artifacts, that we are passing an instance of `CachedLocalEngineArtifacts`.
  a. Alternatively, and probably simpler, teach `CachedArtifacts` to know about the local engine. This would mean parsing the global CLI options BEFORE we ever construct any instance of `Artifacts`.
  
As an overall recommendation for implementing https://github.com/flutter/flutter/issues/47161, in the overall tree of tool function calls, we should probably migrate the leaves first (that is, migrate the sub-commands last). We should also audit and reconsider any usage of `runZoned()` or `context.run()` for the purpose overriding zoneValues.
2023-08-10 17:51:05 +00:00
Matan Lurey
52a6de2558
Add --local-engine-host, which if specified, is used instead of being inferred (#132180)
Closes https://github.com/flutter/flutter/issues/132162.

I did a tiny bit of minor cleanup but didn't want to go 🍔 beyond the
scope of this change. After it lands I'll update the Wiki.

## Before

```bash
$ fl run \
  --local-engine-src-path=$ENGINE \
  --local-engine=android_debug_unopt_arm64
```

... would try to use `host_debug_unopt` (i.e. Rosetta).

## After

```bash
$ fl run \
  --local-engine-src-path=$ENGINE \
  --local-engine=android_debug_unopt_arm64 \
  --local-engine-host=host_debug_unopt_arm64
```

... uses `host_debug_unopt_arm64`, as specified.

---

/cc @jonahwilliams @gaaclarke @zanderso
2023-08-10 09:38:38 -07:00
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
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
gmackall
ae750e57f5
Upgrade compile and target sdk versions in tests and benchmarks (#131428)
Partially fixes/related to: https://github.com/flutter/flutter/issues/131425
2023-07-31 18:10:24 +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
Donghyun Kim
c05c3d3930
Use Flutter app project's NDK version from FFI plugin (#131141)
<img width="1119" alt="image" src="https://github.com/flutter/flutter/assets/66480156/e2e8eed1-3bef-436c-b21f-3891bdbe05bb">

In most cases, a FFI plugin doesn't need its own specific Android NDK version. Just following the Flutter app project's NDK version is enough.

If a Flutter app project depends on multiple FFI plugins that use different Android NDK versions, it can be quite wasteful and use excessive disk space due to multiple NDK installations.

Using Flutter app project's NDK version is also less error-prone because upgrading the Flutter SDK would be enough when upgrading FFI plugins(If project's `ndkVersion` is `flutter.ndkVersion`), without messing with Android NDK installations.

This problem was discussed in some actual FFI plugin repositories, and they are striving to find their own solutions:
- https://github.com/superlistapp/super_native_extensions/issues/143#issuecomment-1646207706
- https://github.com/cunarist/rust-in-flutter/discussions/60#discussioncomment-6484218
- https://github.com/rive-app/rive-flutter/issues/320
- https://github.com/juicycleff/flutter-unity-view-widget/issues/832
2023-07-31 10:09:24 +00: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
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
Christopher Fujino
d457287f6c
Migrate more integration tests to process result matcher (#130994)
Part of https://github.com/flutter/flutter/issues/127135
2023-07-20 21:02:12 +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
Camille Simon
b42879a94e
[Android] Deletes deprecated splash screen meta-data element (#130744)
Deletes deprecated splash screen meta-data element.

This is no longer needed to present a splash screen in a Flutter application, but will be removed soon. See [go/flutter-splash-screen-migration](http://go/flutter-splash-screen-migration) for more information.

Part of https://github.com/flutter/flutter/issues/105173.
2023-07-18 18:38:12 +00: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
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
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
Alexander Aprelev
3b8f6c4020
Upgrade framework pub dependencies, roll engine with rolled dart sdk (#130163)
Manual roll is needed because incoming dart sdk requires updated version
vm_snapshot_analysis (>=0.7.4).


5ae09b8b4f...7c83ea3e85

```
7c83ea3e85 Reland "Manual roll Dart SDK from 2d98d9e27dae to 0b07debd5862 (21 revisions) (#43457)" (#43472)
9ef3e8d533 Roll Skia from 5eba922297bb to 93c92f97f5ab (2 revisions) (#43471)
```

Remove implementation of SuitePlatform from the test as well. Remove use
of fake cwd from SuitePlatform as it can't be properly faked.
2023-07-07 13:55:35 -07: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
Michael Goderbauer
55b6f049a6
Enable unreachable_from_main lint - it is stable now!!1 (#129854)
PLUS: clean-up of all the unreachable stuff.
2023-07-06 00:09:01 +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
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
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
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
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
Tae Hyung Kim
48ba9c4193
Refactor generate_localizations_test.dart (#128974)
The file was becoming harder to deal with as it manually sets up a /lib/l10n directory with a `MemoryFileSystem` in every single test. This PR wraps this process in a helper function `setupLocalizations` and also provides a helper function `getGeneratedFileContent` which helps fetch the respective output file given the locale string.
2023-06-20 15:42:22 +00:00
Jason Simmons
03d50d1f8a
Fix an ordering dependency in the flutter_tools upgrade test (#129131)
Cache.flutterRoot is set within testUsingContext and will be
uninitialized the first time test suite setup is invoked.
2023-06-19 11:18:16 -07: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
cc83f03822
[flutter_tools] Migrate more integration tests to process result matcher (#128737)
Part of https://github.com/flutter/flutter/issues/127135
2023-06-15 13:25:32 -07: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