diff --git a/autotests/libs/CMakeLists.txt b/autotests/libs/CMakeLists.txt index ee10c93fa..89d83d566 100644 --- a/autotests/libs/CMakeLists.txt +++ b/autotests/libs/CMakeLists.txt @@ -1,184 +1,185 @@ set(QT_REQUIRED_VERSION "5.9.0") find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test DBus) include(ECMAddTests) if(${EXECUTABLE_OUTPUT_PATH}) set( PREVIOUS_EXEC_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH} ) else() set( PREVIOUS_EXEC_OUTPUT_PATH . ) endif() set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) set( TEST_RESULT_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/testresults ) file(MAKE_DIRECTORY ${TEST_RESULT_OUTPUT_PATH}) option(AKONADI_TESTS_XML "Use XML files for the test results, instead of plain text." FALSE) option(AKONADI_RUN_SQLITE_ISOLATED_TESTS "Run isolated tests with sqlite3 as backend" TRUE) option(AKONADI_RUN_MYSQL_ISOLATED_TESTS "Run isolated tests with MySQL as backend" TRUE) option(AKONADI_RUN_PGSQL_ISOLATED_TESTS "Run isolated tests with PostgreSQL as backend" TRUE) kde_enable_exceptions() include_directories( ${Boost_INCLUDE_DIR} ) # convenience macro to add akonadi qtestlib unit-tests macro(add_akonadi_test _source) set(_test ${_source} ${CMAKE_BINARY_DIR}/src/core/akonadicore_debug.cpp) get_filename_component(_name ${_source} NAME_WE) add_executable( ${_name} ${_test} ) add_test(NAME ${_name} COMMAND ${_name} ) ecm_mark_as_test(akonadi-${_name}) set_tests_properties(${_name} PROPERTIES ENVIRONMENT "QT_HASH_SEED=1;QT_NO_CPU_FEATURE=sse4.2") target_link_libraries(${_name} akonaditestfake Qt5::Test KF5::AkonadiPrivate KF5::DBusAddons KF5::I18n) endmacro() # convenience macro to add akonadi qtestlib unit-tests macro(add_akonadi_test_widgets _source) set(_test ${_source} ${CMAKE_BINARY_DIR}/src/widgets/akonadiwidgets_debug.cpp ${CMAKE_BINARY_DIR}/src/core/akonadicore_debug.cpp ) get_filename_component(_name ${_source} NAME_WE) add_executable( ${_name} ${_test} ) add_test(NAME ${_name} COMMAND ${_name} ) ecm_mark_as_test(akonadi-${_name}) set_tests_properties(${_name} PROPERTIES ENVIRONMENT "QT_HASH_SEED=1;QT_NO_CPU_FEATURE=sse4.2") target_link_libraries(${_name} akonaditestfake Qt5::Test KF5::AkonadiWidgets KF5::AkonadiPrivate KF5::DBusAddons) endmacro() include(../../KF5AkonadiMacros.cmake) # akonadi test fake library set(akonaditestfake_xml ${Akonadi_SOURCE_DIR}/src/interfaces/org.freedesktop.Akonadi.NotificationSource.xml) set_source_files_properties(${akonaditestfake_xml} PROPERTIES INCLUDE "protocol_p.h") qt5_add_dbus_interface( akonaditestfake_srcs ${akonaditestfake_xml} notificationsourceinterface ) add_library(akonaditestfake SHARED ${akonaditestfake_srcs} fakeakonadiservercommand.cpp fakesession.cpp fakemonitor.cpp fakeserverdata.cpp modelspy.cpp fakeentitycache.cpp inspectablemonitor.cpp inspectablechangerecorder.cpp ) generate_export_header(akonaditestfake BASE_NAME akonaditestfake) target_link_libraries(akonaditestfake Qt5::DBus KF5::AkonadiCore Qt5::Test Qt5::Widgets Qt5::Network KF5::DBusAddons KF5::AkonadiPrivate + akonadi_shared ) add_executable(akonadi-firstrun ../../src/core/firstrun.cpp firstrunner.cpp ${CMAKE_BINARY_DIR}/src/core/akonadicore_debug.cpp ) target_link_libraries( akonadi-firstrun Qt5::Test Qt5::Core KF5::AkonadiCore KF5::AkonadiPrivate KF5::DBusAddons KF5::ConfigCore Qt5::Widgets) # qtestlib unit tests add_akonadi_test(imapparsertest.cpp) # It need KIMAP add_akonadi_test(imapsettest.cpp) add_akonadi_test(itemhydratest.cpp) add_akonadi_test(itemtest.cpp) add_akonadi_test(itemserializertest.cpp) add_akonadi_test(mimetypecheckertest.cpp) add_akonadi_test(protocolhelpertest.cpp) add_akonadi_test(entitytreemodeltest.cpp) add_akonadi_test(monitornotificationtest.cpp) add_akonadi_test(collectionutilstest.cpp) add_akonadi_test(collectioncolorattributetest.cpp) add_akonadi_test(entitydisplayattributetest.cpp) add_akonadi_test(proxymodelstest.cpp) add_akonadi_test(newmailnotifierattributetest.cpp) add_akonadi_test(pop3resourceattributetest.cpp) add_akonadi_test_widgets(actionstatemanagertest.cpp) add_akonadi_test_widgets(conflictresolvedialogtest.cpp) add_akonadi_test(tagmodeltest.cpp) add_akonadi_test(statisticsproxymodeltest.cpp) add_akonadi_test(sharedvaluepooltest.cpp) add_akonadi_test(jobtest.cpp) add_akonadi_test(tagtest_simple.cpp) add_akonadi_test(cachepolicytest.cpp) # PORT FROM QJSON add_akonadi_test(searchquerytest.cpp) # qtestlib tests that need non-exported stuff from #add_executable( resourceschedulertest resourceschedulertest.cpp ../src/agentbase/resourcescheduler.cpp ) #add_test( resourceschedulertest resourceschedulertest ) #ecm_mark_as_test(akonadi-resourceschedulertest) #target_link_libraries(resourceschedulertest Qt5::Test KF5::AkonadiAgentBase) # testrunner tests add_akonadi_isolated_test(SOURCE testenvironmenttest.cpp) add_akonadi_isolated_test(SOURCE autoincrementtest.cpp) add_akonadi_isolated_test(SOURCE attributefactorytest.cpp) add_akonadi_isolated_test(SOURCE collectionpathresolvertest.cpp) add_akonadi_isolated_test(SOURCE collectionattributetest.cpp) add_akonadi_isolated_test(SOURCE itemfetchtest.cpp) add_akonadi_isolated_test(SOURCE itemappendtest.cpp) add_akonadi_isolated_test(SOURCE itemstoretest.cpp) add_akonadi_isolated_test(SOURCE itemdeletetest.cpp) add_akonadi_isolated_test(SOURCE entitycachetest.cpp) add_akonadi_isolated_test(SOURCE monitortest.cpp) #add_akonadi_isolated_test_advanced(monitorfiltertest.cpp "" "KF5::AkonadiPrivate") # FIXME: this is constantly failling due to broken search: re-enable once the new search code is merged #add_akonadi_isolated_test(SOURCE searchjobtest.cpp) add_akonadi_isolated_test(SOURCE changerecordertest.cpp) add_akonadi_isolated_test(SOURCE resourcetest.cpp) add_akonadi_isolated_test(SOURCE subscriptiontest.cpp) add_akonadi_isolated_test(SOURCE transactiontest.cpp) add_akonadi_isolated_test(SOURCE itemcopytest.cpp) add_akonadi_isolated_test(SOURCE itemmovetest.cpp) add_akonadi_isolated_test(SOURCE collectioncreatetest.cpp) add_akonadi_isolated_test(SOURCE collectioncopytest.cpp) add_akonadi_isolated_test(SOURCE collectionmovetest.cpp) add_akonadi_isolated_test( SOURCE collectionsynctest.cpp ADDITIONAL_SOURCES ${CMAKE_BINARY_DIR}/src/core/akonadicore_debug.cpp LINK_LIBRARIES KF5::I18n ) add_akonadi_isolated_test(SOURCE itemsynctest.cpp) add_akonadi_isolated_test(SOURCE linktest.cpp) add_akonadi_isolated_test(SOURCE cachetest.cpp) # FIXME: This is very unstable on Jenkins #add_akonadi_isolated_test(servermanagertest.cpp) add_akonadi_isolated_test( SOURCE tagselectwidgettest.cpp LINK_LIBRARIES KF5::AkonadiWidgets ) # Having a benchmark is cool if you have any reference to compare against, but this # benchmark takes over 40 seconds and does not have any real value to us atm. Major # performance regressions would be spotted by devs anyway, so disabling for now. #add_akonadi_isolated_test(itembenchmark.cpp) #add_akonadi_isolated_test(collectioncreator.cpp) add_akonadi_isolated_test(SOURCE gidtest.cpp) add_akonadi_isolated_test(SOURCE lazypopulationtest.cpp) add_akonadi_isolated_test(SOURCE favoriteproxytest.cpp) # FIXME: this is constantly failing due to broken search: re-enable once the new search code is merged #add_akonadi_isolated_test( # SOURCE itemsearchjobtest.cpp # ADDITIONAL_SOURCES testsearchplugin/testsearchplugin.cpp) add_akonadi_isolated_test(SOURCE tagtest.cpp ADDITIONAL_SOURCES ${CMAKE_BINARY_DIR}/src/core/akonadicore_debug.cpp) add_akonadi_isolated_test(SOURCE tagsynctest.cpp) add_akonadi_isolated_test(SOURCE relationtest.cpp) add_akonadi_isolated_test(SOURCE etmpopulationtest.cpp) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a94f67b75..325e179f3 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,353 +1,352 @@ set(akonadicore_base_SRCS agentconfigurationbase.cpp agentconfigurationfactorybase.cpp agentconfigurationmanager.cpp agentinstance.cpp agentmanager.cpp agenttype.cpp asyncselectionhandler.cpp attribute.cpp attributefactory.cpp braveheart.cpp cachepolicy.cpp changemediator_p.cpp changenotification.cpp changenotificationdependenciesfactory.cpp changerecorder.cpp changerecorder_p.cpp changerecorderjournal.cpp connection.cpp collection.cpp collectioncolorattribute.cpp collectionfetchscope.cpp collectionpathresolver.cpp collectionquotaattribute.cpp collectionquotaattribute.cpp collectionrightsattribute.cpp collectionstatistics.cpp collectionsync.cpp conflicthandler.cpp collectionidentificationattribute.cpp control.cpp entityannotationsattribute.cpp entitycache.cpp entitydeletedattribute.cpp entitydeletedattribute.cpp entitydisplayattribute.cpp entityhiddenattribute.cpp exception.cpp favoritecollectionattribute.cpp firstrun.cpp gidextractor.cpp indexpolicyattribute.cpp item.cpp itemchangelog.cpp itemfetchscope.cpp itemmonitor.cpp itemserializer.cpp itemserializerplugin.cpp itemsync.cpp mimetypechecker.cpp monitor.cpp monitor_p.cpp newmailnotifierattribute.cpp notificationsource_p.cpp notificationsubscriber.cpp partfetcher.cpp pastehelper.cpp persistentsearchattribute.cpp pluginloader.cpp pop3resourceattribute.cpp protocolhelper.cpp remotelog.cpp relation.cpp relationsync.cpp searchquery.cpp servermanager.cpp session.cpp sessionthread.cpp specialcollectionattribute.cpp specialcollections.cpp tag.cpp tagattribute.cpp tagfetchscope.cpp tagsync.cpp trashsettings.cpp typepluginloader.cpp ) ecm_generate_headers(AkonadiCore_base_HEADERS HEADER_NAMES AbstractDifferencesReporter AgentConfigurationBase AgentConfigurationFactoryBase AgentInstance AgentManager AgentType Attribute AttributeFactory CachePolicy ChangeNotification ChangeRecorder Collection CollectionColorAttribute CollectionFetchScope CollectionQuotaAttribute CollectionStatistics CollectionUtils CollectionIdentificationAttribute Control DifferencesAlgorithmInterface EntityAnnotationsAttribute EntityDeletedAttribute EntityDisplayAttribute EntityHiddenAttribute ExceptionBase FavoriteCollectionAttribute GidExtractorInterface IndexPolicyAttribute Item ItemFetchScope ItemMonitor ItemSerializerPlugin ItemSync MimeTypeChecker NewMailNotifierAttribute NotificationSubscriber Monitor PartFetcher PersistentSearchAttribute Pop3ResourceAttribute Relation SearchQuery ServerManager Session SpecialCollections SpecialCollectionAttribute Supertrait Tag TagAttribute TagFetchScope TrashSettings CollectionPathResolver - VectorHelper REQUIRED_HEADERS AkonadiCore_base_HEADERS ) set(akonadicore_models_SRCS models/agentfilterproxymodel.cpp models/agentinstancemodel.cpp models/agenttypemodel.cpp models/collectionfilterproxymodel.cpp models/collectionmodel.cpp models/collectionmodel_p.cpp models/entitymimetypefiltermodel.cpp models/entityorderproxymodel.cpp models/entityrightsfiltermodel.cpp models/entitytreemodel.cpp models/entitytreemodel_p.cpp models/favoritecollectionsmodel.cpp models/itemmodel.cpp models/quotacolorproxymodel.cpp models/recursivecollectionfilterproxymodel.cpp models/selectionproxymodel.cpp models/statisticsproxymodel.cpp models/subscriptionmodel.cpp models/tagmodel.cpp models/tagmodel_p.cpp models/trashfilterproxymodel.cpp ) ecm_generate_headers(AkonadiCore_models_HEADERS HEADER_NAMES AgentFilterProxyModel AgentInstanceModel AgentTypeModel CollectionFilterProxyModel EntityMimeTypeFilterModel EntityOrderProxyModel EntityRightsFilterModel EntityTreeModel FavoriteCollectionsModel ItemModel QuotaColorProxyModel RecursiveCollectionFilterProxyModel SelectionProxyModel StatisticsProxyModel TagModel TrashFilterProxyModel REQUIRED_HEADERS AkonadiCore_models_HEADERS RELATIVE models ) set(akonadicore_jobs_SRCS jobs/agentinstancecreatejob.cpp jobs/collectionattributessynchronizationjob.cpp jobs/collectioncopyjob.cpp jobs/collectioncreatejob.cpp jobs/collectiondeletejob.cpp jobs/collectionfetchjob.cpp jobs/collectionmodifyjob.cpp jobs/collectionmovejob.cpp jobs/collectionstatisticsjob.cpp jobs/invalidatecachejob.cpp jobs/itemcopyjob.cpp jobs/itemcreatejob.cpp jobs/itemdeletejob.cpp jobs/itemfetchjob.cpp jobs/itemmodifyjob.cpp jobs/itemmovejob.cpp jobs/itemsearchjob.cpp jobs/job.cpp jobs/kjobprivatebase.cpp jobs/linkjob.cpp jobs/recursiveitemfetchjob.cpp jobs/resourceselectjob.cpp jobs/resourcesynchronizationjob.cpp jobs/relationfetchjob.cpp jobs/relationcreatejob.cpp jobs/relationdeletejob.cpp jobs/searchcreatejob.cpp jobs/searchresultjob.cpp jobs/specialcollectionsdiscoveryjob.cpp jobs/specialcollectionshelperjobs.cpp jobs/specialcollectionsrequestjob.cpp jobs/subscriptionjob.cpp jobs/tagcreatejob.cpp jobs/tagdeletejob.cpp jobs/tagfetchjob.cpp jobs/tagmodifyjob.cpp jobs/transactionjobs.cpp jobs/transactionsequence.cpp jobs/trashjob.cpp jobs/trashrestorejob.cpp jobs/unlinkjob.cpp ) ecm_generate_headers(AkonadiCore_jobs_HEADERS HEADER_NAMES AgentInstanceCreateJob CollectionAttributesSynchronizationJob CollectionCopyJob CollectionCreateJob CollectionDeleteJob CollectionFetchJob CollectionModifyJob CollectionMoveJob CollectionStatisticsJob ItemCopyJob ItemCreateJob ItemDeleteJob ItemFetchJob ItemModifyJob ItemMoveJob ItemSearchJob Job LinkJob RecursiveItemFetchJob ResourceSynchronizationJob RelationFetchJob RelationCreateJob RelationDeleteJob SearchCreateJob SpecialCollectionsDiscoveryJob SpecialCollectionsRequestJob TagCreateJob TagDeleteJob TagFetchJob TagModifyJob TransactionJobs TransactionSequence TrashJob TrashRestoreJob UnlinkJob REQUIRED_HEADERS AkonadiCore_jobs_HEADERS RELATIVE jobs ) set(akonadicore_dbus_xml ${Akonadi_SOURCE_DIR}/src/interfaces/org.freedesktop.Akonadi.NotificationManager.xml) qt5_add_dbus_interface(akonadicore_dbus_SRCS ${akonadicore_dbus_xml} notificationmanagerinterface) set(akonadicore_dbus_xml ${Akonadi_SOURCE_DIR}/src/interfaces/org.freedesktop.Akonadi.NotificationSource.xml) set_source_files_properties(${akonadicore_dbus_xml} PROPERTIES INCLUDE "${Akonadi_SOURCE_DIR}/src/private/protocol_p.h" ) qt5_add_dbus_interface(akonadicore_dbus_SRCS ${akonadicore_dbus_xml} notificationsourceinterface) qt5_add_dbus_interfaces(akonadicore_dbus_SRCS ${Akonadi_SOURCE_DIR}/src/interfaces/org.freedesktop.Akonadi.AgentManager.xml) qt5_add_dbus_interfaces(akonadicore_dbus_SRCS ${Akonadi_SOURCE_DIR}/src/interfaces/org.freedesktop.Akonadi.Tracer.xml) qt5_add_dbus_interfaces(akonadicore_dbus_SRCS ${Akonadi_SOURCE_DIR}/src/interfaces/org.freedesktop.Akonadi.Agent.Control.xml) set(akonadicore_SRCS ${akonadicore_base_SRCS} ${akonadicore_jobs_SRCS} ${akonadicore_models_SRCS} ${akonadicore_dbus_SRCS} ) ecm_qt_declare_logging_category(akonadicore_SRCS HEADER akonadicore_debug.h IDENTIFIER AKONADICORE_LOG CATEGORY_NAME org.kde.pim.akonadicore) add_library(KF5AkonadiCore ${akonadicore_SRCS}) generate_export_header(KF5AkonadiCore BASE_NAME akonadicore) add_library(KF5::AkonadiCore ALIAS KF5AkonadiCore) target_include_directories(KF5AkonadiCore INTERFACE "$") target_include_directories(KF5AkonadiCore PUBLIC "$") target_include_directories(KF5AkonadiCore PUBLIC "$") target_include_directories(KF5AkonadiCore PUBLIC "$") kde_target_enable_exceptions(KF5AkonadiCore PUBLIC) target_link_libraries(KF5AkonadiCore PUBLIC KF5::CoreAddons # for KJob KF5::ItemModels Qt5::Gui # for QColor PRIVATE Qt5::Network Qt5::Widgets KF5::AkonadiPrivate KF5::DBusAddons KF5::I18n KF5::IconThemes KF5::ConfigCore KF5AkonadiPrivate akonadi_shared ) set_target_properties(KF5AkonadiCore PROPERTIES VERSION ${AKONADI_VERSION_STRING} SOVERSION ${AKONADI_SOVERSION} EXPORT_NAME AkonadiCore ) ecm_generate_pri_file(BASE_NAME AkonadiCore LIB_NAME KF5AkonadiCore DEPS "ItemModels CoreAddons" FILENAME_VAR PRI_FILENAME ) install(TARGETS KF5AkonadiCore EXPORT KF5AkonadiTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/akonadicore_export.h ${AkonadiCore_base_HEADERS} ${AkonadiCore_models_HEADERS} ${AkonadiCore_jobs_HEADERS} ${AkonadiCore_HEADERS} qtest_akonadi.h itempayloadinternals_p.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/AkonadiCore COMPONENT Devel ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR} ) install( FILES kcfg2dbus.xsl DESTINATION ${KDE_INSTALL_DATADIR_KF5}/akonadi ) diff --git a/src/core/vectorhelper.h b/src/core/vectorhelper.h deleted file mode 100644 index cfe53fc2b..000000000 --- a/src/core/vectorhelper.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2015-2018 Laurent Montel - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published by - the Free Software Foundation; either version 2 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 Library General Public - License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -#ifndef VECTORHELPER_H -#define VECTORHELPER_H - -#include -#include - -namespace Akonadi -{ -template class Container> -QVector valuesToVector(const Container &container) -{ - QVector values; - values.reserve(container.size()); - for (const Value &value : container) { - values << value; - } - return values; -} - -template -QSet vectorToSet(const QVector &container) -{ - QSet set; - set.reserve(container.size()); - for (const T &value : container) { - set.insert(value); - } - return set; -} - -} - -#endif // VECTORHELPER_H diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt index 536a8795d..8a173f0b7 100644 --- a/src/shared/CMakeLists.txt +++ b/src/shared/CMakeLists.txt @@ -1,15 +1,16 @@ set(akonadi_shared_srcs akapplication.cpp akdebug.cpp akremotelog.cpp ) add_library(akonadi_shared STATIC ${akonadi_shared_srcs}) target_include_directories(akonadi_shared INTERFACE $) +target_include_directories(akonadi_shared INTERFACE $) target_link_libraries(akonadi_shared Qt5::Core KF5AkonadiPrivate KF5::Crash )