Skip to content

Commit db1d692

Browse files
committed
Don't require json_annotation in dependencies if it's just used in tests
Fixes google#1014 Prepare to release v6.0.1
1 parent 94d419c commit db1d692

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

json_serializable/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.0.1
2+
3+
- Don't require `json_annotation` in `dependencies` if it's just used in tests.
4+
15
## 6.0.0
26

37
- Added support for `JsonSerializable.constructor` to allow specifying an

json_serializable/lib/src/json_part_builder.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class _UnifiedGenerator extends Generator {
5252

5353
@override
5454
Future<String?> generate(LibraryReader library, BuildStep buildStep) async {
55-
await pubspecHasRightVersion(buildStep);
56-
5755
final values = <String>{};
5856

5957
for (var generator in _generators) {
6058
for (var annotatedElement
6159
in library.annotatedWith(generator.typeChecker)) {
60+
await pubspecHasRightVersion(buildStep);
61+
6262
final generatedValue = generator.generateForAnnotatedElement(
6363
annotatedElement.element, annotatedElement.annotation, buildStep);
6464
for (var value in _normalizeGeneratorOutput(generatedValue)) {

json_serializable/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: json_serializable
2-
version: 6.0.0
2+
version: 6.0.1
33
description: >-
44
Automatically generate code for converting to and from JSON by annotating
55
Dart classes.

json_serializable/test/annotation_version_test.dart

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ Future<void> _structurePackage({
132132

133133
await d.file('pubspec.yaml', pubspec).create();
134134

135+
/// A file in the lib directory without JsonSerializable should do nothing!
136+
await d.dir(
137+
'lib',
138+
[
139+
d.file('no_op.dart', '''
140+
class NoOp {}
141+
''')
142+
],
143+
).create();
144+
135145
await d.dir(
136146
sourceDirectory,
137147
[
@@ -155,18 +165,17 @@ class SomeClass{}
155165
workingDirectory: d.sandbox,
156166
);
157167

158-
await proc.stdoutStream().forEach(print);
168+
final lines = StringBuffer();
169+
await for (var line in proc.stdoutStream()) {
170+
lines.writeln(line);
171+
print(line);
172+
}
159173

160-
await expectLater(
161-
proc.stdout,
162-
emitsThrough(
163-
emitsInOrder([
164-
'[SEVERE] json_serializable:json_serializable on $sourceDirectory/sample.dart:',
165-
'',
166-
message,
167-
]),
168-
),
169-
);
174+
expect(lines.toString(), contains('''
175+
[SEVERE] json_serializable:json_serializable on $sourceDirectory/sample.dart:
176+
177+
$message
178+
'''));
170179

171180
await proc.shouldExit(1);
172181
}

0 commit comments

Comments
 (0)