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

Commit 272c82d

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 592b5b2 commit 272c82d

File tree

11 files changed

+485
-362
lines changed

11 files changed

+485
-362
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Updating pigeon-generated files
2+
3+
If you update files in the pigeons/ directory, run the following
4+
command in this directory:
5+
6+
```bash
7+
flutter pub get
8+
flutter pub run pigeon --input pigeons/messages.dart
9+
(cd ../../../; ./script/incremental_build.sh format --travis --clang-format=clang-format-7)
10+
```
11+
12+
If you update pigeon itself, first update the pubspec.yaml by adding
13+
the following to the `dependency_overrides` section, assuming you have
14+
checked out the `flutter/packages` repo in a sibling directory to the
15+
`plugins` repo:
16+
17+
```bash
18+
pigeon:
19+
path:
20+
../../../../packages/packages/pigeon/
21+
```
22+
23+
Then, run the commands above. When you run `pub get` it should warn
24+
you that you're using an override. If you do this, you may need to
25+
publish pigeon before you can land the updates to this package, since
26+
the CI tests run the analysis using latest published version of
27+
pigeon, not your version or the version on master.
28+
29+
In either case, the configuration will be obtained automatically from
30+
the `pigeons/messages.dart` file (see `configurePigeon` at the bottom
31+
of that file).

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

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

44
package io.flutter.plugins.videoplayer;
@@ -597,7 +597,7 @@ static void setup(BinaryMessenger binaryMessenger, VideoPlayerApi api) {
597597
private static HashMap wrapError(Exception exception) {
598598
HashMap<String, Object> errorMap = new HashMap<>();
599599
errorMap.put("message", exception.toString());
600-
errorMap.put("code", null);
600+
errorMap.put("code", exception.getClass().getSimpleName());
601601
errorMap.put("details", null);
602602
return errorMap;
603603
}

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.7), do not edit directly.
1+
// Autogenerated from Pigeon (v0.1.15), 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: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Autogenerated from Pigeon (v0.1.7), do not edit directly.
1+
// Autogenerated from Pigeon (v0.1.15), do not edit directly.
22
// See also: https://pub.dev/packages/pigeon
33
#import "messages.h"
44
#import <Flutter/Flutter.h>
@@ -59,9 +59,9 @@ + (FLTTextureMessage *)fromMap:(NSDictionary *)dict {
5959
return result;
6060
}
6161
- (NSDictionary *)toMap {
62-
return [NSDictionary
63-
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
64-
@"textureId", nil];
62+
return
63+
[NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]),
64+
@"textureId", nil];
6565
}
6666
@end
6767

@@ -112,10 +112,9 @@ + (FLTLoopingMessage *)fromMap:(NSDictionary *)dict {
112112
}
113113
- (NSDictionary *)toMap {
114114
return [NSDictionary
115-
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
116-
@"textureId",
117-
(self.isLooping != nil ? self.isLooping : [NSNull null]),
118-
@"isLooping", nil];
115+
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
116+
(self.isLooping ? self.isLooping : [NSNull null]), @"isLooping",
117+
nil];
119118
}
120119
@end
121120

@@ -134,9 +133,8 @@ + (FLTVolumeMessage *)fromMap:(NSDictionary *)dict {
134133
}
135134
- (NSDictionary *)toMap {
136135
return [NSDictionary
137-
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
138-
@"textureId", (self.volume != nil ? self.volume : [NSNull null]),
139-
@"volume", nil];
136+
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
137+
(self.volume ? self.volume : [NSNull null]), @"volume", nil];
140138
}
141139
@end
142140

@@ -155,9 +153,8 @@ + (FLTPlaybackSpeedMessage *)fromMap:(NSDictionary *)dict {
155153
}
156154
- (NSDictionary *)toMap {
157155
return [NSDictionary
158-
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
159-
@"textureId", (self.speed != nil ? self.speed : [NSNull null]),
160-
@"speed", nil];
156+
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
157+
(self.speed ? self.speed : [NSNull null]), @"speed", nil];
161158
}
162159
@end
163160

@@ -176,10 +173,9 @@ + (FLTPositionMessage *)fromMap:(NSDictionary *)dict {
176173
}
177174
- (NSDictionary *)toMap {
178175
return [NSDictionary
179-
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
180-
@"textureId",
181-
(self.position != nil ? self.position : [NSNull null]),
182-
@"position", nil];
176+
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
177+
(self.position ? self.position : [NSNull null]), @"position",
178+
nil];
183179
}
184180
@end
185181

@@ -194,7 +190,7 @@ + (FLTMixWithOthersMessage *)fromMap:(NSDictionary *)dict {
194190
}
195191
- (NSDictionary *)toMap {
196192
return [NSDictionary
197-
dictionaryWithObjectsAndKeys:(self.mixWithOthers != nil ? self.mixWithOthers : [NSNull null]),
193+
dictionaryWithObjectsAndKeys:(self.mixWithOthers ? self.mixWithOthers : [NSNull null]),
198194
@"mixWithOthers", nil];
199195
}
200196
@end

packages/video_player/video_player/pigeons/messages.dart

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

5353
void configurePigeon(PigeonOptions opts) {
5454
opts.dartOut = '../video_player_platform_interface/lib/messages.dart';
55+
opts.dartTestOut = '../video_player_platform_interface/lib/test.dart';
5556
opts.objcHeaderOut = 'ios/Classes/messages.h';
5657
opts.objcSourceOut = 'ios/Classes/messages.m';
5758
opts.objcOptions.prefix = 'FLT';

packages/video_player/video_player/pubspec.yaml

Lines changed: 11 additions & 3 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: 1.0.1
4+
version: 1.0.2
55
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
66

77
flutter:
@@ -28,13 +28,21 @@ dependencies:
2828

2929
flutter:
3030
sdk: flutter
31-
32-
dev_dependencies:
3331
flutter_test:
3432
sdk: flutter
33+
34+
dev_dependencies:
3535
pedantic: ^1.8.0
3636
pigeon: 0.1.7
3737

3838
environment:
3939
sdk: ">=2.8.0 <3.0.0"
4040
flutter: ">=1.12.13+hotfix.5 <2.0.0"
41+
42+
dependency_overrides:
43+
video_player_platform_interface:
44+
path:
45+
../video_player_platform_interface
46+
video_player_web:
47+
path:
48+
../video_player_web

packages/video_player/video_player/test/video_player_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import 'package:flutter/widgets.dart';
1414
import 'package:flutter_test/flutter_test.dart';
1515
import 'package:video_player/video_player.dart';
1616
import 'package:video_player_platform_interface/messages.dart';
17+
import 'package:video_player_platform_interface/test.dart';
1718
import 'package:video_player_platform_interface/video_player_platform_interface.dart';
1819

1920
class FakeController extends ValueNotifier<VideoPlayerValue>

0 commit comments

Comments
 (0)