Skip to content

Commit

Permalink
[buteo-sync-plugins-social] Combine common code into library. Contrib…
Browse files Browse the repository at this point in the history
…utes to JB#48734

Avoid recompiling again and again, save cpu and storage.

Tests removed. They didn't nor have had any functional test cases
and were unnecessarily complicating the compilation of the main project.
Not expecting that sync plugins depending on the remote server would
have been getting tests any time soon anyway.
  • Loading branch information
pvuorela committed Jan 27, 2021
1 parent efd8bdd commit 39ec06a
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 547 deletions.
18 changes: 3 additions & 15 deletions rpm/sociald.spec
Expand Up @@ -36,6 +36,8 @@ A Buteo plugin which provides data synchronization with various social services.
#%%{_libdir}/buteo-plugins-qt5/libsociald-client.so
%config %{_sysconfdir}/buteo/profiles/client/sociald.xml
%config %{_sysconfdir}/buteo/profiles/sync/sociald.All.xml
%{_libdir}/libsyncpluginscommon.so.*
%exclude %{_libdir}/libsyncpluginscommon.so
%license COPYING

%package facebook-calendars
Expand Down Expand Up @@ -613,19 +615,6 @@ Summary: Translation source for sociald
%defattr(-,root,root,-)
%{_datadir}/translations/source/lipstick-jolla-home-twitter-notif.ts

%package tests
Summary: Automatable tests for sociald
BuildRequires: pkgconfig(Qt5Test)
Requires: qt5-qtdeclarative-devel-tools
Requires: qt5-qtdeclarative-import-qttest

%description tests
%{summary}.

