Sources under `packages/flutter_tools/` aren't accessible to the average
Flutter user by navigating through sources from their projects, so it
doesn't need to be as explicitly verbose with types for readability
purposes. The `always_specify_types` lint results in extremely verbose
code within the tool which adds little value.
This change disables `always_specify_types` in favor of a new set of
lints that aim to reduce verbosity by removing obvious types while also
maintaining readability in cases where variable types otherwise wouldn't
be obvious:
- `omit_obvious_local_variable_types`
- `omit_obvious_property_types`
- `specify_nonobvious_local_variable_types`
- `specify_nonobvious_property_types`
## Summary
A Custom Device's log reader doesn't do anything, and thus `flutter
attach` will fail to ever find the flutter engine's VM service.
This change adds a new `readLogs` command to the CustomDeviceConfig, and
which allows a custom device to read the logs from the running flutter
app on the actual custom device, and then allow flutter attach to work.
Fixes#170634
## Testing
Created a custom device, and added the following readLogs command in the
`custom_devices.json` file:
```
"readLogs": [
"sshpass",
"-f",
"/home/dvalente/player.txt",
"ssh",
"root@10.0.0.20",
"tail -Fn +1 /opt/log/flutter.log"
]
```
Then, running `flutter attach` works every time.
**Tested the following scenarios:**
* Launched `flutter attach` before app is running on device, and once
app runs, flutter attach succeeds
* Launched `flutter attach` after app is already running on device, and
flutter attach succeeds.
* Used `flutter attach` in Android Studio, and hot reload works just
like any Android device.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Example message with findings:
```
Wasm dry run findings:
Found incompatibilities with WebAssembly.
package:counter1/main.dart 3:1 - dart:html unsupported (0)
Consider addressing these issues to enable wasm builds. See docs for more info: https://docs.flutter.dev/platform-integration/web/wasm
Compiling lib/main.dart for the Web... 10.9s
✓ Built build/web
```
Example message without findings:
```
Wasm dry run succeeded. Consider building and testing your application with the `--wasm` flag. See docs for more info: https://docs.flutter.dev/platform-integration/web/wasm
Compiling lib/main.dart for the Web... 10.8s
✓ Built build/web
```
---------
Co-authored-by: Nate Biggs <natebiggs@google.com>
- **Relands "Bump warn and error versions of agp, kotlin and gradle
versions in preparation for gradle 9 (#171399)"**
- **bump lockfile generator to use kotlin 2.1.0**
- **Update formatting of lockfile to pass ktlint**
Updated lockfiles with
`JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home/
dart dev/tools/bin/generate_gradle_lockfiles.dart` after
dev/tools/bin/generate_gradle_lockfiles.dart to bump the versions of
kotlin.
Failing tests from first attempt
https://flutter-dashboard.appspot.com/#/build?hashFilter=84a5ce765d193a9c79ab4297f367d5ad7efc5dac&showMac=false&showWindows=false&showiOS=false&showLinux=false&showBringup=true&repo=flutter&branch=master
Verified example test that cause revert was passing by running the
following
- `../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t
run_debug_test_android.dart` from `dev/devicelab`
- `../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t
run_release_test` from `dev/devicelab`
- `SHARD=android_engine_vulkan_tests bin/cache/dart-sdk/bin/dart
dev/bots/test.dart` from root with an android emulator. Hard to actually
verify because the emulator is closed as part of the tests but no
failures were from failures to compile.
- `flutter test
test/general.shard/android/android_project_migration_test.dart` from
`packages/flutter_tools/`
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
In the case of a bad release, we should be able to release a new version
of Flutter that points to the revision of the last good release.
This change updates the tool to not only compare framework revisions
when determining if the current installation is up to date, and also
updates the tag selection logic to pick the most recent version tag
first.
Fixes https://github.com/flutter/flutter/issues/170679
The flutter tool will now download and use an `engine_stamp.json` file
to determine the engine version, content hash, build date, and commit
date.
The file is treated as a new `DevelopmentArtifact.informative` and is
fetched before flutterVersion is used. This ensures we have build
information for a clean checkout with no bin/cache folder. Users that
download from flutter.dev will have engine_stamp.json, so its a no-op.
This change provides support for content hashed engine artifacts, who's
revision (the hash) is not a git commit sha. A side benefit is "git" is
only used at build time to extract this information.
> [!NOTE]
> Content hashed artifacts are not enabled yet for downloads;
bin/internal/engine.version (releases) and the shell updaters still look
for the git commit sha. One can test this out by setting
`FLUTTER_PREBUILD_ENGINE_VERSION` to the content hash.
<!-- start_original_pr_link -->
Reverts: flutter/flutter#171399
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Many Gradle/Android related tasks are failing
([one
example](https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_mokey%20run_release_test/1347/overview))
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: reidbaker
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {gmackall}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
https://gradle.org/whats-new/gradle-9/ is coming and with it includes
some deprecated methods. Some like
https://github.com/flutter/flutter/pull/171397 can be fixed by
annotations and calling new methods. Some like the deprecation of
minsdkversion on Variant require bumping the minimum versions to be able
to compile code that will work.
b/368604254
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
https://gradle.org/whats-new/gradle-9/ is coming and with it includes
some deprecated methods. Some like
https://github.com/flutter/flutter/pull/171397 can be fixed by
annotations and calling new methods. Some like the deprecation of
minsdkversion on Variant require bumping the minimum versions to be able
to compile code that will work.
b/368604254
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Requires a modification to how we compute the hotReloadSourcesUri
contents.
## 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].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Tracks the following metrics:
- Overall launch time with/without generating the widget preview
scaffold
- Time from detecting a file change within the tracked project to
actually loading the updated previews into the previewer
Fixes https://github.com/flutter/flutter/issues/166418
This allows for developers to perform a hot restart on the preview
environment in the case they get into a bad state.
This change adds a `hotRestartPreviewer` method to the `widget-preview`
DTD service registered by the Flutter Tool, which is invoked by the
previewer.

Updates the widget previewer to properly handle previews defined across
a workspace. This is effectively equivalent to displaying previews from
multiple individual projects, which required a fairly significant rework
to properly support:
- resolving asset paths to the right project
- loading assets across projects in the workspace
- tracking changes to pubspec.yaml files across the workspace
While making this change, it became apparent that we don't need to
explicitly list the assets from the various projects explicitly in the
scaffold's pubspec.yaml as they're automatically pulled in by adding
those project's as dependencies and using the `package/$ASSET_PATH`
format to load the assets from the scaffold. This allowed for the
removal of a significant amount of logic related to building the
scaffold's pubspec.
Fixes https://github.com/flutter/flutter/issues/169268
This PR adds a `--profile-microtasks` flag to `flutter run` that can be
used to set [the Flutter Engine's `--profile-microtasks`
switch](https://github.com/flutter/flutter/pull/170690).
- **bump template version, update migration code to handle api 21-23 and
expand it to cover multiple min api level definitions**
- **bump add to app project to minimum api level 24**
- **PathUtilsTest converted to using config, removed test code that
branched on versions older than 24**
- **Update additional build.gradle files to have minsdk 24 and
documenation**
Related to #170807
G3 cls
- espresso https://critique.corp.google.com/cl/776592881
- integration tests cl/778034198
- removal of pre api 23 samples tests cl/777652802
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
---------
Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com>
partial resolution for #170791 (lowercase but not filemode)
This is the first time I have used the experimental api annotation. Most
users should have lowercase available without the annotation only the
oldest kotlin/agp versions should need the annotation.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Provides extra minification controls for web builds. Updates the
existing `--minify` flag to pass its value to both JS and wasm (instead
of just JS).
Also adds two new flags `--minify-js` and `--minify-wasm` which toggle
minification for just one of the web targets. While JS minification has
a huge impact on code size, wasm minification has a much smaller effect
on the program's size. Since minification can obfuscate useful info
(like errors) one may want to turn off minification for wasm but leave
it on for JS.
The plan is to temporarily use `--no-minify-wasm` for devtools to help
debug some exceptions being seen.
---------
Co-authored-by: Nate Biggs <natebiggs@google.com>