Index: pkg/analyzer_plugin/tool/spec/codegen_inttest_methods.dart |
diff --git a/pkg/analyzer_plugin/tool/spec/codegen_inttest_methods.dart b/pkg/analyzer_plugin/tool/spec/codegen_inttest_methods.dart |
index eb989b9ee4924f003a89074bd0b3d1c9fc85b123..2da079c677f5920da3f775517a0d2491d7d5fc73 100644 |
--- a/pkg/analyzer_plugin/tool/spec/codegen_inttest_methods.dart |
+++ b/pkg/analyzer_plugin/tool/spec/codegen_inttest_methods.dart |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
@@ -9,6 +9,7 @@ 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'; |
@@ -17,8 +18,8 @@ import 'to_html.dart'; |
final GeneratedFile target = new GeneratedFile( |
'test/integration/support/integration_test_methods.dart', (String pkgPath) { |
- CodegenInttestMethodsVisitor visitor = |
- new CodegenInttestMethodsVisitor(readApi(pkgPath)); |
+ CodegenInttestMethodsVisitor visitor = new CodegenInttestMethodsVisitor( |
+ path.basename(pkgPath), readApi(pkgPath)); |
return visitor.collectCode(visitor.visitApi); |
}); |
@@ -28,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; |
@@ -43,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; |
@@ -98,10 +104,9 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor |
writeln(' */'); |
writeln("import 'dart:async';"); |
writeln(); |
+ writeln("import 'package:$packageName/protocol/protocol_generated.dart';"); |
writeln( |
- "import 'package:analyzer_plugin/protocol/protocol_generated.dart';"); |
- writeln( |
- "import 'package:analyzer_plugin/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';"); |