mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[pkg/dart2native] switch to use package:lints
Change-Id: I81f2b25cc57fc89138638eb0b98f6d5489146473 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204641 Reviewed-by: Phil Quitslund <pquitslund@google.com> Commit-Queue: Devon Carew <devoncarew@google.com>
This commit is contained in:
parent
4f5d4731c5
commit
dc1804fff4
|
@ -1,13 +1,8 @@
|
||||||
include: package:pedantic/analysis_options.1.8.0.yaml
|
include: package:lints/recommended.yaml
|
||||||
|
|
||||||
analyzer:
|
|
||||||
errors:
|
|
||||||
# Increase the severity of several hints.
|
|
||||||
prefer_single_quotes: warning
|
|
||||||
unused_import: warning
|
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
rules:
|
rules:
|
||||||
- directives_ordering
|
# Enable additional rules.
|
||||||
- prefer_relative_imports
|
depend_on_referenced_packages: true
|
||||||
- prefer_single_quotes
|
directives_ordering: true
|
||||||
|
sort_pub_dependencies: true
|
||||||
|
|
|
@ -103,7 +103,7 @@ Sets the verbosity level used for filtering messages during compilation.
|
||||||
final String sourceFile = parsedArgs.rest[0];
|
final String sourceFile = parsedArgs.rest[0];
|
||||||
if (!FileSystemEntity.isFileSync(sourceFile)) {
|
if (!FileSystemEntity.isFileSync(sourceFile)) {
|
||||||
stderr.writeln(
|
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();
|
await stderr.flush();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,10 @@ Future<ProcessResult> generateAotKernel(
|
||||||
genKernel,
|
genKernel,
|
||||||
'--platform',
|
'--platform',
|
||||||
platformDill,
|
platformDill,
|
||||||
if (enableExperiment.isNotEmpty) '--enable-experiment=${enableExperiment}',
|
if (enableExperiment.isNotEmpty) '--enable-experiment=$enableExperiment',
|
||||||
'--aot',
|
'--aot',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
...(defines.map((d) => '-D${d}')),
|
...(defines.map((d) => '-D$d')),
|
||||||
if (packages != null) ...['--packages', packages],
|
if (packages != null) ...['--packages', packages],
|
||||||
'-o',
|
'-o',
|
||||||
kernelFile,
|
kernelFile,
|
||||||
|
@ -73,7 +73,7 @@ Future generateAotSnapshot(
|
||||||
List<String> extraGenSnapshotOptions) {
|
List<String> extraGenSnapshotOptions) {
|
||||||
return Process.run(genSnapshot, [
|
return Process.run(genSnapshot, [
|
||||||
'--snapshot-kind=app-aot-elf',
|
'--snapshot-kind=app-aot-elf',
|
||||||
'--elf=${snapshotFile}',
|
'--elf=$snapshotFile',
|
||||||
if (debugFile != null) '--save-debugging-info=$debugFile',
|
if (debugFile != null) '--save-debugging-info=$debugFile',
|
||||||
if (debugFile != null) '--dwarf-stack-traces',
|
if (debugFile != null) '--dwarf-stack-traces',
|
||||||
if (debugFile != null) '--strip',
|
if (debugFile != null) '--strip',
|
||||||
|
|
|
@ -3,17 +3,19 @@
|
||||||
// BSD-style license that can be found in the LICENSE file.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
import 'dart2native.dart';
|
import 'dart2native.dart';
|
||||||
|
|
||||||
final Directory binDir = File(Platform.resolvedExecutable).parent;
|
final Directory binDir = File(Platform.resolvedExecutable).parent;
|
||||||
final String executableSuffix = Platform.isWindows ? '.exe' : '';
|
final String executableSuffix = Platform.isWindows ? '.exe' : '';
|
||||||
final String dartaotruntime =
|
final String dartaotruntime =
|
||||||
path.join(binDir.path, 'dartaotruntime${executableSuffix}');
|
path.join(binDir.path, 'dartaotruntime$executableSuffix');
|
||||||
final String genKernel =
|
final String genKernel =
|
||||||
path.join(binDir.path, 'snapshots', 'gen_kernel.dart.snapshot');
|
path.join(binDir.path, 'snapshots', 'gen_kernel.dart.snapshot');
|
||||||
final String genSnapshot =
|
final String genSnapshot =
|
||||||
path.join(binDir.path, 'utils', 'gen_snapshot${executableSuffix}');
|
path.join(binDir.path, 'utils', 'gen_snapshot$executableSuffix');
|
||||||
final String productPlatformDill = path.join(
|
final String productPlatformDill = path.join(
|
||||||
binDir.parent.path, 'lib', '_internal', 'vm_platform_strong_product.dill');
|
binDir.parent.path, 'lib', '_internal', 'vm_platform_strong_product.dill');
|
||||||
|
|
||||||
|
@ -42,12 +44,11 @@ Future<void> generateNative({
|
||||||
'exe': Kind.exe,
|
'exe': Kind.exe,
|
||||||
}[kind];
|
}[kind];
|
||||||
final sourceWithoutDart = sourcePath.replaceFirst(RegExp(r'\.dart$'), '');
|
final sourceWithoutDart = sourcePath.replaceFirst(RegExp(r'\.dart$'), '');
|
||||||
final outputPath = path.canonicalize(path.normalize(outputFile != null
|
final outputPath = path.canonicalize(path.normalize(outputFile ??
|
||||||
? outputFile
|
{
|
||||||
: {
|
Kind.aot: '$sourceWithoutDart.aot',
|
||||||
Kind.aot: '${sourceWithoutDart}.aot',
|
Kind.exe: '$sourceWithoutDart.exe',
|
||||||
Kind.exe: '${sourceWithoutDart}.exe',
|
}[outputKind]));
|
||||||
}[outputKind]));
|
|
||||||
final debugPath =
|
final debugPath =
|
||||||
debugFile != null ? path.canonicalize(path.normalize(debugFile)) : null;
|
debugFile != null ? path.canonicalize(path.normalize(debugFile)) : null;
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ Future<void> generateNative({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print('Generated: ${outputPath}');
|
print('Generated: $outputPath');
|
||||||
} finally {
|
} finally {
|
||||||
tempDir.deleteSync(recursive: true);
|
tempDir.deleteSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ executables:
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
args: ^1.4.0
|
args: ^1.4.0
|
||||||
path: any
|
|
||||||
front_end:
|
front_end:
|
||||||
path: ../front_end
|
path: ../front_end
|
||||||
|
path: any
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
lints: any
|
||||||
|
|
Loading…
Reference in a new issue