42 Commits

Author SHA1 Message Date
ef7e0d5076 [tool] Refactor args of strings or YAML file lists (#8513)
Multiple commands in the Flutter plugin tool have arguments that accepts a list of strings or a list of YAML files that contain a list of strings. This introduces a `getYamlListArg` helper so that this logic doesn't need to be duplicated multiple times. 

In a subsequent pull requests, this will be used to add a list of packages that are allowed to have Xcode warnings. This will be used by the google_sign_in_ios package which will have warnings when using SwiftPM.

Part of: https://github.com/flutter/flutter/issues/146904
2025-01-29 00:48:29 +00:00
2e313dbf89 [tool] Ensure that leak_tracker_flutter_testing is dev-only (#8365)
Adds `leak_tracker_flutter_testing` to the list of dependencies that can only be added to `dev_dependencies`.
2025-01-02 20:11:22 +00:00
dcf789f424 [ci] Cumulative fixes to reopen the tree. (#8344)
This PR fixes a couple of issues that have popped up in the CI of the tree in the last couple of days:

1. Disables some Android video_player tests that require network access.
2. Fixes our internal tool after a breaking change was made in an upstream dependency.

## Issues

* Mitigates https://github.com/flutter/flutter/issues/160797
* Fixes https://github.com/flutter/flutter/issues/160799
2024-12-23 23:24:22 +00:00
dcf47df88e [flutter_svg] Initial import (#7944)
Imports https://github.com/dnfield/flutter_svg into this repository,
with history, and updates it to follow repository conventions:

- Updates min SDKs.
- Removes analysis options and fixes resulting warnings.
- Autoformats.
- Updates pubspecs to follow repo standard.
- Updates repo tooling to allow the `flutter_svg_test` non-dev
  dependency on `flutter_test`.
- Adds repo metadata.
- Adds METADATA files.
- Bumps versions and slightly relax version constraints for
  vector_graphics* to allow the new versions.
2024-10-31 10:36:08 -07:00
760b8df4a7 [flutter_svg] Initial import
Imports https://github.com/dnfield/flutter_svg into this repository,
with history, and updates it to follow repository conventions:
- Updates min SDKs.
- Removes analysis options and fixes resulting warnings.
- Autoformats.
- Updates pubspecs to follow repo standard.
- Updates repo tooling to allow the `flutter_svg_test` non-dev
  dependency on `flutter_test`.
- Adds repo metadata.
- Adds METADATA files.
- Adds commemoration to README.
- Updates example app Android build files to current standards.
- Bumps versions and slightly relax version constraints for
  vector_graphics* to allow the new versions.
- Moves gitignore of golden test diffs into the package.
2024-10-29 07:10:49 -04:00
a1bfadf6fd Update vector_graphics to match repo conventions
- Add missing licence headers.
- Remove analysis options fix new warnings.
- Update min SDKs.
- Autoformat.
- Update pubspecs to follow repo standard.
  - Includes removing dependency overrides for inter-package path
    pinning as a default state; this can be added temporarily in PRs
    with repo tooling.
- Allow xml dependency, and relax the pinning requirement to allow an
  explicit, inclusive-endpoint range.
- Skip tests on unsupported platforms.
- Switch vector_graphics_codec from flutter_test to test.
- Add repo metadata.
- Add commemoration to the README.
- Add AUTHORS files.
- Bump versions and slightly relax version constraints to allow the new
  versions.
2024-10-28 14:50:30 -04:00
c472e4007c Correcting the typo of Flutter in projects (#6850)
In part of the documentation, Flutter is spelled out with a typo. I fixed it using a repository search.

- [] The title of the PR starts with the name of the package surrounded by square brackets, e.g. `[shared_preferences]`
2024-06-04 21:10:01 +00:00
5cc71d00ac Update Flutter wiki links (#6789)
Updates all links to the Flutter wiki to point to their new location in the flutter/flutter repository. (The sole exception is a link to a doc that doesn't have a final home yet, and is linked from legacy code anyway so doesn't really need to be updated.)

While touching the PR template, makes a few minor improvements:
- Removes the breaking change discussion that doesn't apply to this repository, as breaking changes are handled totally differently for packages (and is covered by the link to docs about Dart versioning).
- Adds text and a link to reflect the fact that some PRs can be changelog-exempt.
2024-05-26 12:47:23 +00:00
bb82cb79b9 [ci] Add more dev dependency checks, and fix errors (#6563)
- Adds `build_runner`, `mockito`, and `pigeon` to the list of dependencies that we expect to only be in dev_dependencies.
- Fixes the error message for violations; I had missed in initial review that the errorr message was the same as the one for non-repo-local depndencies, making it misleading about what the problem was and how to fix it. (Also fixed the indentation, which had always been wrong.)
- Fixes `camera_avfoundation`, which had a violation introduced in my recent PR to start the Pigeon conversion.

See https://github.com/flutter/flutter/issues/117905
2024-04-18 21:43:04 +00:00
e98839a9b8 [tool] Check for test and flutter_test in non-dev dependencies (#6472)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

Additional checks as a followup to https://github.com/flutter/packages/pull/6446

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

Related to https://github.com/flutter/flutter/issues/145992

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-04-10 18:09:17 +00:00
3ff376b7b7 [Tool] Add ability to check dependencies independently of dev-dependencies, exclude integration_test from dependencies (#6446)
Create a linter that ensures that `integration_test` is not used in dependencies. 

Will be paired with a change to documentation 
```
If you are considering adding an external dependency:

Consider other options, and discuss with #hackers-ecosystem in Discord.
* If you add a dev_dependency on an external package, pin it to a specific version if at all possible.
* If you add a dependency on an external package in an example/, pin it to a specific version if at all possible.
* Some dependencies should only be linked as dev dependencies like integration_test 
```

Related to flutter/flutter/issues/145992
2024-04-03 19:44:11 +00:00
8411522be7 [tools] Validate pubspec topic format (#5565)
Fixes https://github.com/flutter/flutter/issues/139305
2023-12-12 16:44:27 +00:00
b4985e25fe [all] Add topics to pubspecs (#4771)
Adds [topics](https://dart.dev/tools/pub/pubspec#topics) to all
packages, supporting the new pub feature for categorizing packages. The
heuristics I used were:
- Try to use existing topics from https://pub.dev/topics where
applicable
- Add new topics as necessary to cover things that seemed like obvious
relevant topics
- Include the plugin name as a topic for all federated plugin packages,
for grouping (since pub doesn't inherently group or cross-link
implementations)

This is not an attempt to be exhaustive; as topics evolve I expect we
will add more or adjust.

Also updates the repo tooling to enforce topics, so that we don't forget
to add them to new packages. The enforced rule is:
- All packages must have at least one topic. We could potentially change
this to allow an empty `topics` section so that we are enforcing that we
didn't just forget to add the section, but in practice even for packages
that we don't expect people to be likely to use, I didn't have any issue
coming up with at least one relevant topic.
- Federated plugin packages must contain the plugin name as a topic.

While this isn't time-critical, I chose to include version bumps so that
we aren't rolling out topics in a piecemeal way (e.g., with only a
random subset of a federated plugin's packages having topics on pub.dev
based on what has happened to have a bugfix).
2023-08-29 13:31:23 -04:00
28c419d2ab [tool] Conditionalize color on stdout (#4436)
Refactors colorization to a centralized utility file, and makes it all conditional on `stdout` having ANSI escape support. This makes the output more readable on LUCI, which unlike the Cirrus log display doesn't handle ANSI.

Fixes https://github.com/flutter/flutter/issues/89392
2023-07-11 19:02:59 +00:00
f1f0f240db [tool] Update Dart SDK version (#4402)
Since the tool only needs to support back to Flutter 3.3 (the oldest version we still run CI with), this updates the tool to the corresponding minimum Dart version.

This allows the use of `super` parameters, so `dart fix --apply` was run to convert them all (and remove all the includes that were only needed for setting default values).

Also opportunistically cleans up a bunch of unnecessary, very old `dart:async` includes. (Other than those removals, the changes here are all `dart fix`-generated.)
2023-07-08 14:31:19 +00:00
59d93d64cb [tool] Add command aliases (#4207)
Adds aliases for all commands that put the verb first, since currently they are inconsistent which can make it hard to remember (in particular, I often write `check-foo` instead of `foo-check` when running locally, and it fails).

Also does the long-overdue renaming of `test` to `dart-test`, since we now have `native-test`, `custom-test`, etc. `test` continues to work as an alias for individual muscle memory.
2023-06-16 13:01:25 +00:00
9b136a9ce3 [ci/tool] Add external dependency validation (#3466)
[ci/tool] Add external dependency validation
2023-03-17 03:01:18 +00:00
789e3a72c9 [various] Align Flutter and Dart SDK constraints (#3349)
As described in https://github.com/flutter/flutter/issues/121684, we currently have inconsistencies between Flutter SDK constraints and Dart SDK constraints; we have often updated only the former. This PR:
1. Adds CI enforcement via the repo tooling that the minimum versions are consistent.
2. Adds a new repo tooling command to update SDK constraints, to help mass-fix all the violations of the new enforcement in step 1 (and for future mass changes, such as when we update our test matrix and mass-drop support for versions that are no longe tested).
    - In all cases, the looser constraint was updated to match the more restrictive constraint, such that there's no actual change in what Flutter version any package actually supports.
3. Runs `dart fix --apply` over all changed packages to automatically fix all of the analysis failures caused by step 2 suddenly making all of our packages able to use `super` parameters.

Fixes https://github.com/flutter/flutter/issues/121684
Fixes https://github.com/flutter/flutter/issues/121685
2023-03-04 13:28:18 -05:00
25f0f702e5 [various] Update flutter/plugins links (#3256)
Updates links and references to `flutter/plugins` to use `flutter/packages` instead, including making the `repository` pubspec.yaml check stricter in the repo tooling to ensure all packages are pointing to the right place.

Exceptions to the updates are:
- Changelog entries.
- Links to pull requests.

This will re-publish all the moved plugins, thus fixing the current redness of `release` (due to the current versions not being tagged in this repository).
2023-02-22 13:45:11 -05:00
7203521989 [tool/ci] Add minimum supported SDK validation (#7028)
Adds options to `pubspec.yaml` to check that the minimum supported SDK range for Flutter/Dart is at least a given version, to add CI enforcement that we're updating all of our support claims when we update our tested versions (rather than it being something we have to remember to do), and enables it in CI.

As part of enabling it, fixes some violations:
- path_provider_foundation had been temporarily dropped back to 2.10 as part of pushing out a regression fix.
- a number of examples were missing Flutter constraints even though they used Flutter.
- the non-Flutter `plugin_platform_interface` package hadn't been update since I hadn't thought about Dart-only constraints in the past.
2023-01-26 13:28:41 -05:00
5dae598918 [various] Enable avoid_dynamic_calls (#6834)
* Enable the option

* Fix camera

* Fix webview

* Remove unnecessary 'call's from camera tests

* Fix maps

* Fix sign-in

* fix image_picker

* Fix IAP

* Fix shared_preferences

* Fix url_launcher_android

* Version bumps

* Fix tool

* Re-apply webview test fix

* Re-bump versions

* Fix one new tool issue
2023-01-10 14:17:39 +00:00
66824fd7e6 [various] Clean up obsolete references to "master" (#5912) 2022-06-06 12:23:10 -07:00
517d3761f2 [tools] Validate example READMEs (#5775) 2022-05-17 17:32:10 -07:00
e8b4147fcc Re-sync analysis_options.yaml with flutter/flutter (#5695)
The analysis options have gotten behind; this re-syncs to the current state of flutter/flutter. For options that are non-trivial to enable, either because they are non-trivial to fix, or touch a very large number of files, they are locally disabled with clear "LOCAL CHANGE" markers so that it's obvious where we are out of sync. For options that are simple to resolve, they are enabled in the PR.

Part of https://github.com/flutter/flutter/issues/76229
2022-05-11 11:48:47 -04:00
fbf53f284b [flutter_plugin_tools] Support non-plugin packages for drive-examples (#5468) 2022-05-02 14:44:12 -07:00
4aeb80aed7 [url_launcher] Support new desktop implementation versions (#4779) 2022-02-10 14:35:22 -08:00
12afeda41e Add missing return for nullably typed function (#4598) 2021-12-10 03:18:07 -08:00
78395e5adf [flutter_plugin_tools] Fix pubspec-check on Windows (#4428)
The repository check always failed when run on Windows, because the
relative path generated to check the end of the URL was using local
filesystem style for separators, but URLs always use POSIX separators.
2021-10-25 08:29:07 -07:00
a731d6e131 [flutter_plugin_tools] Validate pubspec description (#4396)
pub.dev deducts points for having a pubspec.yaml `description` that is too short or too long; several of our plugins are losing points on this. To ensure that we are following—and modeling—best practices, this adds a check that our `description` fields meet pub.dev expectations.

Fixes our existing violations. Two are not published even though this only takes effect once published:
- camera: We change this plugin pretty frequently, so this should go out soon without adding a release just for this trivial issue.
- wifi_info_flutter: This is deprecated, so we don't plan to release it. It has to be fixed to allow the tool change to land though.
2021-09-30 10:30:26 -07:00
91ef4b1a00 Add false secret lists, and enforce ordering (#4372) 2021-09-22 10:58:07 -07:00
1b95825c76 [flutter_plugin_tools] Add a federated PR safety check (#4329)
Creates a new command to validate that PRs don't change platform interface packages and implementations at the same time, to try to prevent ecosystem-breaking changes. See https://github.com/flutter/flutter/issues/89518 for context.

Per the explanation in the issue, this has carve-outs for:
- Changes to platform interfaces that aren't published (allowing for past uses cases such as making a substantive change to an implementation, and making minor adjustments to comments in the PI package based on those changes).
- Things that look like bulk changes (e.g., a mass change to account for a new lint rule)

Fixes https://github.com/flutter/flutter/issues/89518
2021-09-20 10:54:02 -07:00
419cbe7354 [flutter_plugin_tools] Check 'implements' for unpublished plugins (#4273) 2021-08-26 12:01:06 -07:00
41f1c806f2 [flutter_plugin_tools] Introduce a class for packages (#4252)
Packages are the primary conceptual object in the tool, but currently they are represented simply as Directory (or occasionally a path string). This introduces an object for packages and:
- moves a number of existing utility methods into it
- sweeps the code for the obvious cases of using `Directory` to represent a package, especially in method signatures and migrates them
- notes a few places where we should migrate later, to avoid ballooning the size of the PR

There are no doubt other cases not caught in the sweep, but this gives us a foundation both for new code, and to migrate incrementally toward as we find existing code that was missed.
2021-08-24 13:29:56 -07:00
5bbc1791cc [flutter_plugin_tools] Improve 'repository' check (#4244)
Ensures that the full relative path in the 'repository' link is correct,
not just the last segment. This ensure that path-level errors (e.g.,
linking to the group directory rather than the package itself for
app-facing packages) are caught.

Also fixes the errors that this improved check catches, including
several cases where a previously unfederated package wasn't fixed when
it was moved to a subdirectory.
2021-08-20 11:50:56 -07:00
0f6d559f10 Fix and test for 'implements' pubspec entry (#4242)
The federated plugin spec calls for implementation packages to include an `implements` entry in the `plugins` section of the `pubspec.yaml` indicating what app-facing package it implements. Most of the described behaviors of the `flutter` tool aren't implemented yet, and the pub.dev features have `default_plugin` as a backstop, so we haven't noticed that they are mostly missing (or in one case, incorrect).

To better future-proof the plugins, and to provide a better example to people looking at our plugins as examples of federation, this adds a CI check to make sure that we are correctly adding it, and fixes all of the missing/incorrect values it turned up.

Fixes https://github.com/flutter/flutter/issues/88222
2021-08-20 07:58:24 -07:00
77460f03f2 [flutter_plugin_tools] Make unit tests pass on Windows (#4149)
The purpose of this PR is to make running all unit tests on Windows pass (vs failing a large portion of the tests as currently happens). This does not mean that the commands actually work when run on Windows, or that Windows support is tested, only that it's possible to actually run the tests themselves. This is prep for actually supporting parts of the tool on Windows in future PRs.

Major changes:
- Make the tests significantly more hermetic:
  - Make almost all tools take a `Platform` constructor argument that can be used to inject a mock platform to control what OS the command acts like it is running on under test.
  - Add a path `Context` object to the base command, whose style matches the `Platform`, and use that almost everywhere instead of the top-level `path` functions.
  - In cases where Posix behavior is always required (such as parsing `git` output), explicitly use the `posix` context object for `path` functions.
- Start laying the groundwork for actual Windows support:
  - Replace all uses of `flutter` as a command with a getter that returns `flutter` or `flutter.bat` as appropriate.
  - For user messages that include relative paths, use a helper that always uses Posix-style relative paths for consistent output.

This bumps the version since quite a few changes have built up, and having a cut point before starting to make more changes to the commands to support Windows seems like a good idea.

Part of https://github.com/flutter/flutter/issues/86113
2021-07-09 19:38:13 -04:00
edeb10a752 [flutter_plugin_tools] Add a summary for successful runs (#4118)
Add a summary to the end of successful runs for everything using the new looping base command, similar to what we do for summarizing failures. This will make it easy to manually check results for PRs that we know should be changing the set of run packages (adding a new package, adding a new test type to a package, adding a new test type to the tool), as well as spot-checking when we see unexpected results (e.g., looking back and why a PR didn't fail CI when we discover that it should have).

To support better surfacing skips, this restructures the return value of `runForPackage` to have "skip" as one of the options. As a result of it being a return value, packages that used `printSkip` to indicate that *parts* of the command were being skipped have been changed to no longer do that.

Fixes https://github.com/flutter/flutter/issues/85626
2021-07-01 16:25:21 -07:00
23c3f5794a [flutter_plugin_tools] Restructure version-check (#4111)
Combines the two different aspects of version-checking into a single looping structure based on plugins, using the new base command, rather than one operating on plugins as controlled by the usual flags and the other operating on a git list of changed files.

Also simplifies the determination of the new version by simply checking the file, rather than querying git for the HEAD state of the file. Tests setup is simplified since we no longer need to set up nearly as much fake `git` output.

Minor changes to base commands:
- Move indentation up to PackageLoopingCommand so that it is consistent across commands
- Add a new post-loop command for any cleanup, which is needed by version-check
- Change the way the GitDir instance is managed by the base PluginCommand, so that it's always cached even when not overridden, to reduce duplicate work and code.

Part of https://github.com/flutter/flutter/issues/83413
2021-06-28 13:25:06 -07:00
356d316717 [flutter_plugin_tools] Add a new base command for looping over packages (#4067)
Most of our commands are generally of the form:
```
  for (each plugin as defined by the tool flags)
    check some things for success or failure
  print a summary all of the failing things
  exit non-zero if anything failed
```

Currently all that logic not consistent, having been at various points copied and pasted around, modified, in some cases rewritten. There's unnecessary boilerplate in each new command, and there's unnecessary variation that makes it harder both to maintain the tool, and to consume the test output:
- There's no standard format for separating each plugin's run to search within a log
- There's no standard format for the summary at the end
- In some cases commands have been written to ToolExit on failure, which means we don't actually get the rest of the runs

This makes a new base class for commands that follow this structure to use, with shared code for all the common bits. This makes it harder to accidentally write new commands incorrectly, easier to maintain the code, and lets us standardize output so that searching within large logs will be easier.

This ports two commands over as a proof of concept to demonstrate that it works; more will be converted in follow-ups.

Related to https://github.com/flutter/flutter/issues/83413
2021-06-22 13:32:03 -07:00
10486b0ceb [flutter_plugin_tools] Split common.dart (#4057)
common.dart is a large-and-growing file containing all shared code,
which makes it hard to navigate. To make maintenance easier, this splits
the file (and its test file) into separate files for each major
component or category.
2021-06-16 12:37:30 -07:00
bb0a1ea161 [flutter_plugin_tools] Simplify filesystem usage (#4014)
- Replaces most explicit use of `fileSystem` with path construction using the `child*` utility methods
- Removes explicit passing of a filesystem to the commands; we're already passing a `Directory` for the
  root where the tool operates, and we should never be using a different filesystem than that directory's
  filesystem, so passing it was both redundant, and a potential source of test bugs.
2021-06-05 13:32:24 -04:00
d21b1d9706 Add pubspec convention checks (#3984) 2021-05-27 20:54:06 -07:00