[ddc] Fix ddb to pass VM options properly.

Since we removed the dartdevc script, we cannot use the environment
anymore to provide the VM flags. These instead have to be provided
explicitly to the dart command.

Change-Id: I7742815ee43ef89a41644b364ba07335358fe976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248641
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2022-06-16 21:06:59 +00:00 committed by Commit Bot
parent ca58fb644a
commit c367a0162e

View file

@ -174,31 +174,28 @@ void main(List<String> args) async {
mode: ProcessStartMode.inheritStdio, environment: environment);
}
Future<void> runDdc(List<String> args) async {
if (debug) {
// Use unbuilt script. This only works from a source checkout.
var vmServicePort = options.wasParsed('vm-service-port')
? '=${options['vm-service-port']}'
: '';
var observe =
options.wasParsed('vm-service-port') || options['observe'] as bool;
args.insertAll(0, [
Future<void> runDdc(List<String> ddcArgs) async {
var observe =
options.wasParsed('vm-service-port') || options['observe'] as bool;
var vmServicePort = options.wasParsed('vm-service-port')
? '=${options['vm-service-port']}'
: '';
var args = <String>[
...?options['compile-vm-options']?.split(' '),
if (debug) ...[
if (observe) ...[
'--enable-vm-service$vmServicePort',
'--pause-isolates-on-start',
],
'--enable-asserts',
p.join(ddcPath, 'bin', 'dartdevc.dart')
]);
} else {
// Use built snapshot.
args.insertAll(
0, [p.join(dartSdk, 'bin', 'snapshots', 'dartdevc.dart.snapshot')]);
}
var process = await startProcess('DDC', dartBinary, args, <String, String>{
if (options['compile-vm-options'] != null)
'DART_VM_OPTIONS': options['compile-vm-options'] as String
});
// Use unbuilt script. This only works from a source checkout.
p.join(ddcPath, 'bin', 'dartdevc.dart'),
] else
// Use built snapshot.
p.join(dartSdk, 'bin', 'snapshots', 'dartdevc.dart.snapshot'),
...ddcArgs,
];
var process = await startProcess('DDC', dartBinary, args);
if (await process.exitCode != 0) exit(await process.exitCode);
}