2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
+ import 'dart:ffi' ;
6
+
5
7
import 'package:file/file.dart' ;
6
8
import 'package:meta/meta.dart' ;
7
9
@@ -41,7 +43,9 @@ class NativeTestCommand extends PackageLoopingCommand {
41
43
super .packagesDir, {
42
44
super .processRunner,
43
45
super .platform,
44
- }) : _xcode = Xcode (processRunner: processRunner, log: true ) {
46
+ Abi ? abi,
47
+ }) : _abi = abi ?? Abi .current (),
48
+ _xcode = Xcode (processRunner: processRunner, log: true ) {
45
49
argParser.addOption (
46
50
_iOSDestinationFlag,
47
51
help: 'Specify the destination when running iOS tests.\n '
@@ -63,6 +67,9 @@ class NativeTestCommand extends PackageLoopingCommand {
63
67
help: 'Runs native integration (UI) tests' , defaultsTo: true );
64
68
}
65
69
70
+ // The ABI of the host.
71
+ final Abi _abi;
72
+
66
73
// The device destination flags for iOS tests.
67
74
List <String > _iOSDestinationFlags = < String > [];
68
75
@@ -548,9 +555,10 @@ this command.
548
555
isTestBinary: isTestBinary);
549
556
}
550
557
551
- /// Finds every file in the [buildDirectoryName] subdirectory of [plugin] 's
552
- /// build directory for which [isTestBinary] is true, and runs all of them,
553
- /// returning the overall result.
558
+ /// Finds every file in the relevant (based on [platformName] , [buildMode] ,
559
+ /// and [arch] ) subdirectory of [plugin] 's build directory for which
560
+ /// [isTestBinary] is true, and runs all of them, returning the overall
561
+ /// result.
554
562
///
555
563
/// The binaries are assumed to be Google Test test binaries, thus returning
556
564
/// zero for success and non-zero for failure.
@@ -563,11 +571,45 @@ this command.
563
571
final List <File > testBinaries = < File > [];
564
572
bool hasMissingBuild = false ;
565
573
bool buildFailed = false ;
574
+ String ? arch;
575
+ const String x64DirName = 'x64' ;
576
+ const String arm64DirName = 'arm64' ;
577
+ if (platform.isWindows) {
578
+ arch = _abi == Abi .windowsX64 ? x64DirName : arm64DirName;
579
+ } else if (platform.isLinux) {
580
+ // TODO(stuartmorgan): Support arm64 if that ever becomes a supported
581
+ // CI configuration for the repository.
582
+ arch = 'x64' ;
583
+ }
566
584
for (final RepositoryPackage example in plugin.getExamples ()) {
567
- final CMakeProject project = CMakeProject (example.directory,
585
+ CMakeProject project = CMakeProject (example.directory,
568
586
buildMode: buildMode,
569
587
processRunner: processRunner,
570
- platform: platform);
588
+ platform: platform,
589
+ arch: arch);
590
+ if (platform.isWindows) {
591
+ if (arch == arm64DirName && ! project.isConfigured ()) {
592
+ // Check for x64, to handle builds newer than 3.13, but that don't yet
593
+ // have https://github.com/flutter/flutter/issues/129807.
594
+ // TODO(stuartmorgan): Remove this when CI no longer supports a
595
+ // version of Flutter without the issue above fixed.
596
+ project = CMakeProject (example.directory,
597
+ buildMode: buildMode,
598
+ processRunner: processRunner,
599
+ platform: platform,
600
+ arch: x64DirName);
601
+ }
602
+ if (! project.isConfigured ()) {
603
+ // Check again without the arch subdirectory, since 3.13 doesn't
604
+ // have it yet.
605
+ // TODO(stuartmorgan): Remove this when CI no longer supports Flutter
606
+ // 3.13.
607
+ project = CMakeProject (example.directory,
608
+ buildMode: buildMode,
609
+ processRunner: processRunner,
610
+ platform: platform);
611
+ }
612
+ }
571
613
if (! project.isConfigured ()) {
572
614
printError ('ERROR: Run "flutter build" on ${example .displayName }, '
573
615
'or run this tool\' s "build-examples" command, for the target '
0 commit comments