%files tests
%defattr(-,root,root,-)
/opt/tests/sociald/*


%prep
%setup -q -n %{name}-%{version}
Expand All @@ -639,8 +628,7 @@ Requires: qt5-qtdeclarative-import-qttest
"CONFIG+=twitter" \
"CONFIG+=vk" \
"CONFIG+=knowncontacts" \
"CONFIG+=calendar" \
"CONFIG+=build-tests"
"CONFIG+=calendar"
make %{_smp_mflags}

%pre
Expand Down
5 changes: 0 additions & 5 deletions sociald.pro
@@ -1,9 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = src

CONFIG(build-tests) {
SUBDIRS += tests
tests.depends = src
}

OTHER_FILES += rpm/sociald.spec
70 changes: 24 additions & 46 deletions src/common.pri
Expand Up @@ -17,26 +17,11 @@ QT -= \

QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

# the unit tests need to provide a custom QNAM and uses a different database directory
HEADERS += $$PWD/common/socialdnetworkaccessmanager_p.h
!contains(DEFINES, 'SOCIALD_TEST_DEFINE') {
SOURCES += $$PWD/common/socialdnetworkaccessmanager_p.cpp
}

DEFINES += 'SYNC_DATABASE_DIR=\'\"Sync\"\''
DEFINES += 'SOCIALD_SYNC_DATABASE_NAME=\'\"sociald.db\"\''

INCLUDEPATH += . $$PWD/common/

HEADERS += \
$$PWD/common/buteosyncfw_p.h \
$$PWD/common/socialdbuteoplugin.h \
$$PWD/common/socialnetworksyncadaptor.h \
$$PWD/common/trace.h

SOURCES += \
$$PWD/common/socialdbuteoplugin.cpp \
$$PWD/common/socialnetworksyncadaptor.cpp
LIBS += -L$$PWD/common -lsyncpluginscommon

contains(DEFINES, 'SOCIALD_USE_QTPIM') {
DEFINES *= USE_CONTACTS_NAMESPACE=QTCONTACTS_USE_NAMESPACE
Expand All @@ -49,34 +34,27 @@ contains(DEFINES, 'SOCIALD_USE_QTPIM') {
HEADERS += contactmanagerengine.h
}

# don't pull in buteo plugin framework for unit test builds
!contains (DEFINES, 'SOCIALD_TEST_DEFINE') {
!contains (DEFINES, OUT_OF_PROCESS_PLUGIN) {
TEMPLATE = lib
CONFIG += plugin
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5
message("building" $$TARGET "as in-process plugin")
}
contains (DEFINES, OUT_OF_PROCESS_PLUGIN) {
TEMPLATE = app
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5/oopp
message("building" $$TARGET "as out-of-process plugin")

DEFINES += CLIENT_PLUGIN
BUTEO_OOPP_INCLUDE_DIR = $$system(pkg-config --cflags buteosyncfw5|cut -f2 -d'I')
INCLUDEPATH += $$BUTEO_OOPP_INCLUDE_DIR

HEADERS += $$BUTEO_OOPP_INCLUDE_DIR/ButeoPluginIfaceAdaptor.h \
$$BUTEO_OOPP_INCLUDE_DIR/PluginCbImpl.h \
$$BUTEO_OOPP_INCLUDE_DIR/PluginServiceObj.h

SOURCES += $$BUTEO_OOPP_INCLUDE_DIR/ButeoPluginIfaceAdaptor.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/PluginCbImpl.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/PluginServiceObj.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/plugin_main.cpp
}
!contains (DEFINES, OUT_OF_PROCESS_PLUGIN) {
TEMPLATE = lib
CONFIG += plugin
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5
message("building" $$TARGET "as in-process plugin")
}
contains (DEFINES, OUT_OF_PROCESS_PLUGIN) {
TEMPLATE = app
target.path = $$[QT_INSTALL_LIBS]/buteo-plugins-qt5/oopp
message("building" $$TARGET "as out-of-process plugin")

DEFINES += CLIENT_PLUGIN
BUTEO_OOPP_INCLUDE_DIR = $$system(pkg-config --cflags buteosyncfw5|cut -f2 -d'I')
INCLUDEPATH += $$BUTEO_OOPP_INCLUDE_DIR

HEADERS += $$BUTEO_OOPP_INCLUDE_DIR/ButeoPluginIfaceAdaptor.h \
$$BUTEO_OOPP_INCLUDE_DIR/PluginCbImpl.h \
$$BUTEO_OOPP_INCLUDE_DIR/PluginServiceObj.h

SOURCES += $$BUTEO_OOPP_INCLUDE_DIR/ButeoPluginIfaceAdaptor.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/PluginCbImpl.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/PluginServiceObj.cpp \
$$BUTEO_OOPP_INCLUDE_DIR/plugin_main.cpp
}

#NOTE: This causes issues with the unit tests ?
#MOC_DIR = $$PWD/../.moc
#OBJECTS_DIR = $$PWD/../.obj
31 changes: 31 additions & 0 deletions src/common/common.pro
@@ -0,0 +1,31 @@
TEMPLATE = lib

QT -= gui
QT += network dbus

CONFIG += link_pkgconfig
PKGCONFIG += \
accounts-qt5 \
buteosyncfw5 \

TARGET = syncpluginscommon
TARGET = $$qtLibraryTarget($$TARGET)

HEADERS += \
$$PWD/buteosyncfw_p.h \
$$PWD/socialdbuteoplugin.h \
$$PWD/socialnetworksyncadaptor.h \
$$PWD/trace.h

SOURCES += \
$$PWD/socialdbuteoplugin.cpp \
$$PWD/socialnetworksyncadaptor.cpp

HEADERS += $$PWD/socialdnetworkaccessmanager_p.h

SOURCES += socialdnetworkaccessmanager_p.cpp

TARGETPATH = $$[QT_INSTALL_LIBS]
target.path = $$TARGETPATH

INSTALLS += target
44 changes: 37 additions & 7 deletions src/src.pro
@@ -1,11 +1,41 @@
TEMPLATE = subdirs
SUBDIRS = \
common \
sociald

CONFIG(google): SUBDIRS += google
CONFIG(facebook): SUBDIRS += facebook
CONFIG(twitter): SUBDIRS += twitter
CONFIG(onedrive): SUBDIRS += onedrive
CONFIG(dropbox): SUBDIRS += dropbox
CONFIG(vk): SUBDIRS += vk
CONFIG(knowncontacts): SUBDIRS += knowncontacts
sociald.depends = common

CONFIG(google): {
SUBDIRS += google
google.depends = common
}

CONFIG(facebook): {
SUBDIRS += facebook
facebook.depends = common
}

CONFIG(twitter): {
SUBDIRS += twitter
twitter.depends = common
}

CONFIG(onedrive): {
SUBDIRS += onedrive
onedrive.depends = common
}

CONFIG(dropbox): {
SUBDIRS += dropbox
dropbox.depends = common
}

CONFIG(vk): {
SUBDIRS += vk
vk.depends = common
}

CONFIG(knowncontacts): {
SUBDIRS += knowncontacts
knowncontacts.depends = common
}
58 changes: 0 additions & 58 deletions tests/networkstubs_p.cpp

This file was deleted.

62 changes: 0 additions & 62 deletions tests/networkstubs_p.h

This file was deleted.

8 changes: 0 additions & 8 deletions tests/tests.pro

This file was deleted.

16 changes: 0 additions & 16 deletions tests/tst_common.pri

This file was deleted.

0 comments on commit 39ec06a

Please sign in to comment.