69 Commits

Author SHA1 Message Date
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
ce948ce3cb [flutter_plugin_tools] Complete migration to NNBD (#4048) 2021-06-12 12:44:04 -07:00
038c1796b0 [flutter_plugin_tools] Migrate publish and version checks to NNBD (#4037)
Migrates publish-check and version-check commands to NNBD.

Reworks the version-check flow so that it's more consistent with the other commands: instead of immediately exiting on failure, it checks all plugins, gathers failures, and summarizes all failures at the end. This ensures that we don't have failures in one package temporarily masked by failures in another, so PRs don't need to go through as many check cycles.

Part of https://github.com/flutter/flutter/issues/81912
2021-06-11 19:10:41 -04:00
cb92e5d416 Enable macOS XCTest support (#4043)
- Adds macOS support to the `xctest` tool command
- Adds logic to the tool to check for packages that delegate their implementations
  to another package, so they can be skipped when running native unit tests
  - Updates the tool's unit test utility for writing pubspecs to be able to make
    delegated federated implementation references to test it
- Adds initial unit tests to the non-deprecated macOS plugins
- Enables macOS XCTesting in CI

macOS portion of https://github.com/flutter/flutter/issues/82445
2021-06-10 17:50:20 -04:00
b98034dd76 [flutter_plugin_tools] Migrate more commands to NNBD (#4026)
Migrates:
- `all_plugins_app`
- `podspecs`
- `firebase-test-lab`

Minor functional changes to `firebase-test-lab` based on issues highlighted by the migration:
- The build ID used in the path is now a) passable, and b) given a fallback value in the path that
  isn't "null"
- Flag setup will no longer assume that `$HOME` must be set in the environment.
- Adds a --build-id flag to `firebase-test-lab` instead of hard-coding the use of  `CIRRUS_BUILD_ID`.
  The default is still `CIRRUS_BUILD_ID` so no CI changes are needed.

Part of https://github.com/flutter/flutter/issues/81912
2021-06-09 11:00:04 -07:00
181fe18e27 [flutter_plugin_tools] Migrate xctest command to NNBD (#4024) 2021-06-07 11:44:05 -07:00
d491b95e69 [flutter_plugin_tools] Remove xctest's --skip (#4022) 2021-06-07 11:29:07 -07:00
74d03857f8 [flutter_plugin_tools] Remove global state from tests (#4018)
Eliminates the global test filesystem and global test packages directory, in favor of local versions. This guarantees that each test runs with a clean filesystem state, rather than relying on cleanup. It also simplifies understanding the tests, since everything is done via params and return values instead of needing to know about the magic global variables and which methods mutate them.
2021-06-07 10:04:43 -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
533596f798 Enable linting of macOS podspecs (#4015)
- Removes the .cirrus.yml workaround that removed macOS podspecs before linting
- Deletes the dummy macOS podspecs that are no longer needed due to `flutter` fixes
- Adds --use-modular-headers to the lint command to reflect what Flutter Podfiles do
- Fix the actual issues in the podspecs
2021-06-04 19:48:31 -04:00
612be3575b Remove "unnecessary" imports. (#4012) 2021-06-04 10:24:05 -07:00
9c15a2b4ce Some small documentation fixes (#3999)
* Two small documentation fixes

* Fix url to plugin_tool format
2021-06-02 17:40:17 +02:00
407572bc04 [script/tool] Use 'dart pub' instead of deprecated 'pub' (#3991) 2021-06-01 12:17:21 -04:00
d21b1d9706 Add pubspec convention checks (#3984) 2021-05-27 20:54:06 -07:00
93047fff2f [script/tool] speed up the pub get portion of the analyze command (#3982) 2021-05-27 11:54:03 -07:00
6a8e6da028 use 'flutter pub get' for both dart and flutter packages (#3973) 2021-05-27 07:38:26 -07:00
b07809952c Allow reverts when checking versions (#3981)
If a new version is lower than the current checked-in version, and the
transition from the new version to the old version is valid (indicating
that it could have been the previous version), allow the change.

This prevents the version check from failing when reverting a PR.
This is not fool-proof (e.g., it would allow a revert of an
already-published PR); if we have issues in practice we can further
restrict the check (by checking that the new version is the current pub
version, for instance).
2021-05-27 07:10:14 -07:00
544cab7f39 add a --dart-sdk option to the repo analysis command (#3959) 2021-05-24 08:44:06 -07:00
04181cf38c Fix publish-check output (#3953) 2021-05-24 08:39:05 -07:00
c6a5122ace Remove codesign overrides from xctest command (#3952)
Workaround for https://github.com/flutter/flutter/issues/83048
2021-05-20 14:13:47 -07:00
7cf08e5683 Make run-on-changed-packages flag handle repo-level changes (#3946)
Changes to some files (e.g., CI scripts) have the potential to cause
failures in any packages, without changes to those packages themselves.
This updates the --run-on-changed-packages to consider all packages as
changed if any of those files are changed, to avoid issues where a
change that changes both some repo-level files and some package-specific
files only run presubmit tests on the packages that are directly
changed, causing post-submit-only failures.

Fixes https://github.com/flutter/flutter/issues/82965
2021-05-20 11:27:30 -07:00
89fc7cebb3 Bump min Android SDK to the version required at runtime (#3894) 2021-05-17 12:13:59 -07:00
842ae94fde Migrate some tool commands to NNBD (#3899)
Now that individual commands can be migrated, migrate several commands
that are trivially migratable.

Part of https://github.com/flutter/flutter/issues/81912
2021-05-17 11:25:01 -07:00
bd0081258a Begin migrating tools to NNBD (#3891)
- Updates dependencies to null-safe versions
- Migrates common.dart (which doesn't depend on anything)
- Migrates common_tests.dart and its one dependency, utils.dart
- Adds build_runner for Mockito mock generation
- Adds a new utility methods for getting arguments that handle both the casting and the removal of nullability to address a common problematic pattern while migrating code.
  - Converts all files, not just the migrated ones, to those new helpers.

Migrating common.dart and utils.dart should unblock a command-by-command migration to null safety.

Reverts the separate of podspect lints into a step that doesn't do a Flutter upgrade
(https://github.com/flutter/plugins/pull/3700) because without that step we had a
version of Dart too old to run null-safe tooling.

First step of https://github.com/flutter/flutter/issues/81912
2021-05-14 20:04:26 -04:00
e46aa5583f Update tool README for packages use (#3882)
Updates to better reflect that this tooling is still used in flutter/packages, and how that differs from the flutter/plugins usage.
2021-05-14 20:03:23 -04:00
f7f736a966 Revert "Temporarily run Windows tests via GitHub Actions (#3875)" (#3885) 2021-05-13 10:14:04 -07:00
3e28166394 [tool] add an skip-confirmation flag to publish-package for running the command on ci (#3842)
the skip-confirmation flag will add a --force flag to pub publish, it will also let users to skip the y/n question when pushing tags to remote.

Fixes flutter/flutter#79830
2021-05-11 14:39:58 -07:00
ec7bf3b464 Temporarily run Windows tests via GitHub Actions (#3875)
Until the infrastructure limitations that led to flutter/flutter#82032 are fixed, run basic Windows tests via GitHub Actions (which do have VS available) so that we aren't missing all Windows coverage.
2021-05-11 13:08:01 -07:00
87cfd6ab03 [tool] version-check publish-check commands can check against pub (#3840)
Add a PubVersionFinder class to easily fetch the version from pub.

Add an against-pub flag to check-version command, which allows it to check the version against pub server

Make the 'publish-check' command to check against pub to determine if the specific versions of packages need to be published.
Add a log-status flag, which allows the publish-check command to log the final status of the result. This helps other ci tools to easily grab the results and use it to determine what to do next. See option 3 in flutter/flutter#81444

This PR also fixes some tests.

partially flutter/flutter#81444
2021-05-11 12:48:30 -07:00
ce899a3151 Ensure that integration tests are actually being run (#3857)
Many of our integration tests weren't actually being run on CI because they were in the wrong place and/or missing the driver file, and it seems we've just never noticed. This makes a number of changes:
- Ensures that all packages with integration tests also have a driver file in the right location.
  - Also standardizes the format of those files, as the boilerplate `main()` is available in `integration_test`.
- Ensures that all integration_test directories are in the right place.
  - In a couple of places, removes a duplicate copy of the integration test file.
- Makes it an error for a plugin that's not excluded to not have integration tests, so this can't easily happen again.
- Adds logging of what's being run and skipped, so if something does go wrong in the future it's easy to determine what from the logs.
  - Excludes `*_platform_interface` since the logging was (potentially confusingly) reporting that they were skipped because they don't support the current platform. Skipping them is correct, just not for that reason.
- Excludes the plugins that currently have no integration tests, with references to issues about adding them.

Fixes https://github.com/flutter/flutter/issues/81929
2021-05-10 11:14:45 -07:00
41df811fbd Fix analyzer issues (#3863)
* Make infos fatal when analyzing packages
* Fix import ordering for updated analysis
2021-05-07 11:10:03 -07:00
755de9be8a Move incremental_build.sh to run-on-changed-packages (#3846)
Switch incremental_build.sh from using the older check_changed_packages
implemented in bash to the newer (tested/testable) Dart implementation
via --run-onchanged-packages.

Also clarifies in help that the flag runs on all packages when nothing
has changed.
2021-05-07 09:42:20 -07:00
8bec6598a5 Add support for third_party packages in Dart code (#3847)
flutter/packages has two packages in third_party/packages/, which wasn't something our tooling recognized, so no package-based CI checks are running on them. This adds knowledge that there can be a third_party/packages/ directory as a sibling of the primary packages directory.

Also migrates common_tests off of the shared (now deprecated) mock filesystem and onto a test-local mock filesystem.

Fixes flutter/flutter#81570
2021-05-07 09:41:21 -07:00
53c8d479d4 Enable analysis for the tool directory (#3853)
Since the tooling doesn't live in packages/, we're not currently analyzing it. This enables analysis so that we won't have analyzer issues creeping in over time.

To minimize complexity, this just adds it directly to the Cirrus configuration rather than building knowledge of the tool directory into the tool itself.
2021-05-07 09:40:28 -07:00
a0ca28bac6 Update third_party license checking (#3844)
In preparation for enabling license checks in flutter/packages, update
the allowed licenses:
- Allow our license, for cases where we've locally added files
- Allow the license used by the bsdiff package
2021-05-04 10:53:44 -07:00
184e9a7023 [tool] add all and dry-run flags to publish-plugin command (#3776) 2021-04-30 15:29:04 -07:00
2bd3f401a7 Re-add bin/ to flutter_plugin_tools (#3839)
This should have been re-added in #3836 but was missed, so it doesn't
work correctly via `pub global`.
2021-04-30 12:47:14 -07:00
142fc9793d switch from using 'tuneup' to analyze to 'dart analyze' (#3837) 2021-04-30 07:02:19 -07:00
fe6b847932 Prep the tools for publishing (#3836)
Re-adds the LICENSE and CHANGELOG, and updates the README and pubspec,
in preparation for pushing an updated version of the package.

We are still using flutter_plugin_tools in flutter/packages, so this
allows us to use updates (e.g., license checks, fixed version checks) in
that repository as well. The README has been updated to note that it is
no longer intended for general use, and we will (if it allows
publishing) continue to mark the package as discontinued to reflect
that.
2021-04-29 20:05:38 -07:00
189845bb8a [tool] combine run and runAndExitOnError (#3827) 2021-04-27 09:35:05 -07:00
3c57df37c0 Move all null safety packages' min dart sdk to 2.12.0 (#3822) 2021-04-23 10:19:03 -07:00
c4170d8f64 [tools] fix version check command not working for new packages (#3818) 2021-04-21 16:40:20 -07:00
63d42fcdb9 Update PULL_REQUEST_TEMPLATE.md (#3801) 2021-04-20 04:24:02 -07:00
b2eefc9158 Fix and update version checks (#3792)
Currently our version update checks aren't actually working; the script doesn't work correctly if no explicit --base-sha is passed, but that's always how CI is calling it.

Fixes https://github.com/flutter/flutter/issues/79823 (and version checks in general)

This makes a number of changes:
- Fixes it to work without --base-sha
- Adds tests that it works in that mode
  - And tightens existing tests to require ToolExit, not just any error, to reduce false-positive test success
- Adds verbose logging of the checks being done, to make it easier to debug this kind of issue in the future
- Tightens the exception handling for missing previous versions to just the line that's expected to fail in that case
- Only allows missing versions when "publish_to: none" is set
  - Adds that everywhere it's missing
  - Standardize the format in the repo to "none" (instead of also having "'none'").
- Allows the use of NEXT in CHANGELOG as a way of gathering changes that are worth noting, but not
  doing a publish cycle for. (Replaces the plan of using -dev versions, since that's actually harder to implement,
  and more confusing.)
  - Ensures that we don't forget to clean up NEXT entries when bumping versions
2021-04-08 16:22:19 -04:00
3d9e523218 Switch script/tools over to the new analysis options (#3777)
Removes the legacy analysis options override and fixes all resulting issues. This is a combination of dart fix and manual changes (mostly mechanical, but some small restructuring to address warnings more cleanly, such as creating typed structs from args when they are used repeatedly to avoid repeated casting, or making things that were unnecessarily public private).

One small opportunistic extra cleanup is that the handling of null-safety prerelease versions is removed, as any new plugin would be written null-safe from the start, so we no longer need to allow those versions.

Part of flutter/flutter#76229
2021-04-06 13:04:25 -07:00
5ea4d5fdfc [tool] refactor publish plugin command (#3779) 2021-04-05 13:54:05 -07:00
b8b7ef5cd5 Update build-all test for null-safe template (#3773)
Flutter master now creates NNBD code when running 'flutter create', so
the generated pubspec for build_all needs to use a compatible SDK
version. This updates from 2.0.0 to 2.12.0.

Also includes a test for this, which involved setting up tests for the
file, and doing some refactoring to make the command testable. As a
result, this fixes https://github.com/flutter/flutter/issues/61049
(although more test backfill is needed).
2021-03-30 13:34:20 -07:00
b98ea9175b Add tests for publish check tool command (#3760) 2021-03-29 07:27:40 -10:00
e8f4aea298 [ci] Do not use empty exclude directories in analyze_command. (#3748)
* Add CUSTOM_ANALYSIS_PLUGINS back with all the plugins that now have a custom analysis_options.yaml
2021-03-24 15:56:40 -07:00
8143dc2673 [flutter_plugin_tools] Also look for Java tests in plugin path (#3742) 2021-03-24 12:20:04 -07:00