Skip to content

Commit 0ec8740

Browse files
nshahanathomas
authored andcommitted
[stable][ddc] Add ddc-options to compiler configuration
Use explicit ddc-options to pass `--canary` flag to the compiler instead of sniffing for a builder tag. This just feels more expected and makes more sense if you are trying to understand how the canary configurations compile tests differently from the stable configurations. Issue: #51481 Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/280783 Change-Id: I6cc7c6a0a573b6f397b8b183dff13758f816fd33 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284542 Reviewed-by: Alexander Thomas <[email protected]>
1 parent 360c9b7 commit 0ec8740

File tree

6 files changed

+36
-5
lines changed

6 files changed

+36
-5
lines changed

pkg/smith/lib/configuration.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ class Configuration {
250250
genKernelOptions: stringListOption("gen-kernel-options"),
251251
vmOptions: stringListOption("vm-options"),
252252
dart2jsOptions: stringListOption("dart2js-options"),
253+
ddcOptions: stringListOption("ddc-options"),
253254
experiments: stringListOption("enable-experiment"),
254255
timeout: intOption("timeout"),
255256
enableAsserts: boolOption("enable-asserts"),
@@ -300,6 +301,8 @@ class Configuration {
300301

301302
final List<String> dart2jsOptions;
302303

304+
final List<String> ddcOptions;
305+
303306
/// The names of the experiments to enable while running tests.
304307
///
305308
/// A test may *require* an experiment to always be enabled by containing a
@@ -347,6 +350,7 @@ class Configuration {
347350
List<String>? genKernelOptions,
348351
List<String>? vmOptions,
349352
List<String>? dart2jsOptions,
353+
List<String>? ddcOptions,
350354
List<String>? experiments,
351355
int? timeout,
352356
bool? enableAsserts,
@@ -368,6 +372,7 @@ class Configuration {
368372
genKernelOptions = genKernelOptions ?? <String>[],
369373
vmOptions = vmOptions ?? <String>[],
370374
dart2jsOptions = dart2jsOptions ?? <String>[],
375+
ddcOptions = ddcOptions ?? <String>[],
371376
experiments = experiments ?? <String>[],
372377
timeout = timeout ?? -1,
373378
enableAsserts = enableAsserts ?? false,
@@ -403,6 +408,7 @@ class Configuration {
403408
_listsEqual(genKernelOptions, other.genKernelOptions) &&
404409
_listsEqual(vmOptions, other.vmOptions) &&
405410
_listsEqual(dart2jsOptions, other.dart2jsOptions) &&
411+
_listsEqual(ddcOptions, other.ddcOptions) &&
406412
_listsEqual(experiments, other.experiments) &&
407413
timeout == other.timeout &&
408414
enableAsserts == other.enableAsserts &&
@@ -453,6 +459,7 @@ class Configuration {
453459
genKernelOptions.join(" & ").hashCode ^
454460
vmOptions.join(" & ").hashCode ^
455461
dart2jsOptions.join(" & ").hashCode ^
462+
ddcOptions.join(" & ").hashCode ^
456463
experiments.join(" & ").hashCode ^
457464
timeout.hashCode ^
458465
_toBinary([
@@ -495,6 +502,7 @@ class Configuration {
495502
stringListField("gen-kernel-options", genKernelOptions);
496503
stringListField("vm-options", vmOptions);
497504
stringListField("dart2js-options", dart2jsOptions);
505+
stringListField("ddc-options", ddcOptions);
498506
stringListField("enable-experiment", experiments);
499507
if (timeout > 0) fields.add("timeout: $timeout");
500508
if (enableAsserts) fields.add("enable-asserts");
@@ -551,6 +559,7 @@ class Configuration {
551559
"gen-kernel-options", genKernelOptions, other.genKernelOptions);
552560
stringListField("vm-options", vmOptions, other.vmOptions);
553561
stringListField("dart2js-options", dart2jsOptions, other.dart2jsOptions);
562+
stringListField("ddc-options", ddcOptions, other.ddcOptions);
554563
stringListField("experiments", experiments, other.experiments);
555564
fields.add("timeout: $timeout ${other.timeout}");
556565
boolField("enable-asserts", enableAsserts, other.enableAsserts);

pkg/smith/test/configuration_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ void main() {
359359
builderTag: "a tag",
360360
vmOptions: ["vm a1", "vm a2"],
361361
dart2jsOptions: ["dart2js a1", "dart2js a2"],
362+
ddcOptions: ["ddc a1", "ddc a2"],
362363
experiments: ["experiment a1", "experiment a2"],
363364
timeout: 1);
364365

@@ -373,6 +374,7 @@ void main() {
373374
builderTag: "b tag",
374375
vmOptions: ["vm b1", "vm b2"],
375376
dart2jsOptions: ["dart2js b1", "dart2js b2"],
377+
ddcOptions: ["ddc b1", "ddc b2"],
376378
experiments: ["experiment b1", "experiment b2"],
377379
timeout: 2,
378380
enableAsserts: true,
@@ -402,6 +404,7 @@ architecture: ia32 x64
402404
builder-tag: a tag b tag
403405
vm-options: [vm a1, vm a2] [vm b1, vm b2]
404406
dart2js-options: [dart2js a1, dart2js a2] [dart2js b1, dart2js b2]
407+
ddc-options: [ddc a1, ddc a2] [ddc b1, ddc b2]
405408
experiments: [experiment a1, experiment a2] [experiment b1, experiment b2]
406409
timeout: 1 2
407410
enable-asserts: false true
@@ -432,6 +435,7 @@ architecture: ia32 ia32
432435
builder-tag: a tag a tag
433436
vm-options: [vm a1, vm a2] [vm a1, vm a2]
434437
dart2js-options: [dart2js a1, dart2js a2] [dart2js a1, dart2js a2]
438+
ddc-options: [ddc a1, ddc a2] [ddc a1, ddc a2]
435439
experiments: [experiment a1, experiment a2] [experiment a1, experiment a2]
436440
timeout: 1 1
437441
"""));

pkg/test_runner/lib/src/compiler_configuration.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,11 +602,14 @@ class DevCompilerConfiguration extends CompilerConfiguration {
602602
TestFile testFile, List<String> vmOptions, List<String> args) {
603603
return [
604604
...testFile.sharedOptions,
605+
...testFile.ddcOptions,
605606
..._configuration.sharedOptions,
607+
..._configuration.ddcOptions,
606608
..._experimentsArgument(_configuration, testFile),
607-
...testFile.ddcOptions,
608-
if (_configuration.nnbdMode == NnbdMode.strong) '--sound-null-safety',
609-
if (_configuration.configuration.builderTag == 'canary') '--canary',
609+
if (_configuration.nnbdMode == NnbdMode.strong)
610+
'--sound-null-safety'
611+
else
612+
'--no-sound-null-safety',
610613
// The file being compiled is the last argument.
611614
args.last
612615
];

pkg/test_runner/lib/src/configuration.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ class TestConfiguration {
152152
/// Extra dart2js options passed to the testing script.
153153
List<String> get dart2jsOptions => configuration.dart2jsOptions;
154154

155+
/// Extra ddc options passed to the testing script.
156+
List<String> get ddcOptions => configuration.ddcOptions;
157+
155158
/// Extra gen_kernel options passed to the testing script.
156159
List<String> get genKernelOptions => configuration.genKernelOptions;
157160

pkg/test_runner/lib/src/options.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ options. Used to be able to make sane updates to the status files.''',
347347
aliases: ['dart2js_options'],
348348
hide: true,
349349
help: 'Extra options for dart2js compilation step.')
350+
..addMultiOption('ddc-options',
351+
aliases: ['ddc_options'],
352+
hide: true,
353+
help: 'Extra command line options passed to the DDC compiler.')
350354
..addMultiOption('shared-options',
351355
aliases: ['shared_options'], hide: true, help: 'Extra shared options.')
352356
..addMultiOption('enable-experiment',
@@ -628,6 +632,7 @@ has been specified on the command line.''')
628632
}
629633

630634
var dart2jsOptions = listOption("dart2js-options");
635+
var ddcOptions = listOption("ddc-options");
631636
var vmOptions = listOption("vm-options");
632637
var sharedOptions = listOption("shared-options");
633638
var experiments = data["enable-experiment"] as List<String>?;
@@ -819,6 +824,7 @@ has been specified on the command line.''')
819824
isMinified: data["minified"] as bool,
820825
vmOptions: vmOptions,
821826
dart2jsOptions: dart2jsOptions,
827+
ddcOptions: ddcOptions,
822828
experiments: experiments,
823829
babel: data['babel'] as String?,
824830
builderTag: data["builder-tag"] as String?,

tools/bots/test_matrix.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,15 +928,21 @@
928928
"builder-tag": "canary",
929929
"checked": true,
930930
"use-sdk": true,
931-
"enable-asserts": true
931+
"enable-asserts": true,
932+
"ddc-options": [
933+
"--canary"
934+
]
932935
}
933936
},
934937
"dartdevc-canary-weak-(linux|mac|win)-release-(chrome|firefox)-(x64|arm64)": {
935938
"options": {
936939
"builder-tag": "canary",
937940
"checked": true,
938941
"use-sdk": true,
939-
"enable-asserts": true
942+
"enable-asserts": true,
943+
"ddc-options": [
944+
"--canary"
945+
]
940946
}
941947
},
942948
"cfe-(linux|mac|win)": {

0 commit comments

Comments
 (0)