From dc1804fff49b22e7bae273760fd301193e7ec611 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 23 Jun 2021 00:51:17 +0000 Subject: [PATCH] [pkg/dart2native] switch to use package:lints Change-Id: I81f2b25cc57fc89138638eb0b98f6d5489146473 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204641 Reviewed-by: Phil Quitslund Commit-Queue: Devon Carew --- pkg/dart2native/analysis_options.yaml | 15 +++++---------- pkg/dart2native/bin/dart2native.dart | 2 +- pkg/dart2native/lib/dart2native.dart | 6 +++--- pkg/dart2native/lib/generate.dart | 19 ++++++++++--------- pkg/dart2native/pubspec.yaml | 3 ++- 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/pkg/dart2native/analysis_options.yaml b/pkg/dart2native/analysis_options.yaml index c84f27cb5e1..dd90435f987 100644 --- a/pkg/dart2native/analysis_options.yaml +++ b/pkg/dart2native/analysis_options.yaml @@ -1,13 +1,8 @@ -include: package:pedantic/analysis_options.1.8.0.yaml - -analyzer: - errors: - # Increase the severity of several hints. - prefer_single_quotes: warning - unused_import: warning +include: package:lints/recommended.yaml linter: rules: - - directives_ordering - - prefer_relative_imports - - prefer_single_quotes + # Enable additional rules. + depend_on_referenced_packages: true + directives_ordering: true + sort_pub_dependencies: true diff --git a/pkg/dart2native/bin/dart2native.dart b/pkg/dart2native/bin/dart2native.dart index ed18daf72a2..d5d888a4010 100644 --- a/pkg/dart2native/bin/dart2native.dart +++ b/pkg/dart2native/bin/dart2native.dart @@ -103,7 +103,7 @@ Sets the verbosity level used for filtering messages during compilation. final String sourceFile = parsedArgs.rest[0]; if (!FileSystemEntity.isFileSync(sourceFile)) { stderr.writeln( - '"${sourceFile}" is not a file. See \'--help\' for more information.'); + '"$sourceFile" is not a file. See \'--help\' for more information.'); await stderr.flush(); exit(1); } diff --git a/pkg/dart2native/lib/dart2native.dart b/pkg/dart2native/lib/dart2native.dart index 3e51b53226a..3329a8d348e 100644 --- a/pkg/dart2native/lib/dart2native.dart +++ b/pkg/dart2native/lib/dart2native.dart @@ -52,10 +52,10 @@ Future generateAotKernel( genKernel, '--platform', platformDill, - if (enableExperiment.isNotEmpty) '--enable-experiment=${enableExperiment}', + if (enableExperiment.isNotEmpty) '--enable-experiment=$enableExperiment', '--aot', '-Ddart.vm.product=true', - ...(defines.map((d) => '-D${d}')), + ...(defines.map((d) => '-D$d')), if (packages != null) ...['--packages', packages], '-o', kernelFile, @@ -73,7 +73,7 @@ Future generateAotSnapshot( List extraGenSnapshotOptions) { return Process.run(genSnapshot, [ '--snapshot-kind=app-aot-elf', - '--elf=${snapshotFile}', + '--elf=$snapshotFile', if (debugFile != null) '--save-debugging-info=$debugFile', if (debugFile != null) '--dwarf-stack-traces', if (debugFile != null) '--strip', diff --git a/pkg/dart2native/lib/generate.dart b/pkg/dart2native/lib/generate.dart index 3df6176e647..8c773d6e88f 100644 --- a/pkg/dart2native/lib/generate.dart +++ b/pkg/dart2native/lib/generate.dart @@ -3,17 +3,19 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:io'; + import 'package:path/path.dart' as path; + import 'dart2native.dart'; final Directory binDir = File(Platform.resolvedExecutable).parent; final String executableSuffix = Platform.isWindows ? '.exe' : ''; final String dartaotruntime = - path.join(binDir.path, 'dartaotruntime${executableSuffix}'); + path.join(binDir.path, 'dartaotruntime$executableSuffix'); final String genKernel = path.join(binDir.path, 'snapshots', 'gen_kernel.dart.snapshot'); final String genSnapshot = - path.join(binDir.path, 'utils', 'gen_snapshot${executableSuffix}'); + path.join(binDir.path, 'utils', 'gen_snapshot$executableSuffix'); final String productPlatformDill = path.join( binDir.parent.path, 'lib', '_internal', 'vm_platform_strong_product.dill'); @@ -42,12 +44,11 @@ Future generateNative({ 'exe': Kind.exe, }[kind]; final sourceWithoutDart = sourcePath.replaceFirst(RegExp(r'\.dart$'), ''); - final outputPath = path.canonicalize(path.normalize(outputFile != null - ? outputFile - : { - Kind.aot: '${sourceWithoutDart}.aot', - Kind.exe: '${sourceWithoutDart}.exe', - }[outputKind])); + final outputPath = path.canonicalize(path.normalize(outputFile ?? + { + Kind.aot: '$sourceWithoutDart.aot', + Kind.exe: '$sourceWithoutDart.exe', + }[outputKind])); final debugPath = debugFile != null ? path.canonicalize(path.normalize(debugFile)) : null; @@ -113,7 +114,7 @@ Future generateNative({ } } - print('Generated: ${outputPath}'); + print('Generated: $outputPath'); } finally { tempDir.deleteSync(recursive: true); } diff --git a/pkg/dart2native/pubspec.yaml b/pkg/dart2native/pubspec.yaml index 4c274e7cc38..1e858a5c872 100644 --- a/pkg/dart2native/pubspec.yaml +++ b/pkg/dart2native/pubspec.yaml @@ -11,8 +11,9 @@ executables: dependencies: args: ^1.4.0 - path: any front_end: path: ../front_end + path: any dev_dependencies: + lints: any