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(' */'); |