[analysis_server] Small fixes for test-package-generating script
* Was missing a json_annotations import in the first lib.
* Indentation.
Change-Id: Ib0c4ffad18871a23796676e3cd4d297017fd47b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288982
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/analysis_server/tool/generate_testing_package.dart b/pkg/analysis_server/tool/generate_testing_package.dart
index b86d366..afb7732 100644
--- a/pkg/analysis_server/tool/generate_testing_package.dart
+++ b/pkg/analysis_server/tool/generate_testing_package.dart
@@ -84,12 +84,11 @@
var importIndexStep =
importGraphTier == 0 ? -1 : (lIndex - 1) ~/ importGraphTier;
var content = StringBuffer();
+ if (useJsonSerializable) {
+ content.writeln("import 'package:json_annotation/json_annotation.dart';");
+ }
// Add imports in a library above tier 0.
if (importGraphTier > 0) {
- if (useJsonSerializable) {
- content
- .writeln("import 'package:json_annotation/json_annotation.dart';");
- }
if (useBarrelFile && lIndex > middleImportIndex) {
content.writeln(import(testPackageLibUri('barrel.dart')));
}
@@ -136,7 +135,7 @@
content.writeln(
' factory C$classCounter.fromJson(Map<String, dynamic> json) => '
'_\$C${classCounter}FromJson(json);');
- content.writeln('Map<String, dynamic> toJson() => '
+ content.writeln(' Map<String, dynamic> toJson() => '
'_\$C${classCounter}ToJson(this);');
}
for (var mIndex = 1; mIndex <= methodCount; mIndex++) {