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 Dec 17, 2020
1 parent b2e9ca5 commit 666fb08
Show file tree
Hide file tree
Showing 13 changed files with 479 additions and 374 deletions.
44 changes: 44 additions & 0 deletions packages/video_player/video_player/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Updating pigeon-generated files

If you update files in the pigeons/ directory, run the following
command in this directory:

```bash
flutter pub get
flutter pub run pigeon --dart_null_safety --input pigeons/messages.dart
(cd ../../../; ./script/incremental_build.sh format --travis --clang-format=clang-format-7)
```

If you update pigeon itself, 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
```
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.17), do not edit directly.
// See also: https://pub.dev/packages/pigeon

package io.flutter.plugins.videoplayer;
Expand Down
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.17), 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.17), 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
9 changes: 3 additions & 6 deletions packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
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.4
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player

Expand Down Expand Up @@ -31,12 +28,12 @@ dependencies:

flutter:
sdk: flutter

dev_dependencies:
flutter_test:
sdk: flutter

dev_dependencies:
pedantic: ^1.10.0-nullsafety.1
pigeon: 0.1.7
pigeon: ^0.1.17

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
Loading

0 comments on commit 666fb08

Please sign in to comment.