Unverified Commit 82675474 authored by Marcus Tomlinson's avatar Marcus Tomlinson Committed by GitHub

Add libgcrypt as an explicit dependancy on Linux (#77926)

parent d20ec4c7
......@@ -236,6 +236,8 @@ class UserMessages {
'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)';
String get gcryptLibraryMissing => 'The gcrypt development library is required for Linux development.\n'
'It is likely available from your distribution (e.g.: apt install libgcrypt20-dev)';
// Messages used in FlutterCommand
String flutterElapsedTime(String name, String elapsedTime) => '"flutter $name" took $elapsedTime.';
......
......@@ -159,6 +159,10 @@ class LinuxDoctorValidator extends DoctorValidator {
validationType = ValidationType.missing;
messages.add(ValidationMessage.error(_userMessages.lzmaLibraryMissing));
}
if (!await _libraryIsPresent('libgcrypt')) {
validationType = ValidationType.missing;
messages.add(ValidationMessage.error(_userMessages.gcryptLibraryMissing));
}
return ValidationResult(validationType, messages);
}
......
......@@ -26,6 +26,7 @@ pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid)
pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma)
pkg_check_modules(GCRYPT REQUIRED IMPORTED_TARGET libgcrypt)
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
......@@ -69,6 +70,7 @@ target_link_libraries(flutter INTERFACE
PkgConfig::GIO
PkgConfig::BLKID
PkgConfig::LZMA
PkgConfig::GCRYPT
)
add_dependencies(flutter flutter_assemble)
......
......@@ -102,6 +102,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager,
......@@ -127,6 +128,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager,
......@@ -153,6 +155,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager,
......@@ -179,6 +182,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager,
......@@ -205,6 +209,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
processManager: processManager,
......@@ -231,6 +236,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
......@@ -257,6 +263,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
......@@ -283,6 +290,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
......@@ -309,6 +317,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
......@@ -335,6 +344,7 @@ void main() {
..._gtkLibrariesMissingCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
......@@ -362,6 +372,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid', exists: false),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
......@@ -389,6 +400,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma', exists: false),
_libraryCheckCommand('libgcrypt'),
]);
final UserMessages userMessages = UserMessages();
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
......@@ -407,6 +419,34 @@ void main() {
]);
});
testWithoutContext('Missing validation when libgcrypt 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'),
_libraryCheckCommand('libgcrypt', 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.gcryptLibraryMissing),
]);
});
testWithoutContext('Missing validation when multiple dependencies are not available', () async {
final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
_missingBinaryCommand('clang++'),
......@@ -416,6 +456,7 @@ void main() {
..._gtkLibrariesPresentCommands(),
_libraryCheckCommand('blkid'),
_libraryCheckCommand('liblzma'),
_libraryCheckCommand('libgcrypt'),
]);
final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator(
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