mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-05-03 21:19:34 +00:00
begin to move tests classes
This commit is contained in:
parent
8d688d1c1c
commit
650fba8709
.gitignoreCMakeLists.txt
src
CQtDeployer
LibDeploy
CMakeLists.txtCQtDeployer.qrc
languages
src
DeployResources.qrc
Distributions
Templates
configures
deb.cppdeb.hdefaultdistro.cppdefaultdistro.hidistribution.cppidistribution.hqif.cppqif.htemplateinfo.cpptemplateinfo.hziparhive.cppziparhive.hScriptsTemplates
configparser.cppconfigparser.hdefines.hdependenciesscanner.cppdependenciesscanner.hdependencymap.cppdependencymap.hdeploy.cppdeploy.hdeploy_global.h.indeployconfig.cppdeployconfig.hdeploycore.cppdeploycore.hdistromodule.cppdistromodule.hdistrostruct.cppdistrostruct.helf_type.cppelf_type.henvirement.cppenvirement.hextra.cppextra.hextracter.cppextracter.hfilemanager.cppfilemanager.hgeneralfiles_type.cppgeneralfiles_type.higetlibinfo.cppigetlibinfo.hignorerule.cppignorerule.hlibinfo.cpplibinfo.hmetafilemanager.cppmetafilemanager.hpackagecontrol.cpppackagecontrol.hpacking.cpppacking.hpathutils.cpppathutils.hpe_type.cpppe_type.hpluginsparser.cpppluginsparser.hqml.cppqml.hqtdir.cppqtdir.htargetdata.cpptargetdata.htargetinfo.cpptargetinfo.hzipcompresser.cppzipcompresser.htests
1
.gitignore
vendored
1
.gitignore
vendored
@ -85,3 +85,4 @@ install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
src/LibDeploy/src/deploy_global.h
|
||||
|
@ -29,34 +29,35 @@ if (NOT QT_VERSION_MAJOR)
|
||||
endif()
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Test QUIET)
|
||||
|
||||
include(submodules/CMake/QuasarApp.cmake)
|
||||
include(submodules/QuasarAppLib/CMake/QuasarApp.cmake)
|
||||
|
||||
updateGitVars()
|
||||
set(CQtDeployer_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}")
|
||||
set(CQtDeployer_PACKAGE_ID "quasarapp.core.CQtDeployer")
|
||||
set(CQT_DEPLOYER_VERSION "1.6.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}")
|
||||
|
||||
option(CQtDeployer_TESTS "This option disables or enables tests of the ${PROJECT_NAME} project" ON)
|
||||
option(CQtDeployer_EXAMPLE "This option disables or enables example app of the ${PROJECT_NAME} project" ON)
|
||||
option(CQT_DEPLOYER_TESTS "This option disables or enables tests of the ${PROJECT_NAME} project" ON)
|
||||
option(CQT_DEPLOYER_TOOL "This option disables or enables example app of the ${PROJECT_NAME} project" ON)
|
||||
|
||||
if (ANDROID OR IOS OR NOT QT_VERSION_MAJOR OR QA_WASM32)
|
||||
set(CQtDeployer_TESTS OFF CACHE BOOL "This option force disbled for ANDROID IOS QA_WASM32 and Not Qt projects" FORCE)
|
||||
set(CQT_DEPLOYER_TESTS OFF CACHE BOOL "This option force disbled for ANDROID IOS QA_WASM32 and Not Qt projects" FORCE)
|
||||
endif()
|
||||
|
||||
if (NOT QT_VERSION_MAJOR)
|
||||
set(CQtDeployer_EXAMPLE OFF CACHE BOOL "This option force disbled for Not Qt projects" FORCE)
|
||||
set(CQT_DEPLOYER_TOOL OFF CACHE BOOL "This option force disbled for Not Qt projects" FORCE)
|
||||
endif()
|
||||
|
||||
make_directory(Distro)
|
||||
|
||||
initAll()
|
||||
|
||||
add_subdirectory(src/Library)
|
||||
add_subdirectory(submodules/QuasarAppLib)
|
||||
|
||||
if (DEFINED CQtDeployer_EXAMPLE)
|
||||
add_subdirectory(src/Example)
|
||||
add_subdirectory(src/LibDeploy)
|
||||
|
||||
if (DEFINED CQT_DEPLOYER_TOOL)
|
||||
add_subdirectory(src/CQtDeployer)
|
||||
endif()
|
||||
|
||||
if (CQtDeployer_TESTS)
|
||||
if (CQT_DEPLOYER_TESTS)
|
||||
add_subdirectory(tests)
|
||||
else()
|
||||
message("The ${PROJECT_NAME} tests is disabled.")
|
||||
|
@ -43,7 +43,7 @@ else()
|
||||
|
||||
endif()
|
||||
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC ${PROJECT_NAME}Library)
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC ${PROJECT_NAME}LibDeploy)
|
||||
|
||||
target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||
target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||
@ -51,79 +51,6 @@ target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||
SET(TARGET_DIR "${CMAKE_SOURCE_DIR}/Distro")
|
||||
file(MAKE_DIRECTORY ${TARGET_DIR})
|
||||
|
||||
if (ANDROID)
|
||||
|
||||
set(ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android CACHE INTERNAL "")
|
||||
set(ENV{ANDROID_API_VERSION} 31)
|
||||
set(ANDROID_API_VERSION $ENV{ANDROID_API_VERSION})
|
||||
set(OPENSSL_ROOT_PATH "$ENV{OPENSSL_ROOT_DIR}")
|
||||
|
||||
set(CQtDeployer_EXTRA_LIBS
|
||||
${PROJECT_NAME}Library
|
||||
# libName
|
||||
)
|
||||
|
||||
# find_package(Qt${QT_VERSION_MAJOR} COMPONENTS AndroidExtras REQUIRED)
|
||||
# target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::AndroidExtras)
|
||||
|
||||
if (SIGN_APP)
|
||||
message("SIGN_APP")
|
||||
addDeploySignedAPK(${CURRENT_PROJECT}
|
||||
"${CMAKE_CURRENT_LIST_DIR}/android"
|
||||
"QuasarAppProject"
|
||||
"${SIGPATH}/quasarapp.keystore"
|
||||
"${SIGPASS_QUASARAPP}"
|
||||
"${TARGET_DIR}"
|
||||
"${CQtDeployer_EXTRA_LIBS}")
|
||||
|
||||
else()
|
||||
message("NO_SIGN_APP")
|
||||
|
||||
addDeployAPK(${CURRENT_PROJECT}
|
||||
"${CMAKE_CURRENT_LIST_DIR}/android"
|
||||
"${TARGET_DIR}"
|
||||
"${CQtDeployer_EXTRA_LIBS}")
|
||||
|
||||
endif()
|
||||
set(manifest_file "${CMAKE_CURRENT_SOURCE_DIR}/android/AndroidManifest.xml")
|
||||
configure_file("${manifest_file}.in" ${manifest_file} @ONLY)
|
||||
|
||||
set(gradle_file "${CMAKE_CURRENT_SOURCE_DIR}/android/build.gradle")
|
||||
configure_file("${gradle_file}.in" ${gradle_file} @ONLY)
|
||||
|
||||
file(GLOB java_files
|
||||
"android/src/com/quasarapp/androidtools/*.java"
|
||||
"android/*.xml"
|
||||
"android/*.gradle"
|
||||
"android/gradlew"
|
||||
"android/gradle.*"
|
||||
|
||||
)
|
||||
|
||||
add_custom_target(${name}Android
|
||||
SOURCES ${java_files}
|
||||
)
|
||||
|
||||
elseif(IOS)
|
||||
# set_xcode_property(${CURRENT_PROJECT} PRODUCT_BUNDLE_IDENTIFIER ${CHEATCARD_PACKAGE_ID} All)
|
||||
|
||||
set_target_properties(${CURRENT_PROJECT} PROPERTIES
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER ${CQtDeployer_PACKAGE_ID}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${CQtDeployer_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${CQtDeployer_VERSION}
|
||||
)
|
||||
else()
|
||||
# Desctop deploying
|
||||
|
||||
message(GIT_COMMIT_COUNT = ${GIT_COMMIT_COUNT})
|
||||
|
||||
set(DeployFile "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployer.json")
|
||||
configure_file("${DeployFile}.in" ${DeployFile} @ONLY)
|
||||
|
||||
addDeployFromCustomFile("CQtDeployer" ${DeployFile})
|
||||
|
||||
endif()
|
||||
|
||||
if(QT_VERSION_MAJOR EQUAL 6)
|
||||
# Add This line if your project use the Quick module
|
||||
# qt_import_qml_plugins(${CURRENT_PROJECT})
|
||||
|
@ -4,11 +4,11 @@
|
||||
"src/build/Debug/CQtDeployerEaxample.exe"
|
||||
],
|
||||
"clear": true,
|
||||
"binPrefix": "/media/D/builds/build-CMakeProject-Desktop_Qt_6_1_3_GCC_64bit-Debug",
|
||||
"binPrefix": "/media/D/builds/build-CQtDeployerCmakePort-Desktop_Qt_5_15_2_GCC_64bit-Debug",
|
||||
"libDir": [
|
||||
"/media/D/builds/CMakeProject",
|
||||
"/media/D/builds/CQtDeployerCmakePort",
|
||||
"/home/andrei/Qt/5.15.2/gcc_64",
|
||||
"/media/D/builds/build-CMakeProject-Desktop_Qt_6_1_3_GCC_64bit-Debug"
|
||||
"/media/D/builds/build-CQtDeployerCmakePort-Desktop_Qt_5_15_2_GCC_64bit-Debug"
|
||||
],
|
||||
"recursiveDepth": "10",
|
||||
"deploySystem": false,
|
||||
@ -17,11 +17,11 @@
|
||||
"qif": true,
|
||||
"zip": true,
|
||||
"ignoreEnv": [
|
||||
"/media/D/builds/CMakeProject/Distro"
|
||||
"/media/D/builds/CQtDeployerCmakePort/Distro"
|
||||
],
|
||||
"extraLib": "crypto",
|
||||
"targetDir": "/media/D/builds/CMakeProject/Distro",
|
||||
"deployVersion": "0.84.1a139e7",
|
||||
"targetDir": "/media/D/builds/CQtDeployerCmakePort/Distro",
|
||||
"deployVersion": "",
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,33 +10,31 @@ cmake_minimum_required(VERSION 3.18)
|
||||
get_filename_component(CURRENT_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
|
||||
set(CURRENT_PROJECT "${PROJECT_NAME}${CURRENT_PROJECT_DIR}")
|
||||
add_definitions(-DCQtDeployer_LIBRARY)
|
||||
add_definitions(-DCQT_DEPLOYER_LIBRARY)
|
||||
|
||||
|
||||
file(GLOB_RECURSE SOURCE_CPP
|
||||
"src/*.cpp"
|
||||
"src/*.h"
|
||||
|
||||
"src/Distributions/*.cpp"
|
||||
"src/Distributions/*.h"
|
||||
|
||||
)
|
||||
|
||||
if (${QT_VERSION_MAJOR})
|
||||
file(GLOB_RECURSE SOURCE_QRC
|
||||
"*.qrc"
|
||||
)
|
||||
file(GLOB_RECURSE SOURCE_QRC
|
||||
"*.qrc"
|
||||
"src/*.qrc"
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/public")
|
||||
set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/private")
|
||||
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
|
||||
|
||||
add_library(${CURRENT_PROJECT} ${SOURCE_CPP} ${SOURCE_QRC})
|
||||
|
||||
if (${QT_VERSION_MAJOR})
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC Qt${QT_VERSION_MAJOR}::Core )
|
||||
endif()
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC QuasarApp )
|
||||
|
||||
target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||
target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||
|
||||
set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts)
|
||||
|
||||
@ -45,5 +43,5 @@ prepareQM(${CURRENT_PROJECT} ${CMAKE_CURRENT_SOURCE_DIR} "${LANGS}")
|
||||
|
||||
set(QML_IMPORT_PATH ${QML_IMPORT_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/src" CACHE STRING "" FORCE)
|
||||
|
||||
set(global_file "${CMAKE_CURRENT_SOURCE_DIR}/src/public/CQtDeployer/global.h")
|
||||
set(global_file "${CMAKE_CURRENT_SOURCE_DIR}/src/deploy_global.h")
|
||||
configure_file("${global_file}.in" ${global_file} @ONLY)
|
0
src/Deploy/src/Distributions/Templates/Icon.ico → src/LibDeploy/src/Distributions/Templates/Icon.ico
0
src/Deploy/src/Distributions/Templates/Icon.ico → src/LibDeploy/src/Distributions/Templates/Icon.ico
Before (image error) Size: 35 KiB After (image error) Size: 35 KiB |
0
src/Deploy/src/Distributions/Templates/Icon.png → src/LibDeploy/src/Distributions/Templates/Icon.png
0
src/Deploy/src/Distributions/Templates/Icon.png → src/LibDeploy/src/Distributions/Templates/Icon.png
Before ![]() (image error) Size: 108 KiB After ![]() (image error) Size: 108 KiB ![]() ![]() |
0
src/Deploy/src/Distributions/defaultdistro.cpp → src/LibDeploy/src/Distributions/defaultdistro.cpp
0
src/Deploy/src/Distributions/defaultdistro.cpp → src/LibDeploy/src/Distributions/defaultdistro.cpp
0
src/Deploy/src/Distributions/idistribution.cpp → src/LibDeploy/src/Distributions/idistribution.cpp
0
src/Deploy/src/Distributions/idistribution.cpp → src/LibDeploy/src/Distributions/idistribution.cpp
@ -7,12 +7,7 @@
|
||||
|
||||
#ifndef CQT_H
|
||||
#define CQT_H
|
||||
#include "deployconfig.h"
|
||||
#include "distrostruct.h"
|
||||
#include "envirement.h"
|
||||
#include "ignorerule.h"
|
||||
#include "targetdata.h"
|
||||
#include "targetinfo.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
@ -36,7 +31,7 @@ public:
|
||||
bool smartMoveTargets();
|
||||
|
||||
const DeployConfig* config() const;
|
||||
friend class deploytest;
|
||||
friend class DeployTargetTest;
|
||||
|
||||
private:
|
||||
|
@ -12,9 +12,10 @@
|
||||
|
||||
#define DEFAULT_COFIGURATION_FILE QString("CQtDeployer.json")
|
||||
#define DISTRO_DIR QString("DistributionKit")
|
||||
#define CQT_DEPLOYER_VERSION "@CQT_DEPLOYER_VERSION@"
|
||||
|
||||
|
||||
#if defined(DEPLOY_LIBRARY)
|
||||
#if defined(CQT_DEPLOYER_LIBRARY)
|
||||
# define DEPLOYSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define DEPLOYSHARED_EXPORT Q_DECL_IMPORT
|
@ -12,8 +12,7 @@
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include "deploy_global.h"
|
||||
#include "defines.h"
|
||||
#include "quasarapp.h"
|
||||
#include <params.h>
|
||||
|
||||
enum MSVCVersion: int {
|
||||
MSVC_Unknown = 0x0,
|
@ -18,9 +18,13 @@ file(GLOB_RECURSE SOURCE_CPP
|
||||
set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(PUBLIC_INCUDE_DIR ${PUBLIC_INCUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/units")
|
||||
|
||||
get_filename_component(QT_QT_ROOT "${Qt${QT_VERSION_MAJOR}Core_DIR}/../../.." ABSOLUTE)
|
||||
|
||||
add_definitions(-DQT_BASE_DIR="${QT_QT_ROOT}")
|
||||
add_definitions(-DTEST_BIN_DIR="${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
add_executable(${CURRENT_PROJECT} ${SOURCE_CPP})
|
||||
target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::Test ${PROJECT_NAME}Library)
|
||||
target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::Test ${PROJECT_NAME}LibDeploy)
|
||||
|
||||
target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||
|
||||
|
71
tests/units/deploytargettest.cpp
Normal file
71
tests/units/deploytargettest.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
//#
|
||||
//# Copyright (C) 2020-2022 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
|
||||
#include "deploytargettest.h"
|
||||
|
||||
#include <configparser.h>
|
||||
#include <dependenciesscanner.h>
|
||||
#include <filemanager.h>
|
||||
#include <packing.h>
|
||||
#include <pluginsparser.h>
|
||||
|
||||
|
||||
DeployTargetTest::DeployTargetTest() {
|
||||
|
||||
}
|
||||
|
||||
DeployTargetTest::~DeployTargetTest() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DeployTargetTest::test() {
|
||||
FileManager file;
|
||||
DependenciesScanner scan;
|
||||
Packing pac(&file);
|
||||
PluginsParser _pluginParser;
|
||||
|
||||
ConfigParser *deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
|
||||
|
||||
QStringList targets;
|
||||
targets << "./test/bins/execTarget.exe";
|
||||
QVERIFY(deploy->setTargets(targets));
|
||||
delete deploy;
|
||||
targets.clear();
|
||||
|
||||
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
|
||||
targets << "./test/bins/execTarget";
|
||||
QVERIFY(deploy->setTargets(targets));
|
||||
delete deploy;
|
||||
targets.clear();
|
||||
|
||||
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
|
||||
targets << "./test/bins/execTarget.exe" << "./test/bins/execTarget";
|
||||
QVERIFY(deploy->setTargets(targets));
|
||||
delete deploy;
|
||||
targets.clear();
|
||||
|
||||
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
|
||||
targets << "./test/bns/execTarget.exe";
|
||||
QVERIFY(!deploy->setTargets(targets));
|
||||
delete deploy;
|
||||
targets.clear();
|
||||
|
||||
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
|
||||
targets << "./test/bins/";
|
||||
QVERIFY(deploy->setTargets(targets));
|
||||
delete deploy;
|
||||
targets.clear();
|
||||
|
||||
deploy = new ConfigParser(&file, &_pluginParser, &scan, &pac);
|
||||
targets << "./test/bins/" << "./test/warning/";
|
||||
QVERIFY(deploy->setTargets(targets));
|
||||
|
||||
delete deploy;
|
||||
targets.clear();
|
||||
}
|
26
tests/units/deploytargettest.h
Normal file
26
tests/units/deploytargettest.h
Normal file
@ -0,0 +1,26 @@
|
||||
//#
|
||||
//# Copyright (C) 2020-2022 QuasarApp.
|
||||
//# Distributed under the GPLv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
|
||||
#ifndef DeployTarget_TEST_H
|
||||
#define DeployTarget_TEST_H
|
||||
#include "testbase.h"
|
||||
#include "testutils.h"
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
class DeployTargetTest: public TestBase, protected TestUtils
|
||||
{
|
||||
public:
|
||||
DeployTargetTest();
|
||||
~DeployTargetTest();
|
||||
|
||||
void test();
|
||||
|
||||
};
|
||||
|
||||
#endif // DeployTarget_TEST_H
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user