Add Windows build test (#68657)
Enables build_test for Windows. Currently only flutter_gallery has platform directories for the desktop platforms, so this will run only that build, but this will provide an end-to-end build test for Windows.
Other example/test projects can be brought online for Windows in the future just by adding the windows/ directory to the project.
diff --git a/dev/bots/test.dart b/dev/bots/test.dart
index 7aaabe4..398edde 100644
--- a/dev/bots/test.dart
+++ b/dev/bots/test.dart
@@ -136,6 +136,13 @@
return Platform.isMacOS && (branchName != 'beta' && branchName != 'stable');
}
+/// Returns whether or not Windows desktop tests should be run.
+///
+/// The branch restrictions here should stay in sync with features.dart.
+bool _shouldRunWindows() {
+ return Platform.isWindows && (branchName != 'beta' && branchName != 'stable');
+}
+
/// Verify the Flutter Engine is the revision in
/// bin/cache/internal/engine.version.
Future<void> _validateEngineHash() async {
@@ -393,6 +400,14 @@
print('Example project ${path.basename(examplePath)} has no macos directory, skipping macOS');
}
}
+ if (_shouldRunWindows()) {
+ if (Directory(path.join(examplePath, 'windows')).existsSync()) {
+ await _flutterBuildWin32(examplePath, release: false, additionalArgs: additionalArgs, verifyCaching: verifyCaching);
+ await _flutterBuildWin32(examplePath, release: true, additionalArgs: additionalArgs, verifyCaching: verifyCaching);
+ } else {
+ print('Example project ${path.basename(examplePath)} has no windows directory, skipping Win32');
+ }
+ }
}
Future<void> _flutterBuildApk(String relativePathToApplication, {
@@ -449,6 +464,21 @@
);
}
+Future<void> _flutterBuildWin32(String relativePathToApplication, {
+ @required bool release,
+ bool verifyCaching = false,
+ List<String> additionalArgs = const <String>[],
+}) async {
+ assert(Platform.isWindows);
+ await runCommand(flutter, <String>['config', '--enable-windows-desktop']);
+ print('${green}Testing Windows build$reset for $cyan$relativePathToApplication$reset...');
+ await _flutterBuild(relativePathToApplication, 'Windows', 'windows',
+ release: release,
+ verifyCaching: verifyCaching,
+ additionalArgs: additionalArgs
+ );
+}
+
Future<void> _flutterBuild(
String relativePathToApplication,
String platformLabel,