From 95bcace3fa6cd8ca2a034847abb5c576e72adfed Mon Sep 17 00:00:00 2001 From: Hadrien Lejard Date: Sun, 25 Oct 2020 10:34:59 +0100 Subject: [PATCH 1/3] Upgrade dependency and fix travis --- .travis.yml | 4 ++-- CHANGELOG.md | 4 ++++ lib/src/template_file.dart | 11 ++++++----- pubspec.yaml | 11 +++++------ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3c59958..4fa9449 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,5 @@ language: dart dart: - dev script: -- dartanalyzer --fatal-warnings --fatal-lints . -- pub run test \ No newline at end of file +- dart analyze --fatal-warnings --fatal-infos . +- dart pub run test \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 43f89b4..7c253a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.2.1 + +- Upgrade dependencies + ## 0.1.2 - Added support for `generate directive` diff --git a/lib/src/template_file.dart b/lib/src/template_file.dart index a2a08b7..76918df 100644 --- a/lib/src/template_file.dart +++ b/lib/src/template_file.dart @@ -6,11 +6,10 @@ import 'dart:async'; import "dart:convert" show utf8; +import 'dart:io'; +import 'dart:isolate'; import 'package:mustache/mustache.dart'; -import 'package:resource/resource.dart' show Resource; - -import 'path_util.dart'; /// Template file class wrapping operations on mustache template. class TemplateFile { @@ -24,8 +23,10 @@ class TemplateFile { /// Renders template file on [_path] with values from [_data]. Future renderString() async { - var uri = fixUri('package:angular_cli/templates/$_path'); - var resource = new Resource(uri); + var uri = await Isolate.resolvePackageUri( + Uri.parse('package:angular_cli/templates/$_path'), + ); + var resource = File.fromUri(uri); var content = await resource.readAsString(encoding: utf8); var template = new Template(content); diff --git a/pubspec.yaml b/pubspec.yaml index 2dc6c57..61103ee 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: angular_cli -version: 0.2.0 +version: 0.2.1 authors: - Tianfei Zhu - Jing Bian @@ -7,17 +7,16 @@ authors: homepage: https://github.com/google/angular_cli description: Scaffolding tool for AngularDart environment: - sdk: '>=2.0.0-dev.69.0 <3.0.0' + sdk: '>=2.0.0 <3.0.0' executables: ngdart: dependencies: - analyzer: ^0.32.4 + analyzer: ^0.40.0 ansicolor: ^1.0.2 args: ^1.4.4 - html: ^0.13.3+2 + html: ^0.14.0 mustache: ^1.0.1 logging: ^0.11.3+2 path: ^1.6.2 - resource: ^2.1.5 dev_dependencies: - test: ^1.3.0 + test: ^1.5.0 From 297016f039b7a8fc9610010ec174e2ec731348d4 Mon Sep 17 00:00:00 2001 From: Hadrien Lejard Date: Sun, 25 Oct 2020 10:38:06 +0100 Subject: [PATCH 2/3] travis use dart stable channel --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4fa9449..cdfc5bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: dart dart: -- dev +- stable script: - dart analyze --fatal-warnings --fatal-infos . - dart pub run test \ No newline at end of file From eee162c1c51c75004d57ea59e685aad90c8458eb Mon Sep 17 00:00:00 2001 From: Hadrien Lejard Date: Sun, 25 Oct 2020 11:00:33 +0100 Subject: [PATCH 3/3] update analyzer call --- lib/src/visitors/angular_component_visitor.dart | 3 ++- lib/src/visitors/ast_cache.dart | 14 +++++++++----- lib/src/visitors/binding_helper.dart | 2 +- lib/src/visitors/binding_visitor.dart | 3 ++- lib/src/visitors/dart_class_info.dart | 2 +- lib/src/visitors/dart_class_visitor.dart | 3 ++- lib/src/visitors/utils.dart | 2 +- lib/src/visitors/visit_resources.dart | 3 ++- test/angular_component_visitor_test.dart | 5 +++-- test/binding_helper_test.dart | 8 +++++--- test/binding_visitor_test.dart | 5 +++-- test/dart_class_visitor_test.dart | 5 +++-- 12 files changed, 34 insertions(+), 21 deletions(-) diff --git a/lib/src/visitors/angular_component_visitor.dart b/lib/src/visitors/angular_component_visitor.dart index cf50239..12291bf 100644 --- a/lib/src/visitors/angular_component_visitor.dart +++ b/lib/src/visitors/angular_component_visitor.dart @@ -4,7 +4,8 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/visitor.dart'; import '../app_logger.dart'; import '../exceptions.dart'; diff --git a/lib/src/visitors/ast_cache.dart b/lib/src/visitors/ast_cache.dart index 09ce753..76df5e1 100644 --- a/lib/src/visitors/ast_cache.dart +++ b/lib/src/visitors/ast_cache.dart @@ -6,7 +6,8 @@ import 'dart:collection'; -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/analysis/utilities.dart'; +import 'package:analyzer/dart/ast/ast.dart'; import 'package:path/path.dart' as path; import '../app_logger.dart'; @@ -70,14 +71,17 @@ class AstCache { var filePath = _uriResolver.resolve(uri); AppLogger.log.fine('Parsing file $filePath...'); - compilationUnit = parseCompilationUnit( - FileReader.reader.readAsString(filePath), - name: filePath); + final parsed = parseString( + content: FileReader.reader.readAsString(filePath), + path: filePath, + ); + compilationUnit = parsed.unit; } on UsageException { rethrow; } catch (e) { AppLogger.log.warning('Could not parse $uri: $e'); - compilationUnit = parseCompilationUnit(''); + final parsed = parseString(content: ''); + compilationUnit = parsed.unit; } _uriToAst[uri] = compilationUnit; diff --git a/lib/src/visitors/binding_helper.dart b/lib/src/visitors/binding_helper.dart index 3bcf2e4..6dce6d8 100644 --- a/lib/src/visitors/binding_helper.dart +++ b/lib/src/visitors/binding_helper.dart @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/ast/ast.dart'; import '../app_logger.dart'; import '../exceptions.dart'; diff --git a/lib/src/visitors/binding_visitor.dart b/lib/src/visitors/binding_visitor.dart index 9d9308e..73503ad 100644 --- a/lib/src/visitors/binding_visitor.dart +++ b/lib/src/visitors/binding_visitor.dart @@ -4,7 +4,8 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/visitor.dart'; import 'binding_helper.dart'; import 'binding_info.dart'; diff --git a/lib/src/visitors/dart_class_info.dart b/lib/src/visitors/dart_class_info.dart index 1567e08..96dbb07 100644 --- a/lib/src/visitors/dart_class_info.dart +++ b/lib/src/visitors/dart_class_info.dart @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/ast/ast.dart'; /// Models a Dart class found during analysis. class DartClassInfo { diff --git a/lib/src/visitors/dart_class_visitor.dart b/lib/src/visitors/dart_class_visitor.dart index 28bfce7..e1b9a2e 100644 --- a/lib/src/visitors/dart_class_visitor.dart +++ b/lib/src/visitors/dart_class_visitor.dart @@ -4,7 +4,8 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/visitor.dart'; import '../app_logger.dart'; import '../exceptions.dart'; diff --git a/lib/src/visitors/utils.dart b/lib/src/visitors/utils.dart index a3ae09e..0b8693a 100644 --- a/lib/src/visitors/utils.dart +++ b/lib/src/visitors/utils.dart @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/ast/ast.dart'; import '../app_logger.dart'; diff --git a/lib/src/visitors/visit_resources.dart b/lib/src/visitors/visit_resources.dart index 7eb1f4c..1a70a7a 100644 --- a/lib/src/visitors/visit_resources.dart +++ b/lib/src/visitors/visit_resources.dart @@ -4,7 +4,8 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/visitor.dart'; import 'package:path/path.dart' as path; import '../app_logger.dart'; diff --git a/test/angular_component_visitor_test.dart b/test/angular_component_visitor_test.dart index e9d32cf..5efc864 100644 --- a/test/angular_component_visitor_test.dart +++ b/test/angular_component_visitor_test.dart @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/analysis/utilities.dart'; import 'package:angular_cli/src/visitors/angular_component_visitor.dart'; import 'package:angular_cli/src/visitors/component_info.dart'; import 'package:angular_cli/src/visitors/dart_class_info.dart'; @@ -14,7 +14,8 @@ void main() { group('AngularComponentVisitor', () { Map visit( Map classes, String content) { - var compilationUnit = parseCompilationUnit(content); + var parsed = parseString(content: content); + var compilationUnit = parsed.unit; var out = {}; var visitor = new AngularComponentVisitor(classes, out); compilationUnit.accept(visitor); diff --git a/test/binding_helper_test.dart b/test/binding_helper_test.dart index 0cffe83..a75c6cf 100644 --- a/test/binding_helper_test.dart +++ b/test/binding_helper_test.dart @@ -4,7 +4,9 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/analysis/utilities.dart'; +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/visitor.dart'; import 'package:angular_cli/src/visitors/binding_helper.dart'; import 'package:angular_cli/src/visitors/binding_info.dart'; import 'package:test/test.dart'; @@ -18,7 +20,7 @@ void main() { }); parse(String contents) { - parseCompilationUnit(contents).accept(visitor); + parseString(content: contents).unit.accept(visitor); } test('should parse simple binding', () { @@ -154,7 +156,7 @@ void main() { }); parse(String contents) { - parseCompilationUnit(contents).accept(visitor); + parseString(content: contents).unit.accept(visitor); } void checkExpandedModule( diff --git a/test/binding_visitor_test.dart b/test/binding_visitor_test.dart index 972fe37..529b8fc 100644 --- a/test/binding_visitor_test.dart +++ b/test/binding_visitor_test.dart @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/analysis/utilities.dart'; import 'package:angular_cli/src/visitors/binding_info.dart'; import 'package:angular_cli/src/visitors/binding_visitor.dart'; import 'package:test/test.dart'; @@ -12,7 +12,8 @@ import 'package:test/test.dart'; void main() { group('BindingVisitor', () { Map visit(String content) { - var compilationUnit = parseCompilationUnit(content); + var parsed = parseString(content: content); + var compilationUnit = parsed.unit; var out = {}; var visitor = new BindingVisitor('', out, {}, new Set()); compilationUnit.accept(visitor); diff --git a/test/dart_class_visitor_test.dart b/test/dart_class_visitor_test.dart index 82b14fa..0a84dc6 100644 --- a/test/dart_class_visitor_test.dart +++ b/test/dart_class_visitor_test.dart @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -import 'package:analyzer/analyzer.dart'; +import 'package:analyzer/dart/analysis/utilities.dart'; import 'package:angular_cli/src/visitors/dart_class_info.dart'; import 'package:angular_cli/src/visitors/dart_class_visitor.dart'; import 'package:test/test.dart'; @@ -12,7 +12,8 @@ import 'package:test/test.dart'; void main() { group('DartClassVisitor', () { Map visit(String content) { - var compilationUnit = parseCompilationUnit(content); + var parsed = parseString(content: content); + var compilationUnit = parsed.unit; var out = {}; var visitor = new DartClassVisitor('', out, {}); compilationUnit.accept(visitor);