mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
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.
This commit is contained in:
parent
2e75f52ae4
commit
22c502e315
|
@ -136,6 +136,13 @@ bool _shouldRunMacOS() {
|
||||||
return Platform.isMacOS && (branchName != 'beta' && branchName != 'stable');
|
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
|
/// Verify the Flutter Engine is the revision in
|
||||||
/// bin/cache/internal/engine.version.
|
/// bin/cache/internal/engine.version.
|
||||||
Future<void> _validateEngineHash() async {
|
Future<void> _validateEngineHash() async {
|
||||||
|
@ -393,6 +400,14 @@ Future<void> _runExampleProjectBuildTests(FileSystemEntity exampleDirectory) asy
|
||||||
print('Example project ${path.basename(examplePath)} has no macos directory, skipping macOS');
|
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, {
|
Future<void> _flutterBuildApk(String relativePathToApplication, {
|
||||||
|
@ -449,6 +464,21 @@ Future<void> _flutterBuildMacOS(String relativePathToApplication, {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(
|
Future<void> _flutterBuild(
|
||||||
String relativePathToApplication,
|
String relativePathToApplication,
|
||||||
String platformLabel,
|
String platformLabel,
|
||||||
|
|
Loading…
Reference in a new issue