NOISSUE re/move some dead code and unused build system parts

This commit is contained in:
Petr Mrázek 2016-04-10 17:01:24 +02:00
parent aa4842a91d
commit 1be7d57332
28 changed files with 5 additions and 155 deletions

View File

@ -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)

3
api/dead/README.md Normal file
View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -62,7 +62,6 @@
#include <net/CacheDownload.h>
#include <news/NewsChecker.h>
#include <notifications/NotificationChecker.h>
#include <resources/Resource.h>
#include <tools/BaseProfiler.h>
#include <updater/DownloadTask.h>
#include <updater/UpdateChecker.h>

View File

@ -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<WebResourceHandler>("web");
Resource::registerHandler<IconResourceHandler>("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)

View File

@ -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)

View File

@ -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()

View File

@ -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")

View File

@ -9,7 +9,6 @@
#include <minecraft/legacy/LwjglVersionList.h>
#include <java/JavaInstallList.h>
#include <settings/INISettingsObject.h>
#include <resources/Resource.h>
#include "WonkoClient.h"
WonkoClient &WonkoClient::getInstance() {