Skip to content

Commit

Permalink
allow compilation of cfapi automated test
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien committed Jun 25, 2021
1 parent 44eeddc commit ad47fd8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/libsync/vfs/cfapi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
if (WIN32)
add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WIN10)

include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})

add_library("${synclib_NAME}_vfs_cfapi" SHARED
cfapiwrapper.cpp
hydrationjob.cpp
Expand Down Expand Up @@ -33,6 +35,12 @@ if (WIN32)
set(vfs_installdir "${PLUGINDIR}")
endif()

GENERATE_EXPORT_HEADER( "${synclib_NAME}_vfs_cfapi"
BASE_NAME "${synclib_NAME}_vfs_cfapi"
EXPORT_MACRO_NAME NEXTCLOUD_CFAPI_EXPORT
EXPORT_FILE_NAME cfapiexport.h
)

INSTALL(TARGETS "${synclib_NAME}_vfs_cfapi"
LIBRARY DESTINATION "${vfs_installdir}"
RUNTIME DESTINATION "${vfs_installdir}"
Expand Down
22 changes: 11 additions & 11 deletions src/libsync/vfs/cfapi/cfapiwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <memory>

#include "owncloudlib.h"
#include "cfapiexport.h"
#include "common/pinstate.h"
#include "common/result.h"

Expand All @@ -28,7 +28,7 @@ class VfsCfApi;
namespace CfApiWrapper
{

class OWNCLOUDSYNC_EXPORT ConnectionKey
class NEXTCLOUD_CFAPI_EXPORT ConnectionKey
{
public:
ConnectionKey();
Expand All @@ -38,7 +38,7 @@ class OWNCLOUDSYNC_EXPORT ConnectionKey
std::unique_ptr<void, void(*)(void *)> _data;
};

class OWNCLOUDSYNC_EXPORT FileHandle
class NEXTCLOUD_CFAPI_EXPORT FileHandle
{
public:
using Deleter = void (*)(void *);
Expand All @@ -53,7 +53,7 @@ class OWNCLOUDSYNC_EXPORT FileHandle
std::unique_ptr<void, void(*)(void *)> _data;
};

class OWNCLOUDSYNC_EXPORT PlaceHolderInfo
class NEXTCLOUD_CFAPI_EXPORT PlaceHolderInfo
{
public:
using Deleter = void (*)(CF_PLACEHOLDER_BASIC_INFO *);
Expand All @@ -71,15 +71,15 @@ class OWNCLOUDSYNC_EXPORT PlaceHolderInfo
std::unique_ptr<CF_PLACEHOLDER_BASIC_INFO, Deleter> _data;
};

OWNCLOUDSYNC_EXPORT Result<void, QString> registerSyncRoot(const QString &path, const QString &providerName, const QString &providerVersion, const QString &folderAlias, const QString &displayName, const QString &accountDisplayName);
OWNCLOUDSYNC_EXPORT Result<void, QString> unregisterSyncRoot(const QString &path, const QString &providerName, const QString &accountDisplayName);
NEXTCLOUD_CFAPI_EXPORT Result<void, QString> registerSyncRoot(const QString &path, const QString &providerName, const QString &providerVersion, const QString &folderAlias, const QString &displayName, const QString &accountDisplayName);
NEXTCLOUD_CFAPI_EXPORT Result<void, QString> unregisterSyncRoot(const QString &path, const QString &providerName, const QString &accountDisplayName);

OWNCLOUDSYNC_EXPORT Result<ConnectionKey, QString> connectSyncRoot(const QString &path, VfsCfApi *context);
OWNCLOUDSYNC_EXPORT Result<void, QString> disconnectSyncRoot(ConnectionKey &&key);
NEXTCLOUD_CFAPI_EXPORT Result<ConnectionKey, QString> connectSyncRoot(const QString &path, VfsCfApi *context);
NEXTCLOUD_CFAPI_EXPORT Result<void, QString> disconnectSyncRoot(ConnectionKey &&key);

bool isSparseFile(const QString &path);
NEXTCLOUD_CFAPI_EXPORT bool isSparseFile(const QString &path);

FileHandle handleForPath(const QString &path);
NEXTCLOUD_CFAPI_EXPORT FileHandle handleForPath(const QString &path);

PlaceHolderInfo findPlaceholderInfo(const FileHandle &handle);

Expand All @@ -89,7 +89,7 @@ enum SetPinRecurseMode {
ChildrenOnly
};

Result<void, QString> setPinState(const FileHandle &handle, PinState state, SetPinRecurseMode mode);
NEXTCLOUD_CFAPI_EXPORT Result<void, QString> setPinState(const FileHandle &handle, PinState state, SetPinRecurseMode mode);
Result<void, QString> createPlaceholderInfo(const QString &path, time_t modtime, qint64 size, const QByteArray &fileId);
Result<void, QString> updatePlaceholderInfo(const FileHandle &handle, time_t modtime, qint64 size, const QByteArray &fileId, const QString &replacesPath = QString());
Result<void, QString> convertToPlaceholder(const FileHandle &handle, time_t modtime, qint64 size, const QByteArray &fileId, const QString &replacesPath);
Expand Down
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ if( UNIX AND NOT APPLE )
endif(UNIX AND NOT APPLE)

if (WIN32)
include_directories(
${CMAKE_BINARY_DIR}/src/libsync/vfs/cfapi
)

nextcloud_add_test(LongWinPath)
nextcloud_add_test(SyncCfApi)
elseif(LINUX) # elseif(LINUX OR APPLE)
Expand Down
1 change: 1 addition & 0 deletions test/nextcloud_add_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ macro(nextcloud_add_test test_class)
testutils
nextcloudCore
cmdCore
"${synclib_NAME}_vfs_cfapi"
Qt5::Test
Qt5::Quick
)
Expand Down

0 comments on commit ad47fd8

Please sign in to comment.