From 1be7d573326570d63e55e36235537ed2b1831ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 10 Apr 2016 17:01:24 +0200 Subject: [PATCH] NOISSUE re/move some dead code and unused build system parts --- CMakeLists.txt | 9 --- api/dead/README.md | 3 + .../src}/AbstractCommonModel.cpp | 0 api/{logic => dead/src}/AbstractCommonModel.h | 0 api/{logic => dead/src}/BaseConfigObject.cpp | 0 api/{logic => dead/src}/BaseConfigObject.h | 0 api/{logic => dead/src}/TypeMagic.h | 0 .../src}/handlers/IconResourceHandler.cpp | 0 .../dead/src}/handlers/IconResourceHandler.h | 0 .../dead/src}/handlers/WebResourceHandler.cpp | 0 .../dead/src}/handlers/WebResourceHandler.h | 0 .../src}/resources/Resource.cpp | 0 api/{logic => dead/src}/resources/Resource.h | 0 .../src}/resources/ResourceHandler.cpp | 0 .../src}/resources/ResourceHandler.h | 0 .../src}/resources/ResourceObserver.cpp | 0 .../src}/resources/ResourceObserver.h | 0 .../src}/resources/ResourceProxyModel.cpp | 0 .../src}/resources/ResourceProxyModel.h | 0 {tests => api/dead/test}/tst_Resource.cpp | 0 api/logic/CMakeLists.txt | 15 ----- application/CMakeLists.txt | 6 -- application/MainWindow.cpp | 1 - application/MultiMC.cpp | 17 ------ cmake/Coverage.cmake | 13 ---- cmake/Coverity.cmake | 35 ----------- tests/CMakeLists.txt | 60 +------------------ wonkoclient/WonkoClient.cpp | 1 - 28 files changed, 5 insertions(+), 155 deletions(-) create mode 100644 api/dead/README.md rename api/{logic => dead/src}/AbstractCommonModel.cpp (100%) rename api/{logic => dead/src}/AbstractCommonModel.h (100%) rename api/{logic => dead/src}/BaseConfigObject.cpp (100%) rename api/{logic => dead/src}/BaseConfigObject.h (100%) rename api/{logic => dead/src}/TypeMagic.h (100%) rename {application => api/dead/src}/handlers/IconResourceHandler.cpp (100%) rename {application => api/dead/src}/handlers/IconResourceHandler.h (100%) rename {application => api/dead/src}/handlers/WebResourceHandler.cpp (100%) rename {application => api/dead/src}/handlers/WebResourceHandler.h (100%) rename api/{logic => dead/src}/resources/Resource.cpp (100%) rename api/{logic => dead/src}/resources/Resource.h (100%) rename api/{logic => dead/src}/resources/ResourceHandler.cpp (100%) rename api/{logic => dead/src}/resources/ResourceHandler.h (100%) rename api/{logic => dead/src}/resources/ResourceObserver.cpp (100%) rename api/{logic => dead/src}/resources/ResourceObserver.h (100%) rename api/{logic => dead/src}/resources/ResourceProxyModel.cpp (100%) rename api/{logic => dead/src}/resources/ResourceProxyModel.h (100%) rename {tests => api/dead/test}/tst_Resource.cpp (100%) delete mode 100644 cmake/Coverage.cmake delete mode 100644 cmake/Coverity.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a82c36957..3db0df737 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,10 +20,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) ######## Set module path ######## set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/") -# Only used for test coverage -set(MMC_SRC "${PROJECT_SOURCE_DIR}") -set(MMC_BIN "${PROJECT_BINARY_DIR}") - # Output all executables and shared libs in the main build folder, not in subfolders. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) if(UNIX) @@ -37,7 +33,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED true) set(CMAKE_C_STANDARD_REQUIRED true) set(CMAKE_CXX_STANDARD 11) set(CMAKE_C_STANDARD 11) -include(Coverage) include(GenerateExportHeader) set(CMAKE_CXX_FLAGS " -Wall -D_GLIBCXX_USE_CXX11_ABI=0 ${CMAKE_CXX_FLAGS}") if(UNIX AND APPLE) @@ -45,8 +40,6 @@ if(UNIX AND APPLE) endif() set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type") -# cmake code needed for the coverity scan upload -include(Coverity) ################################ 3rd Party Libs ################################ @@ -108,8 +101,6 @@ add_subdirectory(libraries/pack200) # java pack200 compression add_subdirectory(libraries/rainbow) # Qt extension for colors add_subdirectory(libraries/iconfix) # fork of Qt's QIcon loader -include(Coverity) - ############################### Built Artifacts ############################### add_subdirectory(tests) diff --git a/api/dead/README.md b/api/dead/README.md new file mode 100644 index 000000000..520b18d33 --- /dev/null +++ b/api/dead/README.md @@ -0,0 +1,3 @@ +This stuff is dead code I collected from the repository that still looks like it might be useful for something. + +Moved on 10. April 2016 - if it hasn't been moved or used in a while, delete this. diff --git a/api/logic/AbstractCommonModel.cpp b/api/dead/src/AbstractCommonModel.cpp similarity index 100% rename from api/logic/AbstractCommonModel.cpp rename to api/dead/src/AbstractCommonModel.cpp diff --git a/api/logic/AbstractCommonModel.h b/api/dead/src/AbstractCommonModel.h similarity index 100% rename from api/logic/AbstractCommonModel.h rename to api/dead/src/AbstractCommonModel.h diff --git a/api/logic/BaseConfigObject.cpp b/api/dead/src/BaseConfigObject.cpp similarity index 100% rename from api/logic/BaseConfigObject.cpp rename to api/dead/src/BaseConfigObject.cpp diff --git a/api/logic/BaseConfigObject.h b/api/dead/src/BaseConfigObject.h similarity index 100% rename from api/logic/BaseConfigObject.h rename to api/dead/src/BaseConfigObject.h diff --git a/api/logic/TypeMagic.h b/api/dead/src/TypeMagic.h similarity index 100% rename from api/logic/TypeMagic.h rename to api/dead/src/TypeMagic.h diff --git a/application/handlers/IconResourceHandler.cpp b/api/dead/src/handlers/IconResourceHandler.cpp similarity index 100% rename from application/handlers/IconResourceHandler.cpp rename to api/dead/src/handlers/IconResourceHandler.cpp diff --git a/application/handlers/IconResourceHandler.h b/api/dead/src/handlers/IconResourceHandler.h similarity index 100% rename from application/handlers/IconResourceHandler.h rename to api/dead/src/handlers/IconResourceHandler.h diff --git a/application/handlers/WebResourceHandler.cpp b/api/dead/src/handlers/WebResourceHandler.cpp similarity index 100% rename from application/handlers/WebResourceHandler.cpp rename to api/dead/src/handlers/WebResourceHandler.cpp diff --git a/application/handlers/WebResourceHandler.h b/api/dead/src/handlers/WebResourceHandler.h similarity index 100% rename from application/handlers/WebResourceHandler.h rename to api/dead/src/handlers/WebResourceHandler.h diff --git a/api/logic/resources/Resource.cpp b/api/dead/src/resources/Resource.cpp similarity index 100% rename from api/logic/resources/Resource.cpp rename to api/dead/src/resources/Resource.cpp diff --git a/api/logic/resources/Resource.h b/api/dead/src/resources/Resource.h similarity index 100% rename from api/logic/resources/Resource.h rename to api/dead/src/resources/Resource.h diff --git a/api/logic/resources/ResourceHandler.cpp b/api/dead/src/resources/ResourceHandler.cpp similarity index 100% rename from api/logic/resources/ResourceHandler.cpp rename to api/dead/src/resources/ResourceHandler.cpp diff --git a/api/logic/resources/ResourceHandler.h b/api/dead/src/resources/ResourceHandler.h similarity index 100% rename from api/logic/resources/ResourceHandler.h rename to api/dead/src/resources/ResourceHandler.h diff --git a/api/logic/resources/ResourceObserver.cpp b/api/dead/src/resources/ResourceObserver.cpp similarity index 100% rename from api/logic/resources/ResourceObserver.cpp rename to api/dead/src/resources/ResourceObserver.cpp diff --git a/api/logic/resources/ResourceObserver.h b/api/dead/src/resources/ResourceObserver.h similarity index 100% rename from api/logic/resources/ResourceObserver.h rename to api/dead/src/resources/ResourceObserver.h diff --git a/api/logic/resources/ResourceProxyModel.cpp b/api/dead/src/resources/ResourceProxyModel.cpp similarity index 100% rename from api/logic/resources/ResourceProxyModel.cpp rename to api/dead/src/resources/ResourceProxyModel.cpp diff --git a/api/logic/resources/ResourceProxyModel.h b/api/dead/src/resources/ResourceProxyModel.h similarity index 100% rename from api/logic/resources/ResourceProxyModel.h rename to api/dead/src/resources/ResourceProxyModel.h diff --git a/tests/tst_Resource.cpp b/api/dead/test/tst_Resource.cpp similarity index 100% rename from tests/tst_Resource.cpp rename to api/dead/test/tst_Resource.cpp diff --git a/api/logic/CMakeLists.txt b/api/logic/CMakeLists.txt index 317627d52..a7013c9de 100644 --- a/api/logic/CMakeLists.txt +++ b/api/logic/CMakeLists.txt @@ -16,11 +16,6 @@ set(LOGIC_SOURCES MMCZip.cpp MMCStrings.h MMCStrings.cpp - BaseConfigObject.h - BaseConfigObject.cpp - AbstractCommonModel.h - AbstractCommonModel.cpp - TypeMagic.h # Prefix tree where node names are strings between separators SeparatorPrefixTree.h @@ -47,16 +42,6 @@ set(LOGIC_SOURCES # a smart pointer wrapper intended for safer use with Qt signal/slot mechanisms QObjectPtr.h - # Resources - resources/Resource.cpp - resources/Resource.h - resources/ResourceHandler.cpp - resources/ResourceHandler.h - resources/ResourceObserver.cpp - resources/ResourceObserver.h - resources/ResourceProxyModel.h - resources/ResourceProxyModel.cpp - # Path matchers pathmatcher/FSTreeMatcher.h pathmatcher/IPathMatcher.h diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index f1a95a8ab..15934e3e5 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -86,12 +86,6 @@ SET(MULTIMC_SOURCES BuildConfig.h ${PROJECT_BINARY_DIR}/BuildConfig.cpp - # Resource handlers and transformers - handlers/IconResourceHandler.cpp - handlers/IconResourceHandler.h - handlers/WebResourceHandler.cpp - handlers/WebResourceHandler.h - # GUI - general utilities GuiUtil.h GuiUtil.cpp diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 97c0b02a4..1dcc59822 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -62,7 +62,6 @@ #include #include #include -#include #include #include #include diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index 24e71fa06..b157c83dc 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -45,9 +45,6 @@ #include "settings/Setting.h" #include "trans/TranslationDownloader.h" -#include "resources/Resource.h" -#include "handlers/IconResourceHandler.h" -#include "handlers/WebResourceHandler.h" #include "minecraft/ftb/FTBPlugin.h" @@ -347,19 +344,6 @@ void MultiMC::initIcons() { m_icons->directoryChanged(value.toString()); }); - - //FIXME: none of this should be here. - Resource::registerHandler("web"); - Resource::registerHandler("icon"); - - Resource::registerTransformer([](const QByteArray &data) -> QPixmap - { - return QPixmap::fromImage(QImage::fromData(data)); - }); - Resource::registerTransformer([](const QByteArray &data) -> QIcon - { - return QIcon(QPixmap::fromImage(QImage::fromData(data))); - }); } @@ -912,7 +896,6 @@ FAILED: void MultiMC::setIconTheme(const QString& name) { XdgIcon::setThemeName(name); - IconResourceHandler::setTheme(name); } QIcon MultiMC::getThemedIcon(const QString& name) diff --git a/cmake/Coverage.cmake b/cmake/Coverage.cmake deleted file mode 100644 index 28efbf1c9..000000000 --- a/cmake/Coverage.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if(__COVERAGE_CMAKE__) - return() -endif() -set(__COVERAGE_CMAKE__ TRUE) - -if(MultiMC_CODE_COVERAGE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 --coverage") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 --coverage") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O0 --coverage") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -O0 --coverage") - set(CMAKE_BUILD_TYPE "Debug") -endif(MultiMC_CODE_COVERAGE) diff --git a/cmake/Coverity.cmake b/cmake/Coverity.cmake deleted file mode 100644 index 1fcec86fa..000000000 --- a/cmake/Coverity.cmake +++ /dev/null @@ -1,35 +0,0 @@ -if(__COVERITY_CMAKE__) - return() -endif() -set(__COVERITY_CMAKE__ TRUE) - -include(GitFunctions) - -git_run(COMMAND config --get user.email DEFAULT "" OUTPUT_VAR GIT_EMAIL) -git_run(COMMAND describe DEFAULT "" OUTPUT_VAR GIT_VERSION) - -set(MultiMC_COVERITY_TOKEN "" CACHE STRING "Coverity access token") -set(MultiMC_COVERITY_EMAIL "${GIT_EMAIL}" CACHE STRING "Coverity email") - -set(MultiMC_COVERITY_TOOLS_DIR "${CMAKE_BINARY_DIR}/coverity_tools" CACHE PATH "Path to the coverity tools") - -find_program(CURL_EXECUTABLE NAMES curl PATHS /usr/bin) - -if(NOT CURL_EXECUTABLE STREQUAL "" AND NOT MultiMC_COVERITY_TOKEN STREQUAL "" AND NOT MultiMC_COVERITY_EMAIL STREQUAL "") - add_custom_target(coverity_configure - COMMAND ${MultiMC_COVERITY_TOOLS_DIR}/bin/cov-configure --comptype gcc --compiler ${CMAKE_C_COMPILER} - ) - add_custom_target(coverity_create_tarball - COMMAND ${CMAKE_COMMAND} -E echo "Cleaning..." && ${CMAKE_MAKE_PROGRAM} clean - COMMAND ${CMAKE_COMMAND} -E echo "Building..." && ${MultiMC_COVERITY_TOOLS_DIR}/bin/cov-build --dir cov-int ${CMAKE_MAKE_PROGRAM} -j3 - COMMAND ${CMAKE_COMMAND} -E echo "Creating tarball..." && ${CMAKE_COMMAND} -E tar cfz multimc_coverity.tgz cov-int/ - COMMENT "Creating coverity build..." - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - add_custom_target(coverity_upload - COMMAND ${CURL_EXECUTABLE} --form project=02JanDal/MultiMC5 --form token=${MultiMC_COVERITY_TOKEN} --form email=${MultiMC_COVERITY_EMAIL} --form file=@multimc_coverity.tgz --form version=${MultiMC_GIT_COMMIT} --form description=${GIT_VERSION} http://scan5.coverity.com/cgi-bin/upload.py - DEPENDS coverity_create_tarball - COMMENT "Uploading to coverity..." - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) -endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 409462a27..12fa41088 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,7 +20,7 @@ macro(add_unit_test name) add_test(NAME ${name} COMMAND tst_${name}) endmacro() -# Tests START # +# Tests BEGIN # add_unit_test(gradlespecifier tst_gradlespecifier.cpp) add_unit_test(userutils tst_userutils.cpp) @@ -32,7 +32,7 @@ add_unit_test(UpdateChecker tst_UpdateChecker.cpp) add_unit_test(DownloadTask tst_DownloadTask.cpp) add_unit_test(filematchers tst_filematchers.cpp) add_unit_test(ModList tst_ModList.cpp) -add_unit_test(Resource tst_Resource.cpp) +# add_unit_test(Resource tst_Resource.cpp) add_unit_test(GZip tst_GZip.cpp) add_unit_test(JavaVersion tst_JavaVersion.cpp) add_unit_test(ParseUtils tst_ParseUtils.cpp) @@ -44,62 +44,6 @@ add_unit_test(WonkoIndex tst_WonkoIndex.cpp) # Tests END # -set(COVERAGE_SOURCE_DIRS - ${MMC_SRC}/logic/* - ${MMC_SRC}/logic/auth/* - ${MMC_SRC}/logic/auth/flows/* - ${MMC_SRC}/logic/lists/* - ${MMC_SRC}/logic/net/* - ${MMC_SRC}/logic/tasks/* - ${MMC_SRC}/application/* - ${MMC_SRC}/application/dialogs/* - ${MMC_SRC}/application/widgets/* - ${MMC_SRC}/depends/settings/include/* - ${MMC_SRC}/depends/settings/src/* - ${MMC_SRC}/depends/util/include/* - ${MMC_SRC}/depends/util/src/* -) - -if(MultiMC_CODE_COVERAGE) - unset(MultiMC_RUN_TESTS) - unset(MultiMC_TEST_COVERAGE_FILES) - - foreach(test ${MultiMC_TESTS}) - add_custom_target(MultiMC_RUN_TEST_${test} - COMMAND lcov -d ${CMAKE_CURRENT_BINARY_DIR} -z -q # clean test - && lcov -d ${MMC_BIN} -z -q # clean common - && lcov -d ${MMC_BIN}/depends/settings/CMakeFiles/libSettings.dir -z -q # clean settings - && lcov -d ${MMC_BIN}/depends/utils/CMakeFiles/libUtil.dir -z -q # clean utils - && ${MMC_BIN}/${test} -o coverage_${test}.out,xml # run test - && lcov -q --checksum -b ${MMC_SRC} -d ${CMAKE_CURRENT_BINARY_DIR} -c -o coverage_${test}.info # generate for test - && lcov -q --checksum -b ${MMC_SRC} -d ${MMC_BIN} -c -o coverage_common.info # generate for common - && lcov -q --checksum -b ${MMC_SRC} -d ${MMC_BIN}/depends/settings/CMakeFiles/libSettings.dir -c -o coverage_settings.info # generate for settings - && lcov -q --checksum -b ${MMC_SRC} -d ${MMC_BIN}/depends/util/CMakeFiles/libUtil.dir -c -o coverage_utils.info # generate for utils - && lcov -q --checksum -b ${MMC_SRC} -d . - -a coverage_${test}.info -a coverage_common.info -a coverage_settings.info -a coverage_utils.info - -o coverage_${test}-combined.info # combine test and common - && lcov -q --checksum -b ${MMC_SRC} --list-full-path --extract coverage_${test}-combined.info ${COVERAGE_SOURCE_DIRS} -o coverage_${test}-stripped.info # strip - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - VERBATIM - DEPENDS ${test} - COMMENT "Running ${test}..." - ) - list(APPEND MultiMC_TEST_COVERAGE_FILES coverage_${test}-stripped.info) - list(APPEND MultiMC_RUN_TESTS MultiMC_RUN_TEST_${test}) - endforeach(test) - - add_custom_target(MultiMC_GENERATE_COVERAGE - DEPENDS ${MultiMC_RUN_TESTS} - COMMENT "Generating coverage files..." - ) - add_custom_target(MultiMC_GENERATE_COVERAGE_HTML - COMMAND genhtml -t "MultiMC 5 Test Coverage" --num-spaces 4 --demangle-cpp --legend -o ${MMC_SRC}/html/coverage ${MultiMC_TEST_COVERAGE_FILES} - DEPENDS MultiMC_GENERATE_COVERAGE - COMMENT "Generating test coverage html..." - ) - add_custom_target(MultiMC_RUN_TESTS DEPENDS MultiMC_GENERATE_COVERAGE_HTML) -endif(MultiMC_CODE_COVERAGE) - set(MultiMC_TEST_DATA_PATH "${CMAKE_CURRENT_BINARY_DIR}/data") set(MultiMC_TEST_DATA_PATH_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/data") diff --git a/wonkoclient/WonkoClient.cpp b/wonkoclient/WonkoClient.cpp index ca22d4071..dd0dfae57 100644 --- a/wonkoclient/WonkoClient.cpp +++ b/wonkoclient/WonkoClient.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include "WonkoClient.h" WonkoClient &WonkoClient::getInstance() {