mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
Revert "[pkg/dart2native] upgrade dart2native to null safe"
This reverts commit b6fad9c4f3
.
Reason for revert: Seeing failures in google3.
Original change's description:
> [pkg/dart2native] upgrade dart2native to null safe
>
> Change-Id: Ieef99b982bab14425a4df9f84a40d8ae1ba2bd79
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202402
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>
TBR=devoncarew@google.com,bkonyi@google.com
Change-Id: Idff233978847be421f7b59ab93d04da99c02cbf5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202722
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This commit is contained in:
parent
37806ba461
commit
6862fa1408
|
@ -214,7 +214,7 @@
|
|||
"name": "dart2native",
|
||||
"rootUri": "../pkg/dart2native",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
"languageVersion": "2.7"
|
||||
},
|
||||
{
|
||||
"name": "dart_internal",
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
include: package:lints/recommended.yaml
|
||||
include: package:pedantic/analysis_options.1.8.0.yaml
|
||||
|
||||
analyzer:
|
||||
errors:
|
||||
# Increase the severity of several hints.
|
||||
prefer_single_quotes: warning
|
||||
unused_import: warning
|
||||
|
||||
linter:
|
||||
rules:
|
||||
|
|
|
@ -21,12 +21,10 @@ Generates an executable or an AOT snapshot from <main-dart-file>.
|
|||
|
||||
Future<void> main(List<String> args) async {
|
||||
// If we're outputting to a terminal, wrap usage text to that width.
|
||||
int? outputLineWidth;
|
||||
int outputLineWidth;
|
||||
try {
|
||||
outputLineWidth = stdout.terminalColumns;
|
||||
} catch (_) {
|
||||
/* Ignore. */
|
||||
}
|
||||
} catch (_) {/* Ignore. */}
|
||||
|
||||
final ArgParser parser = ArgParser(usageLineLength: outputLineWidth)
|
||||
..addMultiOption('define', abbr: 'D', valueHelp: 'key=value', help: '''
|
||||
|
@ -105,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);
|
||||
}
|
||||
|
@ -117,7 +115,7 @@ Sets the verbosity level used for filtering messages during compilation.
|
|||
outputFile: parsedArgs['output'],
|
||||
debugFile: parsedArgs['save-debugging-info'],
|
||||
packages: parsedArgs['packages'],
|
||||
defines: parsedArgs['define'] ?? [],
|
||||
defines: parsedArgs['define'],
|
||||
enableExperiment: parsedArgs['enable-experiment'],
|
||||
enableAsserts: parsedArgs['enable-asserts'],
|
||||
soundNullSafety: parsedArgs['sound-null-safety'],
|
||||
|
|
|
@ -44,7 +44,7 @@ Future<ProcessResult> generateAotKernel(
|
|||
String platformDill,
|
||||
String sourceFile,
|
||||
String kernelFile,
|
||||
String? packages,
|
||||
String packages,
|
||||
List<String> defines,
|
||||
{String enableExperiment = '',
|
||||
List<String> extraGenKernelOptions = const []}) {
|
||||
|
@ -52,10 +52,10 @@ Future<ProcessResult> 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,
|
||||
|
@ -65,16 +65,15 @@ Future<ProcessResult> generateAotKernel(
|
|||
}
|
||||
|
||||
Future generateAotSnapshot(
|
||||
String genSnapshot,
|
||||
String kernelFile,
|
||||
String snapshotFile,
|
||||
bool enableAsserts,
|
||||
List<String> extraGenSnapshotOptions, {
|
||||
String? debugFile,
|
||||
}) {
|
||||
String genSnapshot,
|
||||
String kernelFile,
|
||||
String snapshotFile,
|
||||
String debugFile,
|
||||
bool enableAsserts,
|
||||
List<String> 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',
|
||||
|
|
|
@ -3,32 +3,30 @@
|
|||
// 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');
|
||||
|
||||
Future<void> generateNative({
|
||||
String kind = 'exe',
|
||||
required String sourceFile,
|
||||
String? outputFile,
|
||||
String? debugFile,
|
||||
String? packages,
|
||||
required List<String> defines,
|
||||
String sourceFile,
|
||||
String outputFile,
|
||||
String debugFile,
|
||||
String packages,
|
||||
List<String> defines,
|
||||
String enableExperiment = '',
|
||||
bool enableAsserts = false,
|
||||
bool? soundNullSafety,
|
||||
bool soundNullSafety,
|
||||
bool verbose = false,
|
||||
String verbosity = 'all',
|
||||
List<String> extraOptions = const [],
|
||||
|
@ -39,13 +37,17 @@ Future<void> generateNative({
|
|||
if (packages != null) {
|
||||
packages = path.canonicalize(path.normalize(packages));
|
||||
}
|
||||
final Kind outputKind = {'aot': Kind.aot, 'exe': Kind.exe}[kind]!;
|
||||
final Kind outputKind = {
|
||||
'aot': Kind.aot,
|
||||
'exe': Kind.exe,
|
||||
}[kind];
|
||||
final sourceWithoutDart = sourcePath.replaceFirst(RegExp(r'\.dart$'), '');
|
||||
final outputPath = path.canonicalize(path.normalize(outputFile ??
|
||||
{
|
||||
Kind.aot: '$sourceWithoutDart.aot',
|
||||
Kind.exe: '$sourceWithoutDart.exe',
|
||||
}[outputKind]!));
|
||||
final outputPath = path.canonicalize(path.normalize(outputFile != null
|
||||
? outputFile
|
||||
: {
|
||||
Kind.aot: '${sourceWithoutDart}.aot',
|
||||
Kind.exe: '${sourceWithoutDart}.exe',
|
||||
}[outputKind]));
|
||||
final debugPath =
|
||||
debugFile != null ? path.canonicalize(path.normalize(debugFile)) : null;
|
||||
|
||||
|
@ -88,14 +90,8 @@ Future<void> generateNative({
|
|||
final String snapshotFile = (outputKind == Kind.aot
|
||||
? outputPath
|
||||
: path.join(tempDir.path, 'snapshot.aot'));
|
||||
final snapshotResult = await generateAotSnapshot(
|
||||
genSnapshot,
|
||||
kernelFile,
|
||||
snapshotFile,
|
||||
enableAsserts,
|
||||
extraOptions,
|
||||
debugFile: debugPath,
|
||||
);
|
||||
final snapshotResult = await generateAotSnapshot(genSnapshot, kernelFile,
|
||||
snapshotFile, debugPath, enableAsserts, extraOptions);
|
||||
if (snapshotResult.exitCode != 0) {
|
||||
stderr.writeln(snapshotResult.stdout);
|
||||
stderr.writeln(snapshotResult.stderr);
|
||||
|
@ -117,7 +113,7 @@ Future<void> generateNative({
|
|||
}
|
||||
}
|
||||
|
||||
print('Generated: $outputPath');
|
||||
print('Generated: ${outputPath}');
|
||||
} finally {
|
||||
tempDir.deleteSync(recursive: true);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ name: dart2native
|
|||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: "^2.7.0"
|
||||
|
||||
# Add the bin/dart2native.dart script to the scripts pub installs.
|
||||
executables:
|
||||
|
@ -16,4 +16,3 @@ dependencies:
|
|||
path: ../front_end
|
||||
|
||||
dev_dependencies:
|
||||
lints: ^1.0.0
|
||||
|
|
Loading…
Reference in a new issue