31 Commits

Author SHA1 Message Date
f8fbcdbe95 [ci] version_check_command now checks markdown of first CHANGELOG line. (#7266)
This PR:

* Modifies the `version_check_command` test so it checks the leading markdown of the first line of a CHANGELOG file, to ensure it's `'##'`.
* Fixes the CHANGELOG in two packages that were allowed by the tool before this fix:
  * google_maps_flutter_web
  * interactive_media_ads

## Issues

Fixes https://github.com/flutter/flutter/issues/152638
2024-08-01 01:33:18 +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
65254411e6 [local_auth] Convert native unit tests to Swift (#6779)
Converts native unit tests from Objective-C to Swift, as a first step toward an eventual plugin conversion. Since OCMock usage was removed in a previous PR, the tests are converted essentially directly (the rewrites were largely mechanical syntax replacement), without any changes needed to production code.

There are a few places where interacting with the Pigeon-generated Obj-C is somewhat awkward because the NSError signature isn't auto-converting to `throw` in cases where we use `NSNumber` wrapping, but all that will get cleaned up when we switch the plugin over to Swift Pigeon generation and have idiomatic Swift APIs that the tests will be calling instead.

Fixes a couple of false positives in the repo tooling surfaced by this PR:
- `darwin/Tests/` wasn't recognized as a test directory.
- Swift tests weren't recognized as exempt from requiring Swift entries in the podspec.

Part of https://github.com/flutter/flutter/issues/119104
2024-05-22 14:07:09 +00:00
bb97da8ec6 [various] Sync lints with flutter/flutter (#5717)
Applying the latest analysis_options.yaml from flutter/flutter to this
repo. Most fixes were auto-generated by `dart fix`.
2024-01-03 15:16:49 -08:00
86b116807e [repo] Adjust error message layout for repo checks (#5241)
This tweaks the errors messages that provide info like how to override a repo check for versioning or changelog updates.
Basically added newlines, so the errors do not require scrolling far off to the right to get the message.
2023-11-07 20:40:35 +00:00
48232e890b [tool] Consider comment-only changes to be dev-only (#4279)
Updates the state checker to inspect changed Dart files to see if the only changes are implementation (not documentation) comment lines. In particular, this will fix the problem of CI flagging changes that do nothing but add `// ignore:` comments (for federated package changes involving deprecation, framework changes that require temporary ignores in packages to support stable, etc.) as needing version and changelog changes
2023-06-23 17:06:07 +00:00
97e3ba64d7 [various] Fixes unawaited_futures violations (#4067)
This option had been disabled to match flutter/flutter, but the reason it was disabled there was "too many false positives", mostly around animation. That doesn't apply to most packages here, and we've had a number of production bugs—especially in plugins, that use async heavily in ways that are intended to be client-awaitable—that this would have caught.

This PR:
- Enables the option at the repo level.
- Permanently (unless the owners decide to change it) opts out `animations` and `go_router`, both of which looked like mostly or entirely false positives.
- Temporarily opted out a few plugins that have a lot of violations that should be handled in their own PRs later (`camera_android_camerax`, most of `webview_flutter`).
- Fixes all remaining violations.

In many cases this PR is behavior-changing, replacing implicitly unawaited futures that did not seem obviously intentional with `await`ed futures, so non-test code in particular should be reviewed carefully to make sure the changes are correct. All of the changes are manual, not `fix`-generated.

Part of https://github.com/flutter/flutter/issues/127323
2023-05-24 15:39:26 +00:00
b73a598741 [various] Speed up build-examples (#3849)
https://github.com/flutter/flutter/issues/125707

- Create pluginTools config for every example that shrunk material icons and had an android config

Likely some build caching but before/after If someone knows how to clean the cache or force a rebuild I will give more accurate after numbers. 
Command
`time dart run ./script/tool/bin/flutter_plugin_tools.dart build-examples --apk`
Secondary validation from @stuartmorgan who discovered this is between a 10% and 25% speed increase. 

Existing tests add confidence this is non-breaking. New tests not required because these are optional flags. Validation this does not change is low consequence.  Test update to exclude these config files from changelog requirements.
2023-05-01 19:50:14 +00:00
f224eea858 [tool] Add pigeon support to update-dependency (#3640)
[tool] Add pigeon support to update-dependency
2023-04-05 10:44:19 +00:00
ab5a8c0ca8 [tool] Allow importing packages with NEXT (#3215)
Fixes an issue that showed up in the trial repo merge PR; if a pacakge
is new to the repository (i.e., has no git history in the parent
commit), it was being treated as a version bump, which caused failures
if NEXT was present. This adds a new state so that we can allow NEXT
during import.
2023-02-18 20:43:11 +00:00
92330dbd2c Enable no_leading_underscores_for_local_identifiers (#6509) 2022-09-28 18:22:46 +00:00
9974a8ef44 [tool] Clean up "plugin" references (#6503) 2022-09-27 19:43:04 +00:00
ecaf5a954b [tools] Add 'run_tests.sh' to the dev-only list (#6474) 2022-09-23 21:38:04 +00:00
1aa2e82b56 [tools] Improves version-check logic (#6354)
Improves the logic used to determine whether to require a version and/or CHANGELOG change:
- Removes the requirement that dev-only (e.g., test) changes update the CHANGELOG, since in practice we were essentially always overriding in that case.
- Adds file-level analysis of `build.gradle` files to determine whether they are only changing test dependencies.
- Improves the "is this a published example file" logic to better match pub.dev's logic, to fix some false positives and false negatives (e.g., `rfw`'s `example/<foo>/lib/main.dart` being considered published).

Removes the no-longer-necessary special-case handling of some Dependabot PRs, as well as the PR-description-based system it was built on (and that turned out not to be very useful due to the way `CIRRUS_CHANGE_MESSAGE` actually worked). `build.gradle` analysis should not cover all such cases, and without the need to hard-code them by package name.
2022-09-09 13:52:16 -04:00
b83209e3e5 [tool] Switch PR description overrides over to labels (#6145) 2022-07-27 17:59:04 +00:00
f972cb1500 [tool] Handle dependabot commit messages (#6127) 2022-07-21 00:15:06 +00:00
223a080ad6 [tool] Bypass version/changelog checks for some PRs (#6124) 2022-07-20 20:15:04 +00:00
b74ce39eb1 [tools] Allow pre-release versions (#6061) 2022-07-01 11:54:04 -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
1a124b18d3 Revert "Enable lints library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors" (#5691)
This reverts commit 5d92a4717a7a266f485974ff5403122ef2570935.

This includes a fix for a latent bug in the version-check repo tooling command that caused it to fail when reverting a package that previously had a NEXT section, so that tests will pass.
2022-05-10 13:05:18 -04:00
5ec6644f3f [tools] Convert test utils to RepositoryPackage (#5605) 2022-05-03 14:14:11 -07:00
7b6ac13139 [flutter_plugin_tools] Check for missing version and CHANGELOG updates (#4530)
The currently documented repository policy is to:
- require version updates for packages changes that don't meet specific exemptions, and
- require CHANGELOG changes for essentially all changes.

This adds tooling that enforces that policy, with a mechanism for overriding it via PR descriptions, to avoid cases where they are accidentally omitted without reviewers catching it.

In order to facilitate testing (which require mocking another `git` command), this also updates the existing `version-check` tests:
- Replaces the custom git result injection/validating with the newer bind-to-process-mocks approach that is now used in the rest of the tool tests.
- Fixes some tests that were only checking for `ToolExit` to also check the error output, in order to ensure that failure tests are not accidentally passing for the wrong reason (as is being done in general as tests in the tooling are updated).

Fixes https://github.com/flutter/flutter/issues/93790
2021-11-23 08:34:18 -08:00
5d15fe9626 [flutter_plugin_tools] Add 'main' support (#4474)
Treat `main` the same as `master` for branch-based switching, in
preparation for switching the branch names in Flutter repositories.

Also updates all of the tests that used `master` as the explicit base to
use `main` instead; what the tests use is arbitrary, so they can be
switched now even though the repo itself hasn't switched.

Part of https://github.com/flutter/flutter/issues/90476
2021-11-10 11:46:35 -08:00
3d4782ae62 [flutter_plugin_tools] Improve version check error handling (#4376)
Catches invalid CHANGELOG formats and logs useful error messages for them,
rather than throwing FormatExceptions.
2021-09-23 12:40:04 -07:00
c0aca80c15 [flutter_plugin_tools] Allow overriding breaking change check (#4369) 2021-09-23 10:23:06 -07:00
f4a6fc84a4 [flutter_plugin_tool] Fix CHANGELOG validation failure summary (#4266)
The error summary for a CHANGELOG validation failure was written when
the only thing being checked was that the versions matched, but now
there are other ways to fail as well (i.e., leaving NEXT). This fixes
the summary message to be more generic so that it doesn't mislead people
who hit validation failures.

While adding the test for this message, I discovered that almost all of
the tests were actually talking to pub.dev, causing their behavior to in
some cases depend on whether a package with that name happened to have
been published, and if so what its version was. In order to make the
tests hermetic and predictable, this fixes that by making all tests use
a mock HTTP client.
2021-08-26 06:10:15 -07:00
69a271351d [flutter_plugin_tool] Don't allow NEXT on version bumps (#4246)
The special "NEXT" entry in a CHANGELOG should never be present in a
commit that bumped the version. This validates that this is true even if
the CHANGELOG would be correct for a non-version-change state, to catch
someone incorrectly resolving a merge conflict by leaving both parts of
the conflict, rather than folding the 'NEXT' entry's list into the new
version's notes.

Fixes https://github.com/flutter/flutter/issues/85584
2021-08-17 08:36:40 -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
4b77aaff42 [flutter_plugin_tools] Minor test cleanup (#4120)
- Updates the remaining tests (other than one that still needs to be
  converted to the new base command, which will be fixed then) that
  aren't using runCapturingPrint to do so to reduce test log spam.
- Simplifies and standardizes the matcher used for ToolExit in tests.
2021-07-01 18:05:54 -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