diff --git a/lib/src/builder.dart b/lib/src/builder.dart index c5dfcd89..ab1430fd 100644 --- a/lib/src/builder.dart +++ b/lib/src/builder.dart @@ -55,7 +55,8 @@ class GeneratorBuilder extends Builder { var contentBuffer = new StringBuffer(); if (!isStandalone) { - contentBuffer.writeln('part of ${library.name};'); + contentBuffer.writeln('// ignore: non_identifier_library_name'); + contentBuffer.writeln("part of '${library.definingCompilationUnit.displayName}';"); contentBuffer.writeln(); } diff --git a/pubspec.yaml b/pubspec.yaml index 925b7fab..a4ef7bc2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,11 +4,11 @@ author: Dart Team description: Automatic sourcecode generation for Dart homepage: https://github.com/dart-lang/source_gen environment: - sdk: '>=1.12.0 <2.0.0' + sdk: '>=1.23.0-dev.11.0 <2.0.0' dependencies: analyzer: ^0.29.2 build: ^0.7.1 - dart_style: '>=0.1.7 <2.0.0' + dart_style: ^1.0.0 path: ^1.3.2 dev_dependencies: build_runner: ^0.3.0 diff --git a/test/builder_test.dart b/test/builder_test.dart index 69bd05af..ef72bf56 100644 --- a/test/builder_test.dart +++ b/test/builder_test.dart @@ -153,14 +153,17 @@ class MyGoodError { } '''; const _testLibPartContent = r''' -part of test_lib; +// ignore: non_identifier_library_name +part of 'test_lib.dart'; final int bar = 42; class Customer { } '''; const _testGenPartContent = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -part of test_lib; +// ignore: non_identifier_library_name +part of 'test_lib.dart'; + // ************************************************************************** // Generator: CommentGenerator @@ -180,7 +183,9 @@ part of test_lib; const _testGenPartContentForLibrary = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -part of test_lib; +// ignore: non_identifier_library_name +part of 'test_lib.dart'; + // ************************************************************************** // Generator: CommentGenerator @@ -210,7 +215,9 @@ const _testGenStandaloneContent = r'''// GENERATED CODE - DO NOT MODIFY BY HAND const _testGenPartContentForClassesAndLibrary = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -part of test_lib; +// ignore: non_identifier_library_name +part of 'test_lib.dart'; + // ************************************************************************** // Generator: CommentGenerator @@ -236,7 +243,9 @@ part of test_lib; const _testGenPartContentError = r'''// GENERATED CODE - DO NOT MODIFY BY HAND -part of test_lib; +// ignore: non_identifier_library_name +part of 'test_lib.dart'; + // ************************************************************************** // Generator: CommentGenerator @@ -246,6 +255,7 @@ part of test_lib; // Error: Invalid argument (element): We don't support class names with the word 'Error'. // Try renaming the class.: Instance of 'ClassElementImpl' + // ************************************************************************** // Generator: CommentGenerator // Target: class MyGoodError @@ -254,6 +264,7 @@ part of test_lib; // Error: Don't use classes with the word 'Error' in the name // TODO: Rename MyGoodError to something else. + // ************************************************************************** // Generator: CommentGenerator // Target: class Customer