From cbee8561c07495d542ccca6dc8572bd0b4c92cd9 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Tue, 16 Feb 2021 20:46:04 -0800 Subject: [PATCH] Document how to use pigeon and update to the latest version. (#3281) --- .../video_player/video_player/CHANGELOG.md | 4 + .../video_player/video_player/CONTRIBUTING.md | 82 +++++++++++++++++++ .../flutter/plugins/videoplayer/Messages.java | 2 +- .../video_player/ios/Classes/messages.h | 2 +- .../video_player/ios/Classes/messages.m | 2 +- .../video_player/pigeons/messages.dart | 1 + .../video_player/video_player/pubspec.yaml | 15 ++-- .../video_player/test/video_player_test.dart | 1 + script/incremental_build.sh | 2 +- 9 files changed, 100 insertions(+), 11 deletions(-) create mode 100644 packages/video_player/video_player/CONTRIBUTING.md diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md index 2e8f7396c618a..0cabfc48226d3 100644 --- a/packages/video_player/video_player/CHANGELOG.md +++ b/packages/video_player/video_player/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.0-nullsafety.10 + +* Updated to video_player_platform_interface 4.0. + ## 2.0.0-nullsafety.9 * Fixed an issue where a crash can occur after a closing a video player view on iOS. diff --git a/packages/video_player/video_player/CONTRIBUTING.md b/packages/video_player/video_player/CONTRIBUTING.md new file mode 100644 index 0000000000000..32c9d1b791d18 --- /dev/null +++ b/packages/video_player/video_player/CONTRIBUTING.md @@ -0,0 +1,82 @@ +## Updating pigeon-generated files + +If you update files in the pigeons/ directory, run the following +command in this directory (ignore the errors you get about +dependencies in the examples directory): + +```bash +flutter pub upgrade +flutter pub run pigeon --dart_null_safety --input pigeons/messages.dart +# git commit your changes so that your working environment is clean +(cd ../../../; ./script/incremental_build.sh format --travis --clang-format=clang-format-7) +``` + +If you update pigeon itself and want to test the changes here, +temporarily update the pubspec.yaml by adding the following to the +`dependency_overrides` section, assuming you have checked out the +`flutter/packages` repo in a sibling directory to the `plugins` repo: + +```yaml + pigeon: + path: + ../../../../packages/packages/pigeon/ +``` + +Then, run the commands above. When you run `pub get` it should warn +you that you're using an override. If you do this, you will need to +publish pigeon before you can land the updates to this package, since +the CI tests run the analysis using latest published version of +pigeon, not your version or the version on master. + +In either case, the configuration will be obtained automatically from +the `pigeons/messages.dart` file (see `configurePigeon` at the bottom +of that file). + +While contributing, you may also want to set the following dependency +overrides: + +```yaml +dependency_overrides: + video_player_platform_interface: + path: + ../video_player_platform_interface + video_player_web: + path: + ../video_player_web +``` + +## Publishing plugin updates that span multiple plugin packages + +If your change affects both the interface package and the +implementation packages, then you will need to publish a version of +the plugin in between landing the interface changes and the +implementation changes, since the implementations depend on the +interface via pub. + +To do this, follow these steps: + +1. Create a PR that has all the changes, and update the +`pubspec.yaml`s to have path-based dependency overrides as described +in the "Updating pigeon-generated files" section above. + +2. Upload that PR and get it reviewed and into a state where the only +test failure is the one complaining that you can't publish a package +that has dependency overrides. + +3. Create a PR that's a subset of the one in the previous step that +only includes the interface changes, with no dependency overrides, and +submit that. + +4. Once you have had that reviewed and landed, publish the interface +parts of the plugin to pub. + +5. Now, update the original full PR to not use dependency overrides +but to instead refer to the new version of the plugin, and sync it to +master (so that the interface changes are gone from the PR). Submit +that PR. + +6. Once you have had _that_ PR reviewed and landed, publish the +implementation parts of the plugin to pub. + +You may need to publish each implementation package independently of +the main package also, depending on exactly what your change entails. diff --git a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java b/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java index 98cf6dbaacea5..053e3faa96942 100644 --- a/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java +++ b/packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.12), do not edit directly. +// Autogenerated from Pigeon (v0.1.19), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.videoplayer; diff --git a/packages/video_player/video_player/ios/Classes/messages.h b/packages/video_player/video_player/ios/Classes/messages.h index 84e8fc5e5cff5..80137c9d61f50 100644 --- a/packages/video_player/video_player/ios/Classes/messages.h +++ b/packages/video_player/video_player/ios/Classes/messages.h @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.12), do not edit directly. +// Autogenerated from Pigeon (v0.1.19), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @protocol FlutterBinaryMessenger; diff --git a/packages/video_player/video_player/ios/Classes/messages.m b/packages/video_player/video_player/ios/Classes/messages.m index 58ff7292d2b2d..3f787fcdf92d3 100644 --- a/packages/video_player/video_player/ios/Classes/messages.m +++ b/packages/video_player/video_player/ios/Classes/messages.m @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v0.1.12), do not edit directly. +// Autogenerated from Pigeon (v0.1.19), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "messages.h" #import diff --git a/packages/video_player/video_player/pigeons/messages.dart b/packages/video_player/video_player/pigeons/messages.dart index f1771afecb450..ebef9e526b6a5 100644 --- a/packages/video_player/video_player/pigeons/messages.dart +++ b/packages/video_player/video_player/pigeons/messages.dart @@ -54,6 +54,7 @@ abstract class VideoPlayerApi { void configurePigeon(PigeonOptions opts) { opts.dartOut = '../video_player_platform_interface/lib/messages.dart'; + opts.dartTestOut = '../video_player_platform_interface/lib/test.dart'; opts.objcHeaderOut = 'ios/Classes/messages.h'; opts.objcSourceOut = 'ios/Classes/messages.m'; opts.objcOptions.prefix = 'FLT'; diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml index 47b8f601e7118..e21315025005f 100644 --- a/packages/video_player/video_player/pubspec.yaml +++ b/packages/video_player/video_player/pubspec.yaml @@ -1,7 +1,7 @@ name: video_player description: Flutter plugin for displaying inline video with other Flutter widgets on Android, iOS, and web. -version: 2.0.0-nullsafety.9 +version: 2.0.0-nullsafety.10 homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player flutter: @@ -17,23 +17,24 @@ flutter: dependencies: meta: ^1.3.0-nullsafety.3 - video_player_platform_interface: ^3.0.0-nullsafety.3 + video_player_platform_interface: ^4.0.0-nullsafety.0 # The design on https://flutter.dev/go/federated-plugins was to leave # this constraint as "any". We cannot do it right now as it fails pub publish - # validation, so we set a ^ constraint. - # TODO(amirh): Revisit this (either update this part in the design or the pub tool). + # validation, so we set a ^ constraint. The exact value doesn't matter since + # the constraints on the interface pins it. + # TODO(amirh): Revisit this (either update this part in the design or the pub tool). # https://github.com/flutter/flutter/issues/46264 video_player_web: ^2.0.0-nullsafety.1 flutter: sdk: flutter - -dev_dependencies: flutter_test: sdk: flutter + +dev_dependencies: pedantic: ^1.10.0-nullsafety.1 - pigeon: 0.1.7 + pigeon: ^0.1.19 environment: sdk: ">=2.12.0-0 <3.0.0" diff --git a/packages/video_player/video_player/test/video_player_test.dart b/packages/video_player/video_player/test/video_player_test.dart index eb276a8d72e78..582012097b71d 100644 --- a/packages/video_player/video_player/test/video_player_test.dart +++ b/packages/video_player/video_player/test/video_player_test.dart @@ -12,6 +12,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:video_player/video_player.dart'; import 'package:video_player_platform_interface/messages.dart'; +import 'package:video_player_platform_interface/test.dart'; import 'package:video_player_platform_interface/video_player_platform_interface.dart'; class FakeController extends ValueNotifier diff --git a/script/incremental_build.sh b/script/incremental_build.sh index d98e7aac6e305..bc41ebd3c70d7 100755 --- a/script/incremental_build.sh +++ b/script/incremental_build.sh @@ -12,7 +12,7 @@ ALL_EXCLUDED=("") # Exclude nnbd plugins from stable. if [ "$CHANNEL" == "stable" ]; then ALL_EXCLUDED=($EXCLUDED_PLUGINS_FROM_STABLE) - echo "Excluding the following plugins: $ALL_EXCLUDED" + echo "Excluding the following plugins because stable does not yet support NNBD: $ALL_EXCLUDED" fi # Plugins that deliberately use their own analysis_options.yaml.