From 245d0bdb174b4737983077a6525b2050328e5379 Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Wed, 12 Jun 2024 22:01:25 -0300 Subject: [PATCH] Deduplicate Qt plugins deployment --- src/deployers/BasicPluginsDeployer.cpp | 18 ++++++++++-- src/deployers/BasicPluginsDeployer.h | 20 ++++++++++++- src/deployers/BearerPluginsDeployer.cpp | 17 ++--------- src/deployers/BearerPluginsDeployer.h | 2 +- src/deployers/GamepadPluginsDeployer.cpp | 17 ++--------- src/deployers/GamepadPluginsDeployer.h | 2 +- src/deployers/LocationPluginsDeployer.cpp | 17 ++--------- src/deployers/LocationPluginsDeployer.h | 2 +- src/deployers/Multimedia5PluginsDeployer.cpp | 24 ++------------- src/deployers/Multimedia5PluginsDeployer.h | 2 +- src/deployers/Multimedia6PluginsDeployer.cpp | 16 ++-------- src/deployers/Multimedia6PluginsDeployer.h | 2 +- src/deployers/PlatformPluginsDeployer.cpp | 20 ++++--------- src/deployers/PlatformPluginsDeployer.h | 3 +- src/deployers/PluginsDeployerFactory.cpp | 4 +-- src/deployers/PositioningPluginsDeployer.cpp | 17 ++--------- src/deployers/PositioningPluginsDeployer.h | 2 +- src/deployers/PrintSupportPluginsDeployer.cpp | 17 ++--------- src/deployers/PrintSupportPluginsDeployer.h | 2 +- src/deployers/QmlPluginsDeployer.cpp | 6 +--- src/deployers/QmlPluginsDeployer.h | 2 +- src/deployers/Qt3DPluginsDeployer.cpp | 22 ++------------ src/deployers/Qt3DPluginsDeployer.h | 2 +- src/deployers/SqlPluginsDeployer.cpp | 17 ++--------- src/deployers/SqlPluginsDeployer.h | 2 +- src/deployers/SvgPluginsDeployer.cpp | 6 +--- src/deployers/SvgPluginsDeployer.h | 2 +- src/deployers/TextToSpeechPluginsDeployer.cpp | 2 +- src/deployers/TextToSpeechPluginsDeployer.h | 2 +- src/deployers/TlsBackendsDeployer.cpp | 17 ++--------- src/deployers/TlsBackendsDeployer.h | 2 +- .../WaylandcompositorPluginsDeployer.cpp | 29 +++---------------- .../WaylandcompositorPluginsDeployer.h | 2 +- src/deployers/WebEnginePluginsDeployer.cpp | 2 +- src/deployers/WebEnginePluginsDeployer.h | 2 +- .../XcbglIntegrationPluginsDeployer.cpp | 6 +--- .../XcbglIntegrationPluginsDeployer.h | 2 +- 37 files changed, 90 insertions(+), 239 deletions(-) diff --git a/src/deployers/BasicPluginsDeployer.cpp b/src/deployers/BasicPluginsDeployer.cpp index ba927c1..5de1aca 100644 --- a/src/deployers/BasicPluginsDeployer.cpp +++ b/src/deployers/BasicPluginsDeployer.cpp @@ -29,7 +29,21 @@ BasicPluginsDeployer::BasicPluginsDeployer(std::string moduleName, qtDataPath(std::move(qtDataPath)) {} bool BasicPluginsDeployer::deploy() { - // currently this is a no-op, but we might add more functionality later on, such as some kinds of default - // attempts to copy data based on the moduleName + for (const auto &pluginName : qtPluginsToBeDeployed()) { + ldLog() << "Deploying" << pluginName << "plugins" << std::endl; + for (fs::directory_iterator i(qtPluginsPath / pluginName); i != fs::directory_iterator(); ++i) { + if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins" / pluginName)) + return false; + } + } + + return customDeploy(); +} + +bool BasicPluginsDeployer::customDeploy() { return true; } + +std::vector BasicPluginsDeployer::qtPluginsToBeDeployed() const { + return {}; +} diff --git a/src/deployers/BasicPluginsDeployer.h b/src/deployers/BasicPluginsDeployer.h index 1394f53..c6df18c 100644 --- a/src/deployers/BasicPluginsDeployer.h +++ b/src/deployers/BasicPluginsDeployer.h @@ -49,7 +49,25 @@ namespace linuxdeploy { virtual ~BasicPluginsDeployer() = default; public: - bool deploy() override; + /** + * This method deploys the plugins returned by \sa qtPluginsToBeDeployed() + * and call \sa customDeploy() to finalize the deployment. + */ + bool deploy() override final; + + protected: + /** + * The \sa deploy() method can deploy Qt plugins that follow the default + * name and path scheme, but some modules are special so + * they should write custom deployment code. + */ + virtual bool customDeploy(); + + /** + * Returns a list of Qt plugin names that should be deployed and + * follow the default name and path scheme. + */ + virtual std::vector qtPluginsToBeDeployed() const; }; } } diff --git a/src/deployers/BearerPluginsDeployer.cpp b/src/deployers/BearerPluginsDeployer.cpp index 5784060..9aee6dc 100644 --- a/src/deployers/BearerPluginsDeployer.cpp +++ b/src/deployers/BearerPluginsDeployer.cpp @@ -10,19 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool BearerPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying bearer plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "bearer"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/bearer/")) - return false; - } - - return true; +std::vector BearerPluginsDeployer::qtPluginsToBeDeployed() const { + return {"bearer"}; } diff --git a/src/deployers/BearerPluginsDeployer.h b/src/deployers/BearerPluginsDeployer.h index 91a8c77..fb87dd4 100644 --- a/src/deployers/BearerPluginsDeployer.h +++ b/src/deployers/BearerPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/GamepadPluginsDeployer.cpp b/src/deployers/GamepadPluginsDeployer.cpp index 6ebedb7..ae99fcb 100644 --- a/src/deployers/GamepadPluginsDeployer.cpp +++ b/src/deployers/GamepadPluginsDeployer.cpp @@ -10,19 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool GamepadPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying Gamepad plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "gamepads"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/gamepads/")) - return false; - } - - return true; +std::vector GamepadPluginsDeployer::qtPluginsToBeDeployed() const { + return {"gamepads"}; } diff --git a/src/deployers/GamepadPluginsDeployer.h b/src/deployers/GamepadPluginsDeployer.h index a0d28fa..44fd36c 100644 --- a/src/deployers/GamepadPluginsDeployer.h +++ b/src/deployers/GamepadPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/LocationPluginsDeployer.cpp b/src/deployers/LocationPluginsDeployer.cpp index 689f2c8..3948ab5 100644 --- a/src/deployers/LocationPluginsDeployer.cpp +++ b/src/deployers/LocationPluginsDeployer.cpp @@ -10,19 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool LocationPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying Location plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "geoservices"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/geoservices/")) - return false; - } - - return true; +std::vector LocationPluginsDeployer::qtPluginsToBeDeployed() const { + return {"geoservices"}; } diff --git a/src/deployers/LocationPluginsDeployer.h b/src/deployers/LocationPluginsDeployer.h index 645f32c..606dd06 100644 --- a/src/deployers/LocationPluginsDeployer.h +++ b/src/deployers/LocationPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/Multimedia5PluginsDeployer.cpp b/src/deployers/Multimedia5PluginsDeployer.cpp index 0718328..94be8ec 100644 --- a/src/deployers/Multimedia5PluginsDeployer.cpp +++ b/src/deployers/Multimedia5PluginsDeployer.cpp @@ -10,26 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool Multimedia5PluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying mediaservice plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "mediaservice"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/mediaservice/")) - return false; - } - - ldLog() << "Deploying audio plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "audio"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/audio/")) - return false; - } - - return true; +std::vector Multimedia5PluginsDeployer::qtPluginsToBeDeployed() const { + return {"mediaservice", "audio"}; } diff --git a/src/deployers/Multimedia5PluginsDeployer.h b/src/deployers/Multimedia5PluginsDeployer.h index b674ace..89f6908 100644 --- a/src/deployers/Multimedia5PluginsDeployer.h +++ b/src/deployers/Multimedia5PluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/Multimedia6PluginsDeployer.cpp b/src/deployers/Multimedia6PluginsDeployer.cpp index 2ea8fee..b23c1bd 100644 --- a/src/deployers/Multimedia6PluginsDeployer.cpp +++ b/src/deployers/Multimedia6PluginsDeployer.cpp @@ -12,21 +12,11 @@ using namespace linuxdeploy::core::log; namespace fs = std::filesystem; -bool Multimedia6PluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - +std::vector Multimedia6PluginsDeployer::qtPluginsToBeDeployed() const { if (fs::exists(qtPluginsPath / "multimedia")) { - ldLog() << "Deploying multimedia plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "multimedia"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/multimedia/")) - return false; - } + return {"multimedia"}; } else { ldLog() << LD_WARNING << "Missing Qt 6 multimedia plugins, skipping." << std::endl; + return {}; } - - return true; } diff --git a/src/deployers/Multimedia6PluginsDeployer.h b/src/deployers/Multimedia6PluginsDeployer.h index 60d61cc..a0e045d 100644 --- a/src/deployers/Multimedia6PluginsDeployer.h +++ b/src/deployers/Multimedia6PluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/PlatformPluginsDeployer.cpp b/src/deployers/PlatformPluginsDeployer.cpp index 5d5076b..abe32c0 100644 --- a/src/deployers/PlatformPluginsDeployer.cpp +++ b/src/deployers/PlatformPluginsDeployer.cpp @@ -13,11 +13,7 @@ using namespace linuxdeploy::core::log; namespace fs = std::filesystem; -bool PlatformPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - +bool PlatformPluginsDeployer::customDeploy() { ldLog() << "Deploying platform plugins" << std::endl; // always deploy default platform @@ -32,16 +28,6 @@ bool PlatformPluginsDeployer::deploy() { if (!appDir.deployLibrary(qtPluginsPath / "platforms" / platformToDeploy, appDir.path() / "usr/plugins/platforms/")) return false; } - } - - for (fs::directory_iterator i(qtPluginsPath / "platforminputcontexts"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/platforminputcontexts/")) - return false; - } - - for (fs::directory_iterator i(qtPluginsPath / "imageformats"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/imageformats/")) - return false; } // TODO: platform themes -- https://github.com/probonopd/linuxdeployqt/issues/236 @@ -82,3 +68,7 @@ bool PlatformPluginsDeployer::deploy() { return true; } + +std::vector PlatformPluginsDeployer::qtPluginsToBeDeployed() const { + return {"platforminputcontexts", "imageformats"}; +} diff --git a/src/deployers/PlatformPluginsDeployer.h b/src/deployers/PlatformPluginsDeployer.h index 20379f8..c235894 100644 --- a/src/deployers/PlatformPluginsDeployer.h +++ b/src/deployers/PlatformPluginsDeployer.h @@ -10,7 +10,8 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + bool customDeploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/PluginsDeployerFactory.cpp b/src/deployers/PluginsDeployerFactory.cpp index ea88ec2..18a9130 100644 --- a/src/deployers/PluginsDeployerFactory.cpp +++ b/src/deployers/PluginsDeployerFactory.cpp @@ -73,9 +73,9 @@ std::vector> PluginsDeployerFactory::getDeploye } if (moduleName == "multimedia") { - if (qtMajorVersion < 6) { + if (qtMajorVersion < 6) { return {getInstance(moduleName)}; - } else { + } else { return {getInstance(moduleName)}; } } diff --git a/src/deployers/PositioningPluginsDeployer.cpp b/src/deployers/PositioningPluginsDeployer.cpp index 5c95e7f..3056e06 100644 --- a/src/deployers/PositioningPluginsDeployer.cpp +++ b/src/deployers/PositioningPluginsDeployer.cpp @@ -10,19 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool PositioningPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying positioning plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "position"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/position/")) - return false; - } - - return true; +std::vector PositioningPluginsDeployer::qtPluginsToBeDeployed() const { + return {"position"}; } diff --git a/src/deployers/PositioningPluginsDeployer.h b/src/deployers/PositioningPluginsDeployer.h index c60e221..af5ae0a 100644 --- a/src/deployers/PositioningPluginsDeployer.h +++ b/src/deployers/PositioningPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/PrintSupportPluginsDeployer.cpp b/src/deployers/PrintSupportPluginsDeployer.cpp index 15c1d86..eb7a8af 100644 --- a/src/deployers/PrintSupportPluginsDeployer.cpp +++ b/src/deployers/PrintSupportPluginsDeployer.cpp @@ -10,19 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool PrintSupportPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying printsupport plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "printsupport"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/printsupport/")) - return false; - } - - return true; +std::vector PrintSupportPluginsDeployer::qtPluginsToBeDeployed() const { + return {"printsupport"}; } diff --git a/src/deployers/PrintSupportPluginsDeployer.h b/src/deployers/PrintSupportPluginsDeployer.h index 6780d06..9b502c9 100644 --- a/src/deployers/PrintSupportPluginsDeployer.h +++ b/src/deployers/PrintSupportPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/QmlPluginsDeployer.cpp b/src/deployers/QmlPluginsDeployer.cpp index e538ea1..c072ce7 100644 --- a/src/deployers/QmlPluginsDeployer.cpp +++ b/src/deployers/QmlPluginsDeployer.cpp @@ -8,11 +8,7 @@ using namespace linuxdeploy::plugin::qt; namespace fs = std::filesystem; -bool QmlPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - +bool QmlPluginsDeployer::customDeploy() { try { deployQml(appDir, qtInstallQmlPath); } catch (const QmlImportScannerError &) { diff --git a/src/deployers/QmlPluginsDeployer.h b/src/deployers/QmlPluginsDeployer.h index 28ddc0d..54e20e3 100644 --- a/src/deployers/QmlPluginsDeployer.h +++ b/src/deployers/QmlPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + bool customDeploy() override; }; } } diff --git a/src/deployers/Qt3DPluginsDeployer.cpp b/src/deployers/Qt3DPluginsDeployer.cpp index 635ea04..d431dba 100644 --- a/src/deployers/Qt3DPluginsDeployer.cpp +++ b/src/deployers/Qt3DPluginsDeployer.cpp @@ -10,24 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool Qt3DPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying Qt 3D plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "geometryloaders"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/geometryloaders/")) - return false; - } - - for (fs::directory_iterator i(qtPluginsPath / "sceneparsers"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/sceneparsers/")) - return false; - } - - return true; +std::vector Qt3DPluginsDeployer::qtPluginsToBeDeployed() const { + return {"geometryloaders", "sceneparsers"}; } diff --git a/src/deployers/Qt3DPluginsDeployer.h b/src/deployers/Qt3DPluginsDeployer.h index 5810a34..56610f2 100644 --- a/src/deployers/Qt3DPluginsDeployer.h +++ b/src/deployers/Qt3DPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/SqlPluginsDeployer.cpp b/src/deployers/SqlPluginsDeployer.cpp index 6d0111b..a9a7d2a 100644 --- a/src/deployers/SqlPluginsDeployer.cpp +++ b/src/deployers/SqlPluginsDeployer.cpp @@ -10,19 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool SqlPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying SQL plugins" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "sqldrivers"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/sqldrivers/")) - return false; - } - - return true; +std::vector SqlPluginsDeployer::qtPluginsToBeDeployed() const { + return {"sqldrivers"}; } diff --git a/src/deployers/SqlPluginsDeployer.h b/src/deployers/SqlPluginsDeployer.h index 9329aef..0a88cd4 100644 --- a/src/deployers/SqlPluginsDeployer.h +++ b/src/deployers/SqlPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/SvgPluginsDeployer.cpp b/src/deployers/SvgPluginsDeployer.cpp index 90a628d..8b59c5d 100644 --- a/src/deployers/SvgPluginsDeployer.cpp +++ b/src/deployers/SvgPluginsDeployer.cpp @@ -12,11 +12,7 @@ using namespace linuxdeploy::core::log; namespace fs = std::filesystem; -bool SvgPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - +bool SvgPluginsDeployer::customDeploy() { ldLog() << "Deploying svg icon engine" << std::endl; if (!appDir.deployLibrary(qtPluginsPath / "iconengines/libqsvgicon.so", appDir.path() / "usr/plugins/iconengines/")) diff --git a/src/deployers/SvgPluginsDeployer.h b/src/deployers/SvgPluginsDeployer.h index 18466b6..bd5cb2f 100644 --- a/src/deployers/SvgPluginsDeployer.h +++ b/src/deployers/SvgPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + bool customDeploy() override; }; } } diff --git a/src/deployers/TextToSpeechPluginsDeployer.cpp b/src/deployers/TextToSpeechPluginsDeployer.cpp index a0124d6..c2939d8 100644 --- a/src/deployers/TextToSpeechPluginsDeployer.cpp +++ b/src/deployers/TextToSpeechPluginsDeployer.cpp @@ -12,7 +12,7 @@ using namespace linuxdeploy::core::log; namespace fs = std::filesystem; -bool TextToSpeechPluginsDeployer::deploy() { +bool TextToSpeechPluginsDeployer::customDeploy() { // calling the default code is optional, but it won't hurt for now if (!BasicPluginsDeployer::deploy()) return false; diff --git a/src/deployers/TextToSpeechPluginsDeployer.h b/src/deployers/TextToSpeechPluginsDeployer.h index 2138723..2a07fd0 100644 --- a/src/deployers/TextToSpeechPluginsDeployer.h +++ b/src/deployers/TextToSpeechPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + bool customDeploy() override; }; } } diff --git a/src/deployers/TlsBackendsDeployer.cpp b/src/deployers/TlsBackendsDeployer.cpp index e6c84b9..10badc1 100644 --- a/src/deployers/TlsBackendsDeployer.cpp +++ b/src/deployers/TlsBackendsDeployer.cpp @@ -10,19 +10,6 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool TlsBackendsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying TLS backends" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "tls"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/tls/")) - return false; - } - - return true; +std::vector TlsBackendsDeployer::qtPluginsToBeDeployed() const { + return {"tls"}; } diff --git a/src/deployers/TlsBackendsDeployer.h b/src/deployers/TlsBackendsDeployer.h index e3aa3a2..2a2364d 100644 --- a/src/deployers/TlsBackendsDeployer.h +++ b/src/deployers/TlsBackendsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/WaylandcompositorPluginsDeployer.cpp b/src/deployers/WaylandcompositorPluginsDeployer.cpp index 3a0e667..489301f 100644 --- a/src/deployers/WaylandcompositorPluginsDeployer.cpp +++ b/src/deployers/WaylandcompositorPluginsDeployer.cpp @@ -10,29 +10,8 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -namespace fs = std::filesystem; - -bool WaylandcompositorPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - - ldLog() << "Deploying waylandcompositor plugin" << std::endl; - - for (fs::directory_iterator i(qtPluginsPath / "wayland-decoration-client"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/wayland-decoration-client/")) - return false; - } - - for (fs::directory_iterator i(qtPluginsPath / "wayland-graphics-integration-client"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/wayland-graphics-integration-client/")) - return false; - } - - for (fs::directory_iterator i(qtPluginsPath / "wayland-shell-integration"); i != fs::directory_iterator(); ++i) { - if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/wayland-shell-integration/")) - return false; - } - - return true; +std::vector WaylandcompositorPluginsDeployer::qtPluginsToBeDeployed() const { + return {"wayland-decoration-client", + "wayland-graphics-integration-client", + "wayland-shell-integration",}; } diff --git a/src/deployers/WaylandcompositorPluginsDeployer.h b/src/deployers/WaylandcompositorPluginsDeployer.h index 3840002..0f9d552 100644 --- a/src/deployers/WaylandcompositorPluginsDeployer.h +++ b/src/deployers/WaylandcompositorPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + std::vector qtPluginsToBeDeployed() const override; }; } } diff --git a/src/deployers/WebEnginePluginsDeployer.cpp b/src/deployers/WebEnginePluginsDeployer.cpp index f93ed1f..a02be57 100644 --- a/src/deployers/WebEnginePluginsDeployer.cpp +++ b/src/deployers/WebEnginePluginsDeployer.cpp @@ -14,7 +14,7 @@ using namespace linuxdeploy::core::log; namespace fs = std::filesystem; -bool WebEnginePluginsDeployer::deploy() { +bool WebEnginePluginsDeployer::customDeploy() { // calling the default code is optional, but it won't hurt for now if (!BasicPluginsDeployer::deploy()) return false; diff --git a/src/deployers/WebEnginePluginsDeployer.h b/src/deployers/WebEnginePluginsDeployer.h index 64ba8bd..a0cf050 100644 --- a/src/deployers/WebEnginePluginsDeployer.h +++ b/src/deployers/WebEnginePluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + bool customDeploy() override; }; } } diff --git a/src/deployers/XcbglIntegrationPluginsDeployer.cpp b/src/deployers/XcbglIntegrationPluginsDeployer.cpp index 21c54a4..a8d1e18 100644 --- a/src/deployers/XcbglIntegrationPluginsDeployer.cpp +++ b/src/deployers/XcbglIntegrationPluginsDeployer.cpp @@ -8,11 +8,7 @@ using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::log; -bool XcbglIntegrationPluginsDeployer::deploy() { - // calling the default code is optional, but it won't hurt for now - if (!BasicPluginsDeployer::deploy()) - return false; - +bool XcbglIntegrationPluginsDeployer::customDeploy() { ldLog() << "Deploying xcb-gl integrations" << std::endl; return deployIntegrationPlugins(appDir, qtPluginsPath, {"xcbglintegrations/"}); diff --git a/src/deployers/XcbglIntegrationPluginsDeployer.h b/src/deployers/XcbglIntegrationPluginsDeployer.h index 23d1db5..6523393 100644 --- a/src/deployers/XcbglIntegrationPluginsDeployer.h +++ b/src/deployers/XcbglIntegrationPluginsDeployer.h @@ -10,7 +10,7 @@ namespace linuxdeploy { // we can just use the base class's constructor using BasicPluginsDeployer::BasicPluginsDeployer; - bool deploy() override; + bool customDeploy() override; }; } }