Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: pkg/analysis_server/tool/spec/codegen_inttest_methods.dart

Issue 2844273003: Unify the server and plugin versions of the generators (Closed)
Patch Set: add missed files Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/tool/spec/codegen_inttest_methods.dart
diff --git a/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart b/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart
index 70fad23b26160de64beaed42e5780863dc0bd38a..2da079c677f5920da3f775517a0d2491d7d5fc73 100644
--- a/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart
+++ b/pkg/analysis_server/tool/spec/codegen_inttest_methods.dart
@@ -5,12 +5,11 @@
/**
* Code generation for the file "integration_test_methods.dart".
*/
-library codegenInttestMethods;
-
import 'dart:convert';
import 'package:analyzer/src/codegen/tools.dart';
import 'package:front_end/src/codegen/tools.dart';
+import 'package:path/path.dart' as path;
import 'api.dart';
import 'codegen_dart.dart';
@@ -18,9 +17,9 @@ import 'from_html.dart';
import 'to_html.dart';
final GeneratedFile target = new GeneratedFile(
- 'test/integration/integration_test_methods.dart', (String pkgPath) {
- CodegenInttestMethodsVisitor visitor =
- new CodegenInttestMethodsVisitor(readApi(pkgPath));
+ 'test/integration/support/integration_test_methods.dart', (String pkgPath) {
+ CodegenInttestMethodsVisitor visitor = new CodegenInttestMethodsVisitor(
+ path.basename(pkgPath), readApi(pkgPath));
return visitor.collectCode(visitor.visitApi);
});
@@ -30,6 +29,11 @@ final GeneratedFile target = new GeneratedFile(
class CodegenInttestMethodsVisitor extends DartCodegenVisitor
with CodeGenerator {
/**
+ * The name of the package into which code is being generated.
+ */
+ final String packageName;
+
+ /**
* Visitor used to produce doc comments.
*/
final ToHtmlVisitor toHtmlVisitor;
@@ -45,7 +49,7 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor
*/
List<String> notificationSwitchContents = <String>[];
- CodegenInttestMethodsVisitor(Api api)
+ CodegenInttestMethodsVisitor(this.packageName, Api api)
: toHtmlVisitor = new ToHtmlVisitor(api),
super(api) {
codeGeneratorSettings.commentLineLength = 79;
@@ -93,24 +97,21 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor
@override
visitApi() {
- outputHeader();
+ outputHeader(year: '2017');
writeln();
writeln('/**');
writeln(' * Convenience methods for running integration tests');
writeln(' */');
- writeln('library test.integration.methods;');
- writeln();
writeln("import 'dart:async';");
writeln();
- writeln("import 'package:analysis_server/plugin/protocol/protocol.dart';");
+ writeln("import 'package:$packageName/protocol/protocol_generated.dart';");
writeln(
- "import 'package:analysis_server/src/protocol/protocol_internal.dart';");
+ "import 'package:$packageName/src/protocol/protocol_internal.dart';");
writeln("import 'package:test/test.dart';");
writeln();
writeln("import 'integration_tests.dart';");
writeln("import 'protocol_matchers.dart';");
writeln();
- writeln();
writeln('/**');
writeln(' * Convenience methods for running integration tests');
writeln(' */');
« no previous file with comments | « pkg/analysis_server/tool/spec/codegen_dart_protocol.dart ('k') | pkg/analysis_server/tool/spec/codegen_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698