diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 7aaabe49f5..398edde754 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -136,6 +136,13 @@ bool _shouldRunMacOS() { 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 _validateEngineHash() async { @@ -393,6 +400,14 @@ Future _runExampleProjectBuildTests(FileSystemEntity exampleDirectory) asy 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 _flutterBuildApk(String relativePathToApplication, { @@ -449,6 +464,21 @@ Future _flutterBuildMacOS(String relativePathToApplication, { ); } +Future _flutterBuildWin32(String relativePathToApplication, { + @required bool release, + bool verifyCaching = false, + List additionalArgs = const [], +}) async { + assert(Platform.isWindows); + await runCommand(flutter, ['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 _flutterBuild( String relativePathToApplication, String platformLabel,