mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
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.
This commit is contained in:
parent
18341efa2f
commit
c23319ee9f
|
@ -129,6 +129,13 @@ Future<void> main(List<String> args) async {
|
|||
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 @@ Future<void> _runExampleProjectBuildTests(FileSystemEntity exampleDirectory) asy
|
|||
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> _flutterBuildIpa(String relativePathToApplication, {
|
|||
);
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue