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

Commit

Permalink
Document how to use pigeon and update to the latest version.
Browse files Browse the repository at this point in the history
This mainly splits out the test logic from the messages.dart file.
  • Loading branch information
Hixie committed Feb 9, 2021
1 parent 2919660 commit 1430e12
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 19 deletions.
4 changes: 4 additions & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
79 changes: 79 additions & 0 deletions packages/video_player/video_player/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## 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:

```bash
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.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#import <Flutter/Flutter.h>

@interface FLTVideoPlayerPlugin : NSObject <FlutterPlugin>
@interface FLTVideoPlayerPlugin : NSObject<FlutterPlugin>
@end
2 changes: 1 addition & 1 deletion packages/video_player/video_player/ios/Classes/messages.h
Original file line number Diff line number Diff line change
@@ -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 <Foundation/Foundation.h>
@protocol FlutterBinaryMessenger;
Expand Down
4 changes: 1 addition & 3 deletions packages/video_player/video_player/ios/Classes/messages.m
Original file line number Diff line number Diff line change
@@ -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 <Flutter/Flutter.h>
Expand All @@ -7,7 +7,6 @@
#error File requires ARC to be enabled.
#endif

#ifndef __clang_analyzer__
static NSDictionary *wrapResult(NSDictionary *result, FlutterError *error) {
NSDictionary *errorDict = (NSDictionary *)[NSNull null];
if (error) {
Expand Down Expand Up @@ -362,4 +361,3 @@ void FLTVideoPlayerApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTVi
}
}
}
#endif
1 change: 1 addition & 0 deletions packages/video_player/video_player/pigeons/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
18 changes: 8 additions & 10 deletions packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: video_player
description: Flutter plugin for displaying inline video with other Flutter
widgets on Android, iOS, and web.
# 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
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:
Expand All @@ -20,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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<VideoPlayerValue>
Expand Down
4 changes: 4 additions & 0 deletions packages/video_player/video_player_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.0-nullsafety.3

* Updated to video_player_platform_interface 4.0.

## 2.0.0-nullsafety.2

* Fixed an issue where `isBuffering` was not updating on Web.
Expand Down
4 changes: 2 additions & 2 deletions packages/video_player/video_player_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/v
# 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 2.0.0-nullsafety.2
version: 2.0.0-nullsafety.3

flutter:
plugin:
Expand All @@ -19,7 +19,7 @@ dependencies:
flutter_web_plugins:
sdk: flutter
meta: ^1.3.0-nullsafety.3
video_player_platform_interface: ^3.0.0-nullsafety.3
video_player_platform_interface: ^4.0.0-nullsafety.0

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion script/incremental_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1430e12

Please sign in to comment.