Enable dev/bots/ build_tests for Linux (#68658)
Enables build_test for Linux. 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 Linux.
Other example/test projects can be brought online for Linux in the future just by adding the linux/ directory to the project.
diff --git a/dev/bots/test.dart b/dev/bots/test.dart
index a1c3cf5..e05c6fc 100644
--- a/dev/bots/test.dart
+++ b/dev/bots/test.dart
@@ -129,6 +129,13 @@
print('$clock ${bold}Test successful.$reset');
}
+/// Returns whether or not Linux desktop tests should be run.
+///
+/// The branch restrictions here should stay in sync with features.dart.
+bool _shouldRunLinux() {
+ return Platform.isLinux && (branchName != 'beta' && branchName != 'stable');
+}
+
/// Returns whether or not macOS desktop tests should be run.
///
/// The branch restrictions here should stay in sync with features.dart.
@@ -400,6 +407,14 @@
print('Example project ${path.basename(examplePath)} has no ios directory, skipping ipa');
}
}
+ if (_shouldRunLinux()) {
+ if (Directory(path.join(examplePath, 'linux')).existsSync()) {
+ await _flutterBuildLinux(examplePath, release: false, additionalArgs: additionalArgs, verifyCaching: verifyCaching);
+ await _flutterBuildLinux(examplePath, release: true, additionalArgs: additionalArgs, verifyCaching: verifyCaching);
+ } else {
+ print('Example project ${path.basename(examplePath)} has no linux directory, skipping Linux');
+ }
+ }
if (_shouldRunMacOS()) {
if (Directory(path.join(examplePath, 'macos')).existsSync()) {
await _flutterBuildMacOS(examplePath, release: false, additionalArgs: additionalArgs, verifyCaching: verifyCaching);
@@ -457,6 +472,21 @@
);
}
+Future<void> _flutterBuildLinux(String relativePathToApplication, {
+ @required bool release,
+ bool verifyCaching = false,
+ List<String> additionalArgs = const <String>[],
+}) async {
+ assert(Platform.isLinux);
+ await runCommand(flutter, <String>['config', '--enable-linux-desktop']);
+ print('${green}Testing Linux build$reset for $cyan$relativePathToApplication$reset...');
+ await _flutterBuild(relativePathToApplication, 'Linux', 'linux',
+ release: release,
+ verifyCaching: verifyCaching,
+ additionalArgs: additionalArgs
+ );
+}
+
Future<void> _flutterBuildMacOS(String relativePathToApplication, {
@required bool release,
bool verifyCaching = false,