Skip to content

Commit c5dc292

Browse files
iinozemtsevCommit Queue
authored andcommitted
Remove --experimental-cross-compilation flag
The cross compilation will be supported in 3.8. Change-Id: Icedd1fe51198558b5a62fc431d4699e63557a2ca Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424442 Auto-Submit: Ivan Inozemtsev <[email protected]> Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Ben Konyi <[email protected]>
1 parent 1a6755c commit c5dc292

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

pkg/dartdev/lib/src/commands/compile.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,6 @@ Remove debugging information from the output and save it separately to the speci
538538
..addOption('target-arch',
539539
help: 'Compile to a specific target architecture.',
540540
allowed: Architecture.values.map((v) => v.name).toList())
541-
..addFlag('experimental-cross-compilation',
542-
hide: true, help: 'Pass to enable cross-compilation.')
543541
..addExperimentalFlags(verbose: verbose);
544542
}
545543

@@ -582,14 +580,6 @@ Remove debugging information from the output and save it separately to the speci
582580
final target = crossCompilationTarget(args);
583581

584582
if (target != null) {
585-
if (!args.flag('experimental-cross-compilation')) {
586-
stderr.writeln('Target platform ($target) '
587-
'does not match host platform (${Target.current}).');
588-
stderr.writeln('Native cross-compilation support is experimental. '
589-
'Pass the `--experimental-cross-compilation` flag to enable it.');
590-
return 128;
591-
}
592-
593583
if (!supportedTargetPlatforms.contains(target)) {
594584
stderr.writeln('Unsupported target platform $target.');
595585
stderr.writeln('Supported target platforms: '

pkg/dartdev/test/commands/compile_test.dart

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ String usingTargetOSMessageForPlatform(String targetOS) =>
3030
'Specializing Platform getters for target OS $targetOS.';
3131
final String usingTargetOSMessage =
3232
usingTargetOSMessageForPlatform(Platform.operatingSystem);
33-
const crossOSExperimentalError =
34-
'Native cross-compilation support is experimental';
35-
36-
final Target host = Target.current;
37-
Target targetForOS(OS targetOS) =>
38-
Target.fromArchitectureAndOS(host.architecture, targetOS);
33+
String unsupportedTargetError(Target target) =>
34+
'Unsupported target platform $target';
3935

4036
void defineCompileTests() {
4137
final isRunningOnIA32 = Platform.version.contains('ia32');
@@ -420,25 +416,28 @@ void defineCompileTests() {
420416
mainSrc: 'void main() {print(const String.fromEnvironment("cross"));}');
421417
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
422418
final outFile = path.canonicalize(path.join(p.dirPath, 'myexe'));
423-
final targetOS = Platform.isLinux ? OS.macOS : OS.linux;
424-
419+
// Make sure targetOS is always unsupported (not Linux and not matches host
420+
// OS) to trigger an error.
421+
final targetOS = Platform.isWindows ? OS.macOS : OS.windows;
422+
final targetArch = Architecture.arm64;
423+
final target = Target.fromArchitectureAndOS(targetArch, targetOS);
425424
final result = await p.run(
426425
[
427426
'compile',
428427
'exe',
429428
'-v',
430429
'--target-os',
431430
targetOS.name,
431+
'--target-arch',
432+
targetArch.name,
432433
'-o',
433434
outFile,
434435
inFile,
435436
],
436437
);
437438

438439
expect(result.stdout, isNot(contains(usingTargetOSMessage)));
439-
expect(result.stderr, contains(crossOSExperimentalError));
440-
expect(result.stderr, contains(host.toString()));
441-
expect(result.stderr, contains(targetForOS(targetOS).toString()));
440+
expect(result.stderr, contains(unsupportedTargetError(target)));
442441
expect(result.exitCode, 128);
443442
}, skip: isRunningOnIA32);
444443

@@ -513,7 +512,11 @@ void defineCompileTests() {
513512
}, skip: isRunningOnIA32);
514513

515514
test('Compile aot snapshot cannot compile cross platform', () async {
516-
final targetOS = Platform.isLinux ? 'windows' : 'linux';
515+
// Make sure targetOS is always unsupported (not Linux and not matches host
516+
// OS) to trigger an error.
517+
final targetOS = Platform.isWindows ? OS.macOS : OS.windows;
518+
final targetArch = Architecture.arm64;
519+
final target = Target.fromArchitectureAndOS(targetArch, targetOS);
517520
final p = project(mainSrc: 'void main() { print("I love $targetOS"); }');
518521
final inFile = path.canonicalize(path.join(p.dirPath, p.relativeFilePath));
519522

@@ -523,16 +526,18 @@ void defineCompileTests() {
523526
'aot-snapshot',
524527
'-v',
525528
'--target-os',
526-
targetOS,
529+
targetOS.name,
530+
'--target-arch',
531+
targetArch.name,
527532
'-o',
528533
'main.aot',
529534
inFile,
530535
],
531536
);
532537

533538
expect(result.stdout,
534-
isNot(contains(usingTargetOSMessageForPlatform(targetOS))));
535-
expect(result.stderr, contains(crossOSExperimentalError));
539+
isNot(contains(usingTargetOSMessageForPlatform(targetOS.name))));
540+
expect(result.stderr, contains(unsupportedTargetError(target)));
536541

537542
expect(result.exitCode, isNot(0));
538543
}, skip: isRunningOnIA32);

0 commit comments

Comments
 (0)