-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring back dynamic load of VFS plugins
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
- Loading branch information
Showing
19 changed files
with
324 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) by Dominik Schmidt <dschmidt@owncloud.com> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
|
||
#include "plugin.h" | ||
|
||
#include "config.h" | ||
|
||
namespace OCC { | ||
|
||
PluginFactory::~PluginFactory() = default; | ||
|
||
QString pluginFileName(const QString &type, const QString &name) | ||
{ | ||
return QStringLiteral("%1sync_%2_%3") | ||
.arg(QStringLiteral(APPLICATION_EXECUTABLE), type, name); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) by Dominik Schmidt <dschmidt@owncloud.com> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "ocsynclib.h" | ||
#include <QObject> | ||
|
||
namespace OCC { | ||
|
||
class OCSYNC_EXPORT PluginFactory | ||
{ | ||
public: | ||
virtual ~PluginFactory(); | ||
virtual QObject* create(QObject* parent) = 0; | ||
}; | ||
|
||
template<class PluginClass> | ||
class DefaultPluginFactory : public PluginFactory | ||
{ | ||
public: | ||
QObject* create(QObject *parent) override | ||
{ | ||
return new PluginClass(parent); | ||
} | ||
}; | ||
|
||
/// Return the expected name of a plugin, for use with QPluginLoader | ||
QString pluginFileName(const QString &type, const QString &name); | ||
|
||
} | ||
|
||
Q_DECLARE_INTERFACE(OCC::PluginFactory, "org.owncloud.PluginFactory") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Globbing for plugins has a problem with in-source builds | ||
# that create directories for the build. | ||
#file(GLOB VIRTUAL_FILE_SYSTEM_PLUGINS RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*") | ||
|
||
list(APPEND VIRTUAL_FILE_SYSTEM_PLUGINS "suffix" "cfapi") | ||
|
||
message("list of plugins ${VIRTUAL_FILE_SYSTEM_PLUGINS}") | ||
|
||
foreach(vfsPlugin ${VIRTUAL_FILE_SYSTEM_PLUGINS}) | ||
set(vfsPluginPath ${vfsPlugin}) | ||
get_filename_component(vfsPluginName ${vfsPlugin} NAME) | ||
message("discovery ${vfsPlugin}") | ||
if (NOT IS_ABSOLUTE ${vfsPlugin}) | ||
set(vfsPluginPath "${CMAKE_CURRENT_SOURCE_DIR}/${vfsPlugin}") | ||
message("${vfsPluginPath}") | ||
endif() | ||
if(NOT IS_DIRECTORY ${vfsPluginPath}) | ||
continue() | ||
endif() | ||
|
||
message("${vfsPluginPath} ${vfsPluginName}") | ||
add_subdirectory(${vfsPluginPath} ${vfsPluginName}) | ||
|
||
if(UNIT_TESTING AND IS_DIRECTORY "${vfsPluginPath}/test") | ||
add_subdirectory("${vfsPluginPath}/test" "${vfsPluginName}_test") | ||
message(STATUS "Added vfsPlugin with tests: ${vfsPluginName}") | ||
else() | ||
message(STATUS "Added vfsPlugin without tests: ${vfsPluginName}") | ||
endif() | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
if (WIN32) | ||
add_library("${synclib_NAME}_vfs_cfapi" SHARED | ||
cfapiwrapper.cpp | ||
hydrationjob.cpp | ||
vfs_cfapi.cpp | ||
) | ||
|
||
target_link_libraries("${synclib_NAME}_vfs_cfapi" | ||
"${synclib_NAME}" | ||
cldapi | ||
) | ||
|
||
target_compile_definitions("${synclib_NAME}_vfs_cfapi" | ||
PUBLIC -D_WIN32_WINNT=_WIN32_WINNT_WIN10 | ||
) | ||
|
||
set_target_properties("${synclib_NAME}_vfs_cfapi" PROPERTIES | ||
LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} | ||
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} | ||
PREFIX "" | ||
AUTOMOC TRUE | ||
) | ||
|
||
if(APPLE) | ||
# for being loadable when client run from build dir | ||
set(vfs_buildoutputdir "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns/") | ||
set_target_properties("${synclib_NAME}_vfs_cfapi" | ||
PROPERTIES | ||
LIBRARY_OUTPUT_DIRECTORY ${vfs_buildoutputdir} | ||
RUNTIME_OUTPUT_DIRECTORY ${vfs_buildoutputdir} | ||
) | ||
# For being lodable when client run from install dir (after make macdeployqt) | ||
set(vfs_installdir "${LIB_INSTALL_DIR}/../PlugIns") | ||
else() | ||
set(vfs_installdir "${PLUGINDIR}") | ||
endif() | ||
|
||
INSTALL(TARGETS "${synclib_NAME}_vfs_cfapi" | ||
LIBRARY DESTINATION "${vfs_installdir}" | ||
RUNTIME DESTINATION "${vfs_installdir}" | ||
) | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.