Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Fix and test for 'implements' pubspec entry #4242

Merged
merged 5 commits into from
Aug 20, 2021

Conversation

stuartmorgan-g
Copy link
Contributor

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 flutter/flutter#88222

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

bool passing = _checkSectionOrder(pubspecLines, sectionOrder);
if (!passing) {
print('${indentation}Major sections should follow standard '
printError('${indentation}Major sections should follow standard '
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor opportunistic cleanup; I think printError didn't exist yet when I wrote this code.

containsAllInOrder(<Matcher>[
contains(
'Found a "homepage" entry; only "repository" should be used.'),
]),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are opportunistic cleanup; I noticed when duplicating tests as a starting point that when I wrote these tests I copied from what I have since discovered is an anti-pattern: not checking the details of the output on failures, which means failure tests can pass for the wrong reasons. This commandError+output pattern is what I've been applying throughout the codebase as I find the older style.

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -2,7 +2,7 @@ name: camera_web
description: A Flutter plugin for getting information about and controlling the camera on Web.
repository: https://github.com/flutter/plugins/tree/master/packages/camera/camera_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.1.0
version: 0.1.0+1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implements was not added to this yaml, but the test doesn't seem to be failing in CI? /cc @stuartmorgan

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accidentally put the new check in the section of the command that doesn't run for publish_to: none packages, so it didn't catch my mistake here. I'll fix that tomorrow.

fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
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 flutter/flutter#88222
amantoux pushed a commit to amantoux/plugins that referenced this pull request Sep 27, 2021
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 flutter/flutter#88222
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[plugins] Inconsistent implements in federated plugins' pubspec.yaml
3 participants