Unverified Commit 343577af authored by Marcus Tomlinson's avatar Marcus Tomlinson Committed by GitHub

Add liblzma as an explicit dependancy on Linux (#70617)

parent b84fb904
...@@ -237,6 +237,8 @@ class UserMessages { ...@@ -237,6 +237,8 @@ class UserMessages {
'They are likely available from your distribution (e.g.: apt install libgtk-3-dev)'; 'They are likely available from your distribution (e.g.: apt install libgtk-3-dev)';
String get blkidLibraryMissing => 'The blkid development library is required for Linux development.\n' String get blkidLibraryMissing => 'The blkid development library is required for Linux development.\n'
'It is likely available from your distribution (e.g.: apt install libblkid-dev)'; 'It is likely available from your distribution (e.g.: apt install libblkid-dev)';
String get lzmaLibraryMissing => 'The lzma development library is required for Linux development.\n'
'It is likely available from your distribution (e.g.: apt install liblzma-dev)';
// Messages used in FlutterCommand // Messages used in FlutterCommand
String flutterElapsedTime(String name, String elapsedTime) => '"flutter $name" took $elapsedTime.'; String flutterElapsedTime(String name, String elapsedTime) => '"flutter $name" took $elapsedTime.';
......
...@@ -153,6 +153,10 @@ class LinuxDoctorValidator extends DoctorValidator { ...@@ -153,6 +153,10 @@ class LinuxDoctorValidator extends DoctorValidator {
validationType = ValidationType.missing; validationType = ValidationType.missing;
messages.add(ValidationMessage.error(_userMessages.blkidLibraryMissing)); messages.add(ValidationMessage.error(_userMessages.blkidLibraryMissing));
} }
if (!await _libraryIsPresent('liblzma')) {
validationType = ValidationType.missing;
messages.add(ValidationMessage.error(_userMessages.lzmaLibraryMissing));
}
return ValidationResult(validationType, messages); return ValidationResult(validationType, messages);
} }
......
...@@ -25,6 +25,7 @@ pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) ...@@ -25,6 +25,7 @@ pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid) pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid)
pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma)
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
...@@ -67,6 +68,7 @@ target_link_libraries(flutter INTERFACE ...@@ -67,6 +68,7 @@ target_link_libraries(flutter INTERFACE
PkgConfig::GLIB PkgConfig::GLIB
PkgConfig::GIO PkgConfig::GIO
PkgConfig::BLKID PkgConfig::BLKID
PkgConfig::LZMA
) )
add_dependencies(flutter flutter_assemble) add_dependencies(flutter flutter_assemble)
......
...@@ -100,6 +100,7 @@ void main() { ...@@ -100,6 +100,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager, processManager: processManager,
...@@ -124,6 +125,7 @@ void main() { ...@@ -124,6 +125,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager, processManager: processManager,
...@@ -149,6 +151,7 @@ void main() { ...@@ -149,6 +151,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager, processManager: processManager,
...@@ -174,6 +177,7 @@ void main() { ...@@ -174,6 +177,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager, processManager: processManager,
...@@ -199,6 +203,7 @@ void main() { ...@@ -199,6 +203,7 @@ void main() {
_pkgConfigPresentCommand('0.27.0'), _pkgConfigPresentCommand('0.27.0'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager, processManager: processManager,
...@@ -224,6 +229,7 @@ void main() { ...@@ -224,6 +229,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final UserMessages userMessages = UserMessages(); final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
...@@ -249,6 +255,7 @@ void main() { ...@@ -249,6 +255,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final UserMessages userMessages = UserMessages(); final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
...@@ -274,6 +281,7 @@ void main() { ...@@ -274,6 +281,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final UserMessages userMessages = UserMessages(); final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
...@@ -299,6 +307,7 @@ void main() { ...@@ -299,6 +307,7 @@ void main() {
_missingBinaryCommand('pkg-config'), _missingBinaryCommand('pkg-config'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final UserMessages userMessages = UserMessages(); final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
...@@ -324,6 +333,7 @@ void main() { ...@@ -324,6 +333,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesMissingCommands(), ..._gtkLibrariesMissingCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final UserMessages userMessages = UserMessages(); final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
...@@ -342,7 +352,7 @@ void main() { ...@@ -342,7 +352,7 @@ void main() {
]); ]);
}); });
testWithoutContext('Missing validation when libraries are not available', () async { testWithoutContext('Missing validation when blkid is not available', () async {
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[ final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
_clangPresentCommand('4.0.1'), _clangPresentCommand('4.0.1'),
_cmakePresentCommand('3.16.3'), _cmakePresentCommand('3.16.3'),
...@@ -350,6 +360,7 @@ void main() { ...@@ -350,6 +360,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid', exists: false), _libraryCheckCommand('blkid', exists: false),
_libraryCheckCommand('liblzma'),
]); ]);
final UserMessages userMessages = UserMessages(); final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
...@@ -368,6 +379,33 @@ void main() { ...@@ -368,6 +379,33 @@ void main() {
]); ]);
}); });
testWithoutContext('Missing validation when liblzma is not available', () async {
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
_clangPresentCommand('4.0.1'),
_cmakePresentCommand('3.16.3'),
_ninjaPresentCommand('1.10.0'),
_pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma', exists: false),
]);
final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager,
userMessages: userMessages,
);
final ValidationResult result = await linuxDoctorValidator.validate();
expect(result.type, ValidationType.missing);
expect(result.messages, <ValidationMessage>[
const ValidationMessage('clang version 4.0.1-6+build1'),
const ValidationMessage('cmake version 3.16.3'),
const ValidationMessage('ninja version 1.10.0'),
const ValidationMessage('pkg-config version 0.29'),
ValidationMessage.error(userMessages.lzmaLibraryMissing),
]);
});
testWithoutContext('Missing validation when multiple dependencies are not available', () async { testWithoutContext('Missing validation when multiple dependencies are not available', () async {
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[ final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
_missingBinaryCommand('clang++'), _missingBinaryCommand('clang++'),
...@@ -376,6 +414,7 @@ void main() { ...@@ -376,6 +414,7 @@ void main() {
_pkgConfigPresentCommand('0.29'), _pkgConfigPresentCommand('0.29'),
..._gtkLibrariesPresentCommands(), ..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'), _libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
]); ]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager, processManager: processManager,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment