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

Commit 2007446

Browse files
committed
Document how to use pigeon and update to the latest version.
This mainly splits out the test logic from the messages.dart file.
1 parent 4df0880 commit 2007446

File tree

9 files changed

+100
-11
lines changed

9 files changed

+100
-11
lines changed

packages/video_player/video_player/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.0-nullsafety.10
2+
3+
* Updated to video_player_platform_interface 4.0.
4+
15
## 2.0.0-nullsafety.9
26

37
* Fixed an issue where a crash can occur after a closing a video player view on iOS.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
## Updating pigeon-generated files
2+
3+
If you update files in the pigeons/ directory, run the following
4+
command in this directory (ignore the errors you get about
5+
dependencies in the examples directory):
6+
7+
```bash
8+
flutter pub upgrade
9+
flutter pub run pigeon --dart_null_safety --input pigeons/messages.dart
10+
# git commit your changes so that your working environment is clean
11+
(cd ../../../; ./script/incremental_build.sh format --travis --clang-format=clang-format-7)
12+
```
13+
14+
If you update pigeon itself and want to test the changes here,
15+
temporarily update the pubspec.yaml by adding the following to the
16+
`dependency_overrides` section, assuming you have checked out the
17+
`flutter/packages` repo in a sibling directory to the `plugins` repo:
18+
19+
```yaml
20+
pigeon:
21+
path:
22+
../../../../packages/packages/pigeon/
23+
```
24+
25+
Then, run the commands above. When you run `pub get` it should warn
26+
you that you're using an override. If you do this, you will need to
27+
publish pigeon before you can land the updates to this package, since
28+
the CI tests run the analysis using latest published version of
29+
pigeon, not your version or the version on master.
30+
31+
In either case, the configuration will be obtained automatically from
32+
the `pigeons/messages.dart` file (see `configurePigeon` at the bottom
33+
of that file).
34+
35+
While contributing, you may also want to set the following dependency
36+
overrides:
37+
38+
```yaml
39+
dependency_overrides:
40+
video_player_platform_interface:
41+
path:
42+
../video_player_platform_interface
43+
video_player_web:
44+
path:
45+
../video_player_web
46+
```
47+
48+
## Publishing plugin updates that span multiple plugin packages
49+
50+
If your change affects both the interface package and the
51+
implementation packages, then you will need to publish a version of
52+
the plugin in between landing the interface changes and the
53+
implementation changes, since the implementations depend on the
54+
interface via pub.
55+
56+
To do this, follow these steps:
57+
58+
1. Create a PR that has all the changes, and update the
59+
`pubspec.yaml`s to have path-based dependency overrides as described
60+
in the "Updating pigeon-generated files" section above.
61+
62+
2. Upload that PR and get it reviewed and into a state where the only
63+
test failure is the one complaining that you can't publish a package
64+
that has dependency overrides.
65+
66+
3. Create a PR that's a subset of the one in the previous step that
67+
only includes the interface changes, with no dependency overrides, and
68+
submit that.
69+
70+
4. Once you have had that reviewed and landed, publish the interface
71+
parts of the plugin to pub.
72+
73+
5. Now, update the original full PR to not use dependency overrides
74+
but to instead refer to the new version of the plugin, and sync it to
75+
master (so that the interface changes are gone from the PR). Submit
76+
that PR.
77+
78+
6. Once you have had _that_ PR reviewed and landed, publish the
79+
implementation parts of the plugin to pub.
80+
81+
You may need to publish each implementation package independently of
82+
the main package also, depending on exactly what your change entails.

packages/video_player/video_player/android/src/main/java/io/flutter/plugins/videoplayer/Messages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v0.1.12), do not edit directly.
1+
// Autogenerated from Pigeon (v0.1.19), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33

44
package io.flutter.plugins.videoplayer;

packages/video_player/video_player/ios/Classes/messages.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v0.1.12), do not edit directly.
1+
// Autogenerated from Pigeon (v0.1.19), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33
#import <Foundation/Foundation.h>
44
@protocol FlutterBinaryMessenger;

packages/video_player/video_player/ios/Classes/messages.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v0.1.12), do not edit directly.
1+
// Autogenerated from Pigeon (v0.1.19), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33
#import "messages.h"
44
#import <Flutter/Flutter.h>

packages/video_player/video_player/pigeons/messages.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ abstract class VideoPlayerApi {
5454

5555
void configurePigeon(PigeonOptions opts) {
5656
opts.dartOut = '../video_player_platform_interface/lib/messages.dart';
57+
opts.dartTestOut = '../video_player_platform_interface/lib/test.dart';
5758
opts.objcHeaderOut = 'ios/Classes/messages.h';
5859
opts.objcSourceOut = 'ios/Classes/messages.m';
5960
opts.objcOptions.prefix = 'FLT';

packages/video_player/video_player/pubspec.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: video_player
22
description: Flutter plugin for displaying inline video with other Flutter
33
widgets on Android, iOS, and web.
4-
version: 2.0.0-nullsafety.9
4+
version: 2.0.0-nullsafety.10
55
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
66

77
flutter:
@@ -17,23 +17,24 @@ flutter:
1717

1818
dependencies:
1919
meta: ^1.3.0-nullsafety.3
20-
video_player_platform_interface: ^3.0.0-nullsafety.3
20+
video_player_platform_interface: ^4.0.0-nullsafety.0
2121

2222
# The design on https://flutter.dev/go/federated-plugins was to leave
2323
# this constraint as "any". We cannot do it right now as it fails pub publish
24-
# validation, so we set a ^ constraint.
25-
# TODO(amirh): Revisit this (either update this part in the design or the pub tool).
24+
# validation, so we set a ^ constraint. The exact value doesn't matter since
25+
# the constraints on the interface pins it.
26+
# TODO(amirh): Revisit this (either update this part in the design or the pub tool).
2627
# https://github.com/flutter/flutter/issues/46264
2728
video_player_web: ^2.0.0-nullsafety.1
2829

2930
flutter:
3031
sdk: flutter
31-
32-
dev_dependencies:
3332
flutter_test:
3433
sdk: flutter
34+
35+
dev_dependencies:
3536
pedantic: ^1.10.0-nullsafety.1
36-
pigeon: 0.1.7
37+
pigeon: ^0.1.19
3738

3839
environment:
3940
sdk: ">=2.12.0-0 <3.0.0"

packages/video_player/video_player/test/video_player_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:flutter/widgets.dart';
1212
import 'package:flutter_test/flutter_test.dart';
1313
import 'package:video_player/video_player.dart';
1414
import 'package:video_player_platform_interface/messages.dart';
15+
import 'package:video_player_platform_interface/test.dart';
1516
import 'package:video_player_platform_interface/video_player_platform_interface.dart';
1617

1718
class FakeController extends ValueNotifier<VideoPlayerValue>

script/incremental_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ALL_EXCLUDED=("")
1212
# Exclude nnbd plugins from stable.
1313
if [ "$CHANNEL" == "stable" ]; then
1414
ALL_EXCLUDED=($EXCLUDED_PLUGINS_FROM_STABLE)
15-
echo "Excluding the following plugins: $ALL_EXCLUDED"
15+
echo "Excluding the following plugins because stable does not yet support NNBD: $ALL_EXCLUDED"
1616
fi
1717

1818
# Plugins that deliberately use their own analysis_options.yaml.

0 commit comments

Comments
 (0)