Rolls forward https://github.com/flutter/flutter/pull/166717.
Does not copy the `README` or `DEPS` files, and instead uses synthetic
scratch files.
These files can change, so we can't possibly know how to hash them
consistently.
<!-- start_original_pr_link -->
Reverts: flutter/flutter#166717
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Broke tree on
[postsubmit](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8718108088961866849/+/u/test:_run_suite_safari-dart2js-canvaskit-engine/stdout)
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jtmcdole
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {matanlurey}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
1. Calculate the hash in only two places: `content_aware_hash.{ps1|sh}`
2. Call this from the workflow
3. Eventually call this from `update_engine_version.{ps1|sh}`
The files of import:
* `DEPS`: tracks third party dependencies related to building the engine
* `engine`: all the code in the engine folder
* `bin/internal/content_aware_hash.ps1`: script for calculating the hash
on windows
* `bin/internal/content_aware_hash.sh`: script for calculating the hash
on mac/linux
* `.github/workflows/content-aware-hash.yml`: github action for CI/CD
hashing
Tested on windows and mac:
```shell
PS C:\src\flutter> C:\src\flutter\bin\internal\content_aware_hash.ps1
c24231e276e0719738e175e0622e040ad21a7012
```
```shell
❯ ~/src/flutter/bin/internal/content_aware_hash.sh
c24231e276e0719738e175e0622e040ad21a7012
```
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
1. Calculate the hash in only two places: `content_aware_hash.{ps1|sh}`
2. Call this from the workflow
3. Eventually call this from `update_engine_version.{ps1|sh}`
The files of import:
* `DEPS`: tracks third party dependencies related to building the engine
* `engine`: all the code in the engine folder
* `bin/internal/content_aware_hash.ps1`: script for calculating the hash
on windows
* `bin/internal/content_aware_hash.sh`: script for calculating the hash
on mac/linux
* `.github/workflows/content-aware-hash.yml`: github action for CI/CD
hashing
Tested on windows and mac:
```shell
PS C:\src\flutter> C:\src\flutter\bin\internal\content_aware_hash.ps1
c24231e276e0719738e175e0622e040ad21a7012
```
```shell
❯ ~/src/flutter/bin/internal/content_aware_hash.sh
c24231e276e0719738e175e0622e040ad21a7012
```
<!-- start_original_pr_link -->
Reverts: flutter/flutter#163890
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jason-simmons
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: et and related packages in
https://github.com/flutter/flutter/tree/master/engine/src/flutter/tools
need to be updated for the new Ninja path
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: jason-simmons
<!-- end_original_pr_author -->
<!-- start_reviewers -->
Reviewed By: {matanlurey, jtmcdole}
<!-- end_reviewers -->
<!-- start_revert_body -->
This change reverts the following previous change:
The depot_tools Ninja wrapper looks for Ninja at specific paths within
the tree. The use of "name": "." in the engine's .gclient file is not
expected by the depot_tools logic for locating the engine's source
directory.
This PR creates an alternative layout that is supported by depot_tools.
If the project root directory contains a "buildtools" subdirectory, then
depot_tools will look for Ninja at "third_party/ninja" within the root.
Fixes https://github.com/flutter/flutter/issues/163487
<!-- end_revert_body -->
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
The depot_tools Ninja wrapper looks for Ninja at specific paths within
the tree. The use of "name": "." in the engine's .gclient file is not
expected by the depot_tools logic for locating the engine's source
directory.
This PR creates an alternative layout that is supported by depot_tools.
If the project root directory contains a "buildtools" subdirectory, then
depot_tools will look for Ninja at "third_party/ninja" within the root.
Fixes https://github.com/flutter/flutter/issues/163487
This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.
**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.
---------
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
Adds files from flutter/flaux which contain modifications for the engine
structure. The history for engine/ has been edited. Please see
flutter/engine for the original PRs.
The script is modeled after a similar script in the engine (see engine's
[format.dart](https://github.com/flutter/engine/blob/main/ci/bin/format.dart)).
It identifies the files that have been changed and checks if their
formatting is correct. It also offers an option to correct formatting
(`--fix`) and an option to check the formatting of all files in the
repro (not just changed ones, `--all-files`).
When we are enforcing dart format this script will be called as part of
presubmit.
Not so long ago I remember a very informal conversation that went something like this:
> @matanlurey: I wish I could pass `--dev` or something to `flutter` to run from source.
>
> @christopherfujino: I get what you want, but I don't want to overload the tool with more dev-only things. I would consider a script like `flutter-dev` that does that thing, though.
>
> @matanlurey: Cool, I might send a PR!
So uh, here it is 6-9 months later. Suggestions welcome.
I really like how patterns can be used for variable assignment and avoiding duplicated logic. (related: #150942)
```dart
// before
final GestureRecognizer? recognizer = info.recognizer;
if (recognizer is TapGestureRecognizer) {
if (recognizer.onTap != null) {
configuration.onTap = recognizer.onTap;
configuration.isLink = true;
}
} else if (recognizer is DoubleTapGestureRecognizer) {
if (recognizer.onDoubleTap != null) {
configuration.onTap = recognizer.onDoubleTap;
configuration.isLink = true;
}
}
// after
switch (info.recognizer) {
case TapGestureRecognizer(:final VoidCallback? onTap):
case DoubleTapGestureRecognizer(onDoubleTap: final VoidCallback? onTap):
if (onTap != null) {
configuration.onTap = onTap;
configuration.isLink = true;
}
}
```
This puts the wiki pages owned by the Tool team into the docs/tool directory as planned in [flutter.dev/go/migrate-flutter-wiki-spreadsheet](https://docs.google.com/spreadsheets/d/1x65189ZBdNiLRygpUYoU08pwvXD4M-Z157c6pm8deGI/edit?usp=sharing)
It also adds the tool team labels to the label bot for future PRs.
Changes to the content were only updating cross links, or link to refer to the main branch rather than master.
Remaining links to the wiki will be updated once all other pages have finished moving, they still work in the meantime.
Part of https://github.com/flutter/flutter/issues/145009
Part of https://github.com/flutter/flutter/issues/145009
This is part one of the wiki migration.
This moves all wiki pages wholesale into the new docs directory with no changes.
Follow up PRs will sort them, updating breadcrumbs and links.
Refactor the framework + test harness test suites in order to reduce testing logic in test.dart and allow for later implementing package:test onto the existing tests
The refactor of both suites included in this PR because they both depended on util functions and variables that also needed to be refactored.
Part of https://github.com/flutter/flutter/issues/145482
This PR adds initial support for Swift Package Manager (SPM). Users must opt in. Only compatible with Xcode 15+.
Fixes https://github.com/flutter/flutter/issues/146369.
## Included Features
This PR includes the following features:
* Enabling SPM via config
`flutter config --enable-swift-package-manager`
* Disabling SPM via config (will disable for all projects)
`flutter config --no-enable-swift-package-manager`
* Disabling SPM via pubspec.yaml (will disable for the specific project)
```
flutter:
disable-swift-package-manager: true
```
* Migrating existing apps to add SPM integration if using a Flutter plugin with a Package.swift
* Generates a Swift Package (named `FlutterGeneratedPluginSwiftPackage`) that handles Flutter SPM-compatible plugin dependencies. Generated package is added to the Xcode project.
* Error parsing of common errors that may occur due to using CocoaPods and Swift Package Manager together
* Tool will print warnings when using all Swift Package plugins and encourage you to remove CocoaPods
This PR also converts `integration_test` and `integration_test_macos` plugins to be both Swift Packages and CocoaPod Pods.
## How it Works
The Flutter CLI will generate a Swift Package called `FlutterGeneratedPluginSwiftPackage`, which will have local dependencies on all Swift Package compatible Flutter plugins.
The `FlutterGeneratedPluginSwiftPackage` package will be added to the Xcode project via altering of the `project.pbxproj`.
In addition, a "Pre-action" script will be added via altering of the `Runner.xcscheme`. This script will invoke the flutter tool to copy the Flutter/FlutterMacOS framework to the `BUILT_PRODUCTS_DIR` directory before the build starts. This is needed because plugins need to be linked to the Flutter framework and fortunately Swift Package Manager automatically uses `BUILT_PRODUCTS_DIR` as a framework search path.
CocoaPods will continue to run and be used to support non-Swift Package compatible Flutter plugins.
## Not Included Features
It does not include the following (will be added in future PRs):
* Create plugin template
* Create app template
* Add-to-App integration
`@visibleForOverriding` + `@protected` unfortunately does not catch the case where a `compute*` method was overridden in a subtype and the overide was called in that same type's implementation.
I did not add a `flutter_ignore` for this because it doesn't seem there will be false positives.
I did not include the `'// flutter_ignore_for_file: stopwatch (see analyze.dart)'` directive since it's currently not used, and adding that shouldn't be too difficult.