diff --git a/.github/workflows/cmake-multi-platform-build.yml b/.github/workflows/cmake-multi-platform-build.yml new file mode 100644 index 0000000..28b97fc --- /dev/null +++ b/.github/workflows/cmake-multi-platform-build.yml @@ -0,0 +1,116 @@ +name: CMake Release Builder +on: + push: + tags: + - 'v*' # This will trigger the workflow on any tag starting with 'v', like v1.0.0, v2.1, etc. + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. + fail-fast: false + + matrix: + os: [windows-2025, ubuntu-24.04, macos-15] + build_type: [Release] + c_compiler: [gcc] + + steps: + # Checkout main repository with submodules + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-tags: true + fetch-depth: 0 + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Install CQtDeployer + # The deploy target creates the distribution packages via CQtDeployer. + uses: QuasarApp/cqtdeployer-install-action@main + with: + latest: true + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.os }}-${{ matrix.type }} + + - name: Configure CMake (Windows) + if: runner.os == 'Windows' + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G Ninja + -DMRSPAWNER_TESTS=OFF + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Configure CMake (Linux) + if: runner.os == 'Linux' + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G Ninja + -DMRSPAWNER_TESTS=OFF + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Configure CMake (macOS) + if: runner.os == 'macOS' + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G Ninja + -DMRSPAWNER_TESTS=OFF + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 16 + + - name: deploy + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target deploy --parallel 1 + + - name: Create Release and Upload Assets zip + uses: svenstaro/upload-release-action@v2 + with: + tag: v${{ env.MRSPAWNER_VERSION }} + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: Distro/${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.zip + asset_name: ${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.zip + prerelease: true + overwrite: true + target_commit: ${{ github.head_ref }} + body: Mr.Spawner ${{ env.MRSPAWNER_VERSION }} + + - name: Create Release and Upload Assets Deb + if: runner.os == 'Linux' + uses: svenstaro/upload-release-action@v2 + with: + tag: v${{ env.MRSPAWNER_VERSION }} + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: Distro/${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.deb + asset_name: ${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.deb + prerelease: true + overwrite: true + target_commit: ${{ github.head_ref }} + body: Mr.Spawner ${{ env.MRSPAWNER_VERSION }} + + - name: Create Release and Upload Assets DMG (macOS) + if: runner.os == 'macOS' + uses: svenstaro/upload-release-action@v2 + with: + tag: v${{ env.MRSPAWNER_VERSION }} + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: Distro/${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.dmg + asset_name: ${{ env.MRSPAWNER_DISTRO_FULL_NAME }}.dmg + prerelease: true + overwrite: true + target_commit: ${{ github.head_ref }} + body: Mr.Spawner ${{ env.MRSPAWNER_VERSION }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..dc69e25 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,116 @@ +name: CMake PR Builder +on: + pull_request: + types: [opened, synchronize, reopened] # Triggers only on pull request events + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [windows-2025, ubuntu-24.04, macos-15] + build_type: [Release] + c_compiler: [gcc] + + steps: + - name: Install Qt (Windows) + uses: jurplel/install-qt-action@v4.3.0 + if: runner.os == 'Windows' + with: + version: '6.10.3' + target: 'desktop' + arch: 'win64_mingw' + cache: true + tools: 'tools_mingw1310' + aqtversion: ==3.2.* + + - name: Install Qt (Linux) + uses: jurplel/install-qt-action@v4.3.0 + if: runner.os == 'Linux' + with: + version: '6.10.3' + target: 'desktop' + arch: 'linux_gcc_64' + cache: true + aqtversion: ==3.2.* + + - name: Install Qt (macOS) + uses: jurplel/install-qt-action@v4.3.0 + if: runner.os == 'macOS' + with: + version: '6.10.3' + target: 'desktop' + arch: 'clang_64' + cache: true + aqtversion: ==3.2.* + + # Checkout main repository with submodules + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-tags: true + fetch-depth: 0 + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Install CQtDeployer + # The test target deploys and runs the test executables via CQtDeployer. + uses: QuasarApp/cqtdeployer-install-action@main + with: + latest: true + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.os }}-${{ matrix.type }} + + - name: Configure CMake (Windows) + if: runner.os == 'Windows' + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G Ninja + -DMRSPAWNER_TESTS=ON + -DCMAKE_PREFIX_PATH='${{ env.QT_ROOT_DIR }}' + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Configure CMake (Linux) + if: runner.os == 'Linux' + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G Ninja + -DMRSPAWNER_TESTS=ON + -DCMAKE_PREFIX_PATH='${{ env.QT_ROOT_DIR }}' + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Configure CMake (macOS) + if: runner.os == 'macOS' + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -G Ninja + -DMRSPAWNER_TESTS=ON + -DCMAKE_PREFIX_PATH='${{ env.QT_ROOT_DIR }}' + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 16 + + - name: Run unit tests + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 16 --target test + + - name: Upload unit test reports + if: always() + uses: actions/upload-artifact@v4 + with: + name: unit-test-reports-${{ matrix.os }} + path: ${{ github.workspace }}/Testing/*/test_report.txt* + if-no-files-found: ignore diff --git a/.gitignore b/.gitignore index ddc9726..0b511e6 100644 --- a/.gitignore +++ b/.gitignore @@ -69,8 +69,8 @@ _deps # Configured files build.gradle AndroidManifest.xml -src/Example/Deploy/RENAME_ME.json -src/Library/src/public/RENAME_ME/global.h +src/mrspawner/deploy/mrspawner.json +src/Core/src/public/Core/global.h doxygen.conf Distro build diff --git a/CMakeLists.txt b/CMakeLists.txt index feb2fbc..589aa3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,14 @@ # -# Copyright (C) 2020-2025 QuasarApp. +# Copyright (C) 2020-2026 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. # cmake_minimum_required(VERSION 3.19) -project(RENAME_ME LANGUAGES CXX) +project(MrSpawner LANGUAGES CXX) if(TARGET ${PROJECT_NAME}) - message("The ${PROJECT_NAME} arledy included in main Project") + message("The ${PROJECT_NAME} already included in main Project") return() endif() @@ -17,43 +17,46 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) +option(MRSPAWNER_TESTS "This option disables or enables tests of the ${PROJECT_NAME} project" ON) -find_package(Qt6 COMPONENTS Core Quick REQUIRED) -find_package(Qt6 COMPONENTS Test QUIET) +if (ANDROID OR IOS OR QA_WASM32) + set(MRSPAWNER_TESTS OFF CACHE BOOL "This option force disabled for ANDROID IOS QA_WASM32 and Not Qt projects" FORCE) +endif() -qt_standard_project_setup() -qt_policy(SET QTP0001 NEW) +# Qt is only required by the tests module. The Core, Interfaces and +# mrspawner modules work without Qt. The versionless QT package name sets +# the QT_VERSION_MAJOR variable, so the Qt${QT_VERSION_MAJOR}:: targets can +# be used in the modules. +if (MRSPAWNER_TESTS) + find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Test QUIET) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED) + + # Do not use qt_standard_project_setup() here: on Windows it sets + # CMAKE_RUNTIME_OUTPUT_DIRECTORY to the directory where the macro is + # invoked (the build root), so every executable leaves its target + # directory. The CI test targets and the deploy configuration expect + # the executables in their target directories (${CMAKE_BINARY_DIR}/tests + # and ${CMAKE_BINARY_DIR}/src/mrspawner), which is the CMake default. + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTOUIC ON) +endif() include(submodules/CMake/QuasarApp.cmake) -updateGitVarsWithHash("a2b556fd8efa14f1aed88329d8310cc53b2582f4") - -set(RENAME_ME_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}") - -set(RENAME_ME_PACKAGE_ID "quasarapp.core.RENAME_ME") - -option(RENAME_ME_TESTS "This option disables or enables tests of the ${PROJECT_NAME} project" ON) -option(RENAME_ME_EXAMPLE "This option disables or enables example app of the ${PROJECT_NAME} project" ON) +updateGitVarsWithHash("f1ede5ed149fe706e1426e2c76c8fc6172bf349c") -if (ANDROID OR IOS OR QA_WASM32) - set(RENAME_ME_TESTS OFF CACHE BOOL "This option force disbled for ANDROID IOS QA_WASM32 and Not Qt projects" FORCE) -endif() +set(MRSPAWNER_VERSION "0.${GIT_COMMIT_COUNT}.${GIT_COMMIT_HASH}") -make_directory(Distro) +set(MRSPAWNER_PACKAGE_ID "quasarapp.core.MrSpawner") initAll() -if (RENAME_ME_TESTS) - add_subdirectory(src/testcore) -endif() - -add_subdirectory(src/RENAME_ME) - -if (DEFINED RENAME_ME_EXAMPLE) - add_subdirectory(src/example) -endif() +add_subdirectory(src/Interfaces) +add_subdirectory(src/Core) +add_subdirectory(src/mrspawner) -if (RENAME_ME_TESTS) +if (MRSPAWNER_TESTS) add_subdirectory(tests) else() message("The ${PROJECT_NAME} tests is disabled.") diff --git a/README.md b/README.md index 0a44cbb..c5ffa60 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,49 @@ -# CMakeProject -Template repository for cmake project -Fork me and replase RENAME_ME to Name of your new project. +# Mr.Spawner -1. Clone this repository -2. Run ./init.sh NewProjectName +Light and fast AI agent written on modern C++. -# This template supports next build targets: +## Project structure + +| Module | Description | +|--------|-------------| +| **Core** (`src/Core`) | The main implementation of all project functions. Works without Qt. | +| **Interfaces** (`src/Interfaces`) | A super lightweight library that contains all public interfaces of the project. | +| **mrspawner** (`src/mrspawner`) | A CLI tool for running the agent. Depends on all modules except tests. | +| **tests** (`tests`) | The testing tool based on QtTest. Depends on Core and Qt. | + +## Building + +The project is builded with CMake (3.19+). Qt6 is required only for the +tests module, the `Core`, `Interfaces` and `mrspawner` modules work without Qt. + +```sh +cmake -B build -DCMAKE_PREFIX_PATH= -DCMAKE_BUILD_TYPE=Release +cmake --build build --config Release +``` + +To build without the tests module (no Qt required): + +```sh +cmake -B build -DMRSPAWNER_TESTS=OFF +cmake --build build +``` + +## Build targets | Command or make target | Description | |------|------| -| **make test** | The run tests for a project (dependet of Qt Tests, so you need to add Qt in Cmake using CMAKE_PREFIX_PATH) | -| **make doc** | The generate a documentation for a project (dependet of doxygen) | -| **make deploy** | The generate distribution for a project (dependet of CQtDeployer) | -| **make release** | The prepare Qt Installer framework repository for a project, generate a snap package and APK file for android (dependet of CQtDeployer, snapcraft, AndroidDeployer). | +| **make test** | The run tests for a project (dependent of QtTest and CQtDeployer) | +| **make doc** | The generate a documentation for a project (dependent of doxygen) | +| **make deploy** | The generate distribution for a project (dependent of CQtDeployer) | +| **make release** | The prepare the release of a project (dependent of CQtDeployer) | + +## CI + +* `pr.yml` - pull request test action for Windows, Linux and macOS. +* `cmake-multi-platform-build.yml` - release build action, creates a GitHub + release with the distribution packages on the `v*` tags. + +## License + +GPLv3 - see the [LICENSE](LICENSE) file. + diff --git a/doxygen.conf.in b/doxygen.conf.in index 5857193..65ae272 100644 --- a/doxygen.conf.in +++ b/doxygen.conf.in @@ -32,18 +32,18 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = RENAME_ME +PROJECT_NAME = MrSpawner # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = @RENAME_ME_VERSION@ +PROJECT_NUMBER = @MRSPAWNER_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = RENAME_ME is base back end library for your c++ Qt projects. +PROJECT_BRIEF = MrSpawner is base back end library for your c++ Qt projects. # With the PROJECT_LOGO tag one can specify a logo or an icon that is included @@ -1452,7 +1452,7 @@ GENERATE_ECLIPSEHELP = NO # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. -ECLIPSE_DOC_ID = QuasarApp.RENAME_ME +ECLIPSE_DOC_ID = QuasarApp.MrSpawner # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The diff --git a/init.sh b/init.sh deleted file mode 100755 index beebd67..0000000 --- a/init.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -echo "Project name: $1" - -if [ $# -ne 1 ] -then - echo "You call this script wtth wrong arguments." - echo "Example for start script:" - echo "./init.sh MyCmakeProject" - echo "Usage: $0 " - - exit 1 -fi - -replacement="$1" - -rename_files_and_folders() { - local dir="$1" - local old_str="$2" - local new_str="$3" - - for item in "$dir"/*; do - if [ -d "$item" ]; then - new_name=$(echo "$item" | sed "s/$old_str/$new_str/g") - if [ "$item" != "$new_name" ]; then - mv "$item" "$new_name" - echo "Renamed directory: $item -> $new_name" - fi - rename_files_and_folders "$new_name" "$old_str" "$new_str" - elif [ -f "$item" ]; then - sed -i "s/$old_str/$new_str/g" "$item" - - new_name=$(echo "$item" | sed "s/$old_str/$new_str/g") - if [ "$item" != "$new_name" ]; then - mv "$item" "$new_name" - echo "Renamed file: $item -> $new_name" - fi - fi - done -} - -uppercase_string=$(echo "$replacement" | tr '[:lower:]' '[:upper:]') - -rename_files_and_folders "." "RENAME_ME_EXPORT" "${uppercase_string}_EXPORT" -rename_files_and_folders "." "RENAME_ME_VERSION" "${uppercase_string}_VERSION" -rename_files_and_folders "." "RENAME_ME_LIBRARY" "${uppercase_string}_LIBRARY" -rename_files_and_folders "." "RENAME_ME_EXAMPLE" "${uppercase_string}_EXAMPLE" -rename_files_and_folders "." "RENAME_ME_TESTS" "${uppercase_string}_TESTS" -rename_files_and_folders "." "RENAME_ME_PACKAGE_ID" "${uppercase_string}_PACKAGE_ID" - -rename_files_and_folders "." "RENAME_ME" "$replacement" - -echo "Replacement complete." - - -git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | - while read path_key path - do - url_key=$(echo $path_key | sed 's/\.path/.url/') - url=$(git config -f .gitmodules --get "$url_key") - git submodule add $url $path - done diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt new file mode 100644 index 0000000..e65660a --- /dev/null +++ b/src/Core/CMakeLists.txt @@ -0,0 +1,32 @@ +# +# Copyright (C) 2020-2026 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. +# + +cmake_minimum_required(VERSION 3.19) + +# The Core module is the main implementation of all project functions. +# It must work without Qt. + +set(CURRENT_PROJECT "Core") +add_definitions(-DCORE_LIBRARY) + +file(GLOB_RECURSE SOURCE_CPP + "src/*.cpp" + "src/*.h" +) + +set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/public") +set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/private") + +add_library(${CURRENT_PROJECT} STATIC ${SOURCE_CPP}) + +# Core implements the public interfaces of the project. +target_link_libraries(${CURRENT_PROJECT} PUBLIC Interfaces) + +target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) +target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR}) + +configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/src/public/Core/global.h") \ No newline at end of file diff --git a/src/Core/src/core.cpp b/src/Core/src/core.cpp new file mode 100644 index 0000000..22e05f1 --- /dev/null +++ b/src/Core/src/core.cpp @@ -0,0 +1,20 @@ +// +// Copyright (C) 2020-2026 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 "Core/core.h" + +namespace MrSpawner { + +bool init() { + return true; +} + +std::string version() { + return CORE_VERSION; +} + +} diff --git a/src/Core/src/public/Core/core.h b/src/Core/src/public/Core/core.h new file mode 100644 index 0000000..71f35c0 --- /dev/null +++ b/src/Core/src/public/Core/core.h @@ -0,0 +1,26 @@ +// +// Copyright (C) 2020-2026 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 "Core/global.h" + +#include + +namespace MrSpawner { + +/** + * @brief init main initialize method of The Core library + * @return true if library initialized successfull + */ +CORE_EXPORT bool init(); + +/** + * @brief version This method return string value of a library version + * @return string value of a library version + */ +CORE_EXPORT std::string version(); + +}; diff --git a/src/Core/src/public/Core/global.h.in b/src/Core/src/public/Core/global.h.in new file mode 100644 index 0000000..bae9876 --- /dev/null +++ b/src/Core/src/public/Core/global.h.in @@ -0,0 +1,26 @@ +// +// Copyright (C) 2020-2026 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 CORE_GLOBAL_H +#define CORE_GLOBAL_H + +#define CORE_VERSION "@MRSPAWNER_VERSION@" + +// The Core module is builded as a static library. The export macro is empty +// for the consumers, only the library build itself uses the export +// attributes (so the module can be switched to a shared library later). +#if defined(CORE_LIBRARY) +# if defined(_WIN32) || defined(__CYGWIN__) +# define CORE_EXPORT __declspec(dllexport) +# elif defined(__GNUC__) +# define CORE_EXPORT __attribute__((visibility("default"))) +# endif +#else +# define CORE_EXPORT +#endif + +#endif // CORE_GLOBAL_H diff --git a/src/Interfaces/CMakeLists.txt b/src/Interfaces/CMakeLists.txt new file mode 100644 index 0000000..8a459b2 --- /dev/null +++ b/src/Interfaces/CMakeLists.txt @@ -0,0 +1,24 @@ +# +# Copyright (C) 2020-2026 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. +# + +cmake_minimum_required(VERSION 3.19) + +# The Interfaces module is a super lightweight library. It contains all the +# public interfaces of the project and has no dependencies (no Qt, no Core). + +set(CURRENT_PROJECT "Interfaces") + +file(GLOB_RECURSE SOURCE_CPP + "src/*.cpp" + "src/*.h" +) + +set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/public") + +add_library(${CURRENT_PROJECT} STATIC ${SOURCE_CPP}) + +target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) diff --git a/src/Interfaces/src/Interfaces.cpp b/src/Interfaces/src/Interfaces.cpp new file mode 100644 index 0000000..6cc2f7a --- /dev/null +++ b/src/Interfaces/src/Interfaces.cpp @@ -0,0 +1,9 @@ +// +// Copyright (C) 2020-2026 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. +// + +// The Interfaces module contains only the public interfaces of the project. +// This translation unit keeps the library target buildable. diff --git a/src/Interfaces/src/public/Interfaces/IAgent.h b/src/Interfaces/src/public/Interfaces/IAgent.h new file mode 100644 index 0000000..d1ff2a5 --- /dev/null +++ b/src/Interfaces/src/public/Interfaces/IAgent.h @@ -0,0 +1,25 @@ +// +// Copyright (C) 2020-2026 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 INTERFACES_IAGENT_H +#define INTERFACES_IAGENT_H + +namespace MrSpawner { + +/** + * @brief The IAgent interface is the main public interface of the AI agent. + * + * The Core module provides the implementation of this interface. + */ +class IAgent { +public: + virtual ~IAgent() = default; +}; + +} + +#endif // INTERFACES_IAGENT_H diff --git a/src/RENAME_ME/CMakeLists.txt b/src/RENAME_ME/CMakeLists.txt deleted file mode 100644 index 103afe7..0000000 --- a/src/RENAME_ME/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright (C) 2020-2025 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. -# - -cmake_minimum_required(VERSION 3.19) - -set(CURRENT_PROJECT "${PROJECT_NAME}") -add_definitions(-DRENAME_ME_LIBRARY) - -option(QT_QML_GENERATE_QMLLS_INI "Generate QML Language Server Support file" ON) - - -file(GLOB_RECURSE SOURCE_CPP - "src/*.cpp" - "src/*.h" -) - -file(GLOB_RECURSE SOURCE_QM - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "languages/*.qm" -) - -file(GLOB_RECURSE SOURCE_QML - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "src/RENAME_MEModule/*.qml" -) - -file(GLOB_RECURSE SOURCE_ASSETS - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "src/assets/*" -) - -set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/public") -set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/private") - -qt_add_library(${CURRENT_PROJECT} ${SOURCE_CPP}) - -if (RENAME_ME_TESTS) - target_link_libraries(${CURRENT_PROJECT} PUBLIC ${PROJECT_NAME}testcore ) -else() - target_link_libraries(${CURRENT_PROJECT} PUBLIC Qt${QT_VERSION_MAJOR}::Core ) -endif() - -qt_add_resources(${CURRENT_PROJECT} "languages" - PREFIX "/languages" - FILES ${SOURCE_QM}) - -qt_add_qml_module(${CURRENT_PROJECT} - URI RENAME_ME - VERSION 1.0 - QML_FILES ${SOURCE_QML} - RESOURCES ${SOURCE_ASSETS} - NO_PLUGIN -) - -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) - - -prepareQM(${CURRENT_PROJECT} ${CMAKE_CURRENT_SOURCE_DIR} "${LANGS}") - -if (NOT QML_IMPORT_PATH MATCHES "${CMAKE_CURRENT_BINARY_DIR}/..") - set(QML_IMPORT_PATH ${QML_IMPORT_PATH} "${CMAKE_CURRENT_BINARY_DIR}/.." CACHE STRING "update global variable to access to qml from qt creator." FORCE) -endif() - -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/src/public/RENAME_ME/global.h") diff --git a/src/RENAME_ME/languages/en.ts b/src/RENAME_ME/languages/en.ts deleted file mode 100644 index 6401616..0000000 --- a/src/RENAME_ME/languages/en.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/RENAME_ME/src/RENAME_MEModule/RENAME_ME.qml b/src/RENAME_ME/src/RENAME_MEModule/RENAME_ME.qml deleted file mode 100644 index 65f8718..0000000 --- a/src/RENAME_ME/src/RENAME_MEModule/RENAME_ME.qml +++ /dev/null @@ -1,12 +0,0 @@ -//# -//# Copyright (C) 2021-2025 QuasarApp. -//# Distributed under the lgplv3 software license, see the accompanying -//# Everyone is permitted to copy and distribute verbatim copies -//# of this license document, but changing it is not allowed. -//# - -import QtQuick 2.15 - -Item { - -} diff --git a/src/RENAME_ME/src/RENAME_MEModule/qmldir b/src/RENAME_ME/src/RENAME_MEModule/qmldir deleted file mode 100644 index 966edab..0000000 --- a/src/RENAME_ME/src/RENAME_MEModule/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module RENAME_MEModule -RENAME_ME 1.0 RENAME_ME.qml - diff --git a/src/RENAME_ME/src/assets/project.txt b/src/RENAME_ME/src/assets/project.txt deleted file mode 100644 index 139597f..0000000 --- a/src/RENAME_ME/src/assets/project.txt +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/RENAME_ME/src/public/RENAME_ME.cpp b/src/RENAME_ME/src/public/RENAME_ME.cpp deleted file mode 100644 index cfec0bc..0000000 --- a/src/RENAME_ME/src/public/RENAME_ME.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//# -//# Copyright (C) 2021-2025 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 "RENAME_ME.h" - - -namespace RENAME_ME { - -bool init() { - initRENAME_MEResources(); - return true; -} - -QString version() { - return RENAME_ME_VERSION; -} - - -} diff --git a/src/RENAME_ME/src/public/RENAME_ME.h b/src/RENAME_ME/src/public/RENAME_ME.h deleted file mode 100644 index ca63145..0000000 --- a/src/RENAME_ME/src/public/RENAME_ME.h +++ /dev/null @@ -1,27 +0,0 @@ -//# -//# Copyright (C) 2021-2025 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 "RENAME_ME/global.h" -#include - -inline void initRENAME_MEResources() { Q_INIT_RESOURCE(RENAME_ME); } - -namespace RENAME_ME { - -/** - * @brief init main initialize method of The RENAME_ME library - * @return true if library initialized successfull - */ -bool RENAME_ME_EXPORT init(); - -/** - * @brief version This method return string value of a library version - * @return string value of a library version - */ -QString RENAME_ME_EXPORT version(); - -}; diff --git a/src/RENAME_ME/src/public/RENAME_ME/global.h b/src/RENAME_ME/src/public/RENAME_ME/global.h deleted file mode 100644 index dc4540b..0000000 --- a/src/RENAME_ME/src/public/RENAME_ME/global.h +++ /dev/null @@ -1,22 +0,0 @@ -//# -//# Copyright (C) 2018-2025 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 RENAME_ME_GLOBAL_H -#define RENAME_ME_GLOBAL_H - -#include - -#define RENAME_ME_VERSION "0.92.18c4ec7" - -#if defined(RENAME_ME_LIBRARY) -# define RENAME_ME_EXPORT Q_DECL_EXPORT -#else -# define RENAME_ME_EXPORT Q_DECL_IMPORT -#endif - -#endif //RENAME_ME_GLOBAL_H - diff --git a/src/RENAME_ME/src/public/RENAME_ME/global.h.in b/src/RENAME_ME/src/public/RENAME_ME/global.h.in deleted file mode 100644 index d4caf4f..0000000 --- a/src/RENAME_ME/src/public/RENAME_ME/global.h.in +++ /dev/null @@ -1,22 +0,0 @@ -//# -//# Copyright (C) 2018-2025 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 RENAME_ME_GLOBAL_H -#define RENAME_ME_GLOBAL_H - -#include - -#define RENAME_ME_VERSION "@RENAME_ME_VERSION@" - -#if defined(RENAME_ME_LIBRARY) -# define RENAME_ME_EXPORT Q_DECL_EXPORT -#else -# define RENAME_ME_EXPORT Q_DECL_IMPORT -#endif - -#endif //RENAME_ME_GLOBAL_H - diff --git a/src/example/CMakeLists.txt b/src/example/CMakeLists.txt deleted file mode 100644 index cdf4e75..0000000 --- a/src/example/CMakeLists.txt +++ /dev/null @@ -1,121 +0,0 @@ -# -# Copyright (C) 2021-2025 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. -# - -cmake_minimum_required(VERSION 3.19) - -get_filename_component(CURRENT_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME) - -set(CURRENT_PROJECT "${PROJECT_NAME}_${CURRENT_PROJECT_DIR}") -option(SIGN_APP "This option enable od disabled sign apk and aab files" ON) - -file(GLOB_RECURSE SOURCE_CPP - "*.cpp" "*.h" -) - -file(GLOB_RECURSE SOURCE_QRC - "*.qrc" -) - -set(ALL_SOURCES ${SOURCE_CPP} ${SOURCE_QRC}) - -set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/private") - - -qt_add_executable(${CURRENT_PROJECT} ${ALL_SOURCES}) - -target_link_libraries(${CURRENT_PROJECT} PUBLIC ${PROJECT_NAME}) - -target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) -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} 36) - set(ANDROID_API_VERSION $ENV{ANDROID_API_VERSION}) - set(OPENSSL_ROOT_PATH "$ENV{OPENSSL_ROOT_DIR}") - - set(RENAME_ME_EXTRA_LIBS - ${PROJECT_NAME}Library -# libName - ) - - if (SIGN_APP) - message("SIGN_APP") - addDeploySignedAPK(${CURRENT_PROJECT} - "${CMAKE_CURRENT_LIST_DIR}/android" - "QuasarAppProject" - "${SIGPATH}/quasarapp.keystore" - "${SIGPASS_QUASARAPP}" - "${TARGET_DIR}" - "${RENAME_ME_EXTRA_LIBS}") - - else() - message("NO_SIGN_APP") - - addDeployAPK(${CURRENT_PROJECT} - "${CMAKE_CURRENT_LIST_DIR}/android" - "${TARGET_DIR}" - "${RENAME_ME_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 ${RENAME_ME_PACKAGE_ID} - MACOSX_BUNDLE_BUNDLE_VERSION ${RENAME_ME_VERSION} - MACOSX_BUNDLE_SHORT_VERSION_STRING ${RENAME_ME_VERSION} - ) -else() - # Desctop deploying - - message(GIT_COMMIT_COUNT = ${GIT_COMMIT_COUNT}) - configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/deploy/RENAME_ME.json") - - addDeployFromCustomFile(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/deploy/RENAME_ME.json") - -endif() - -set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/ru.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/uk.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/ja.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/tr.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/zh.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/de.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/fr.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/es.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/pl.ts) - -prepareQM(${CURRENT_PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/../ "${LANGS}") - - diff --git a/src/example/android/AndroidManifest.xml.in b/src/example/android/AndroidManifest.xml.in deleted file mode 100644 index 7f7beef..0000000 --- a/src/example/android/AndroidManifest.xml.in +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/example/android/build.gradle.in b/src/example/android/build.gradle.in deleted file mode 100644 index 82159d4..0000000 --- a/src/example/android/build.gradle.in +++ /dev/null @@ -1,78 +0,0 @@ -buildscript { - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.6.0' - } -} - -repositories { - google() - jcenter() -} - -apply plugin: 'com.android.application' - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) -} - -android { - /******************************************************* - * The following variables: - * - androidBuildToolsVersion, - * - androidCompileSdkVersion - * - qt5AndroidDir - holds the path to qt android files - * needed to build any Qt application - * on Android. - * - * are defined in gradle.properties file. This file is - * updated by QtCreator and androiddeployqt tools. - * Changing them manually might break the compilation! - *******************************************************/ - - compileSdkVersion androidCompileSdkVersion.toInteger() - - buildToolsVersion '30.0.2' - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] - aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] - res.srcDirs = [qt5AndroidDir + '/res', 'res'] - resources.srcDirs = ['resources'] - renderscript.srcDirs = ['src'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['libs'] - } - } - - tasks.withType(JavaCompile) { - options.incremental = true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - lintOptions { - abortOnError false - } - - // Do not compress Qt binary resources file - aaptOptions { - noCompress 'rcc' - } - - defaultConfig { - resConfig "en" - multiDexEnabled true - minSdkVersion = 28 - targetSdkVersion = @ANDROID_API_VERSION@ - } -} diff --git a/src/example/android/gradle.properties b/src/example/android/gradle.properties deleted file mode 100644 index 987f413..0000000 --- a/src/example/android/gradle.properties +++ /dev/null @@ -1,14 +0,0 @@ -# Project-wide Gradle settings. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m - -# Gradle caching allows reusing the build artifacts from a previous -# build with the same inputs. However, over time, the cache size will -# grow. Uncomment the following line to enable it. -#org.gradle.caching=true -android.useAndroidX=true - -android.enableJetifier=true diff --git a/src/example/android/gradle/wrapper/gradle-wrapper.jar b/src/example/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c..0000000 Binary files a/src/example/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/src/example/android/gradle/wrapper/gradle-wrapper.properties b/src/example/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 442d913..0000000 --- a/src/example/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/src/example/android/gradlew b/src/example/android/gradlew deleted file mode 100644 index 4f906e0..0000000 --- a/src/example/android/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/src/example/android/gradlew.bat b/src/example/android/gradlew.bat deleted file mode 100644 index ac1b06f..0000000 --- a/src/example/android/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/src/example/android/res/drawable/splashscreen.xml b/src/example/android/res/drawable/splashscreen.xml deleted file mode 100644 index c358344..0000000 --- a/src/example/android/res/drawable/splashscreen.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/example/android/res/drawable/splashscreen_land.xml b/src/example/android/res/drawable/splashscreen_land.xml deleted file mode 100644 index 0ec7108..0000000 --- a/src/example/android/res/drawable/splashscreen_land.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/example/android/res/drawable/splashscreen_port.xml b/src/example/android/res/drawable/splashscreen_port.xml deleted file mode 100644 index ac70dcc..0000000 --- a/src/example/android/res/drawable/splashscreen_port.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/example/android/res/values-land/splashscreentheme.xml b/src/example/android/res/values-land/splashscreentheme.xml deleted file mode 100644 index 800b923..0000000 --- a/src/example/android/res/values-land/splashscreentheme.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/src/example/android/res/values-port/splashscreentheme.xml b/src/example/android/res/values-port/splashscreentheme.xml deleted file mode 100644 index a20302e..0000000 --- a/src/example/android/res/values-port/splashscreentheme.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/src/example/android/res/values/libs.xml b/src/example/android/res/values/libs.xml deleted file mode 100644 index 6b1a4a2..0000000 --- a/src/example/android/res/values/libs.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - https://download.qt.io/ministro/android/qt5/qt-5.14 - - - - - - - - - - - - - - - - - diff --git a/src/example/android/res/values/splashscreentheme.xml b/src/example/android/res/values/splashscreentheme.xml deleted file mode 100644 index 53b3673..0000000 --- a/src/example/android/res/values/splashscreentheme.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/src/example/android/src/com/quasarapp/androidtools/MainActivity.java b/src/example/android/src/com/quasarapp/androidtools/MainActivity.java deleted file mode 100644 index 7652d22..0000000 --- a/src/example/android/src/com/quasarapp/androidtools/MainActivity.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2021-2021 QuasarApp. - * Distributed under the lgplv3 software license, see the accompanying - * Everyone is permitted to copy and distribute verbatim copies - * of this license document, but changing it is not allowed. -*/ - -package com.quasarapp.androidtools; - -import org.qtproject.qt.android.bindings.QtActivity; -import android.view.View; - -public class MainActivity extends QtActivity -{ -@Override -public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); - if (hasFocus) { - hideSystemUI(); - } -} - -private void hideSystemUI() { - // Enables regular immersive mode. - // For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE. - // Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY - View decorView = getWindow().getDecorView(); - decorView.setSystemUiVisibility( - View.SYSTEM_UI_FLAG_IMMERSIVE - // Set the content to appear under the system bars so that the - // content doesn't resize when the system bars hide and show. - | View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - // Hide the nav bar and status bar - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_FULLSCREEN); -} - -// Shows the system bars by removing all the flags -// except for the ones that make the content appear under the system bars. -private void showSystemUI() { - View decorView = getWindow().getDecorView(); - decorView.setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); -} - -} diff --git a/src/example/deploy/RENAME_ME.json b/src/example/deploy/RENAME_ME.json deleted file mode 100644 index 08633e5..0000000 --- a/src/example/deploy/RENAME_ME.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "bin": [ - "src/example/RENAME_ME_example", - "src/example/RENAME_ME_example.exe" - ], - "clear": true, - "binPrefix": "/media/D/builds/CMakeProject/build/Desktop_Qt_6_9_1-Debug", - "libDir": [ - "/media/D/builds/CMakeProject", - "/home/andrei/Qt/6.9.1/gcc_64", - "/media/D/builds/CMakeProject/build/Desktop_Qt_6_9_1-Debug" - ], - "recursiveDepth": "10", - "deploySystem": false, - "qmlDir": "../", - "deb": true, - "qif": true, - "zip": true, - "ignoreEnv": [ - "/media/D/builds/CMakeProject/Distro" - ], - "extraLib": "crypto", - "targetDir": "/media/D/builds/CMakeProject/Distro", - "deployVersion": "0.92.18c4ec7" - -} - diff --git a/src/example/deploy/RENAME_ME.json.in b/src/example/deploy/RENAME_ME.json.in deleted file mode 100644 index 4a87f45..0000000 --- a/src/example/deploy/RENAME_ME.json.in +++ /dev/null @@ -1,27 +0,0 @@ -{ - "bin": [ - "src/example/RENAME_ME_example", - "src/example/RENAME_ME_example.exe" - ], - "clear": true, - "binPrefix": "@CMAKE_BINARY_DIR@", - "libDir": [ - "@CMAKE_SOURCE_DIR@", - "@CMAKE_PREFIX_PATH@", - "@CMAKE_BINARY_DIR@" - ], - "recursiveDepth": "10", - "deploySystem": false, - "qmlDir": "../", - "deb": true, - "qif": true, - "zip": true, - "ignoreEnv": [ - "@CMAKE_SOURCE_DIR@/Distro" - ], - "extraLib": "crypto", - "targetDir": "@CMAKE_SOURCE_DIR@/Distro", - "deployVersion": "@RENAME_ME_VERSION@" - -} - diff --git a/src/example/languages/de.ts b/src/example/languages/de.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/de.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/en.ts b/src/example/languages/en.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/en.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/es.ts b/src/example/languages/es.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/es.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/fr.ts b/src/example/languages/fr.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/fr.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/ja.ts b/src/example/languages/ja.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/ja.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/pl.ts b/src/example/languages/pl.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/pl.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/ru.ts b/src/example/languages/ru.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/ru.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/tr.ts b/src/example/languages/tr.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/tr.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/uk.ts b/src/example/languages/uk.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/uk.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/languages/zh.ts b/src/example/languages/zh.ts deleted file mode 100644 index 6401616..0000000 --- a/src/example/languages/zh.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/example/main.cpp b/src/example/main.cpp deleted file mode 100644 index c53fcdc..0000000 --- a/src/example/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -//# -//# Copyright (C) 2021-2025 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. -//# - -int main(int argc, char *argv[]) { - return 0; -} diff --git a/src/mrspawner/CMakeLists.txt b/src/mrspawner/CMakeLists.txt new file mode 100644 index 0000000..0ff3eb8 --- /dev/null +++ b/src/mrspawner/CMakeLists.txt @@ -0,0 +1,44 @@ +# +# Copyright (C) 2020-2026 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. +# + +cmake_minimum_required(VERSION 3.19) + +# The mrspawner module is the CLI tool for running the agent. +# It depends on all project modules except tests. + +set(CURRENT_PROJECT "mrspawner") + +file(GLOB_RECURSE SOURCE_CPP + "*.cpp" "*.h" +) + +set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +add_executable(${CURRENT_PROJECT} ${SOURCE_CPP}) + +target_link_libraries(${CURRENT_PROJECT} PUBLIC Core Interfaces) + +target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) + +# Prepare the distribution package of the mrspawner CLI. The package names +# are exported to the GitHub Actions environment, see the +# .github/workflows/cmake-multi-platform-build.yml release action. + +SET(TARGET_DIR "${CMAKE_SOURCE_DIR}/Distro") +file(MAKE_DIRECTORY ${TARGET_DIR}) + +set(MRSPAWNER_DISTRO_NAME "mrspawner_${MRSPAWNER_VERSION}") +set(MRSPAWNER_DISTRO_FULL_NAME "${MRSPAWNER_DISTRO_NAME}_${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}") + +if(DEFINED ENV{GITHUB_ENV}) + file(APPEND $ENV{GITHUB_ENV} "MRSPAWNER_VERSION=${MRSPAWNER_VERSION}\n") + file(APPEND $ENV{GITHUB_ENV} "MRSPAWNER_DISTRO_FULL_NAME=${MRSPAWNER_DISTRO_FULL_NAME}\n") +endif() + +configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/deploy/mrspawner.json") + +addDeployFromCustomFile(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/deploy/mrspawner.json") diff --git a/src/mrspawner/deploy/mrspawner.json.in b/src/mrspawner/deploy/mrspawner.json.in new file mode 100644 index 0000000..9b0602e --- /dev/null +++ b/src/mrspawner/deploy/mrspawner.json.in @@ -0,0 +1,30 @@ +{ + "bin": [ + "src/mrspawner/mrspawner", + "src/mrspawner/mrspawner.exe" + ], + "name": "mrspawner", + "publisher": "QuasarApp group", + "clear": true, + "binPrefix": "@CMAKE_BINARY_DIR@", + "libDir": [ + "@CMAKE_SOURCE_DIR@", + "@CMAKE_PREFIX_PATH@", + "@CMAKE_BINARY_DIR@" + ], + "recursiveDepth": "10", + "deploySystem": false, + "deb": true, + "zip": true, + "dmg": true, + "qif": false, + "debOut": "@MRSPAWNER_DISTRO_FULL_NAME@.deb", + "zipOut": "@MRSPAWNER_DISTRO_FULL_NAME@.zip", + "dmgOut": "@MRSPAWNER_DISTRO_FULL_NAME@.dmg", + "ignoreEnv": [ + "@CMAKE_SOURCE_DIR@/Distro", + "@CMAKE_SOURCE_DIR@/Testing" + ], + "targetDir": "@CMAKE_SOURCE_DIR@/Distro", + "deployVersion": "@MRSPAWNER_VERSION@" +} diff --git a/src/mrspawner/main.cpp b/src/mrspawner/main.cpp new file mode 100644 index 0000000..726eae9 --- /dev/null +++ b/src/mrspawner/main.cpp @@ -0,0 +1,10 @@ +// +// Copyright (C) 2020-2026 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. +// + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/src/testcore/CMakeLists.txt b/src/testcore/CMakeLists.txt deleted file mode 100644 index a064a66..0000000 --- a/src/testcore/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (C) 2020-2025 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. -# - -cmake_minimum_required(VERSION 3.19) - -set(CURRENT_PROJECT "${PROJECT_NAME}testcore") -add_definitions(-DTEST_CORE_LIBRARY) - - -file(GLOB_RECURSE SOURCE_CPP - "*.cpp" - "*.h" -) - -file(GLOB_RECURSE SOURCE_QRC - "*.qrc" -) - -set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - -add_library(${CURRENT_PROJECT} ${SOURCE_CPP} ${SOURCE_QRC}) - -target_link_libraries(${CURRENT_PROJECT} PUBLIC Qt${QT_VERSION_MAJOR}::Core ) - -target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) -target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR}) - -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/testcore/global.h") diff --git a/src/testcore/testcore/global.h b/src/testcore/testcore/global.h deleted file mode 100644 index fa162f8..0000000 --- a/src/testcore/testcore/global.h +++ /dev/null @@ -1,20 +0,0 @@ -//# -//# Copyright (C) 2018-2025 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 TEST_CORE_GLOBAL_H -#define TEST_CORE_GLOBAL_H - -#include - -#if defined(TEST_CORE_LIBRARY) -# define TEST_CORE_EXPORT Q_DECL_EXPORT -#else -# define TEST_CORE_EXPORT Q_DECL_IMPORT -#endif - -#endif //TEST_CORE_GLOBAL_H - diff --git a/src/testcore/testcore/global.h.in b/src/testcore/testcore/global.h.in deleted file mode 100644 index fa162f8..0000000 --- a/src/testcore/testcore/global.h.in +++ /dev/null @@ -1,20 +0,0 @@ -//# -//# Copyright (C) 2018-2025 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 TEST_CORE_GLOBAL_H -#define TEST_CORE_GLOBAL_H - -#include - -#if defined(TEST_CORE_LIBRARY) -# define TEST_CORE_EXPORT Q_DECL_EXPORT -#else -# define TEST_CORE_EXPORT Q_DECL_IMPORT -#endif - -#endif //TEST_CORE_GLOBAL_H - diff --git a/src/testcore/testcore/itest.h b/src/testcore/testcore/itest.h deleted file mode 100644 index f756a08..0000000 --- a/src/testcore/testcore/itest.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef ITEST_H -#define ITEST_H - -#include "testcore/global.h" - -namespace testcore { - -class TEST_CORE_EXPORT ITest { -public: - ITest() = default; - virtual ~ITest() = default; - - virtual void test() = 0; -}; -} -#endif // ITEST_H diff --git a/src/testcore/testcore/testutils.cpp b/src/testcore/testcore/testutils.cpp deleted file mode 100644 index 691932b..0000000 --- a/src/testcore/testcore/testutils.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//# -//# Copyright (C) 2020-2025 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 "testutils.h" - -#include -#include -#include - -namespace testcore { - -bool TestUtils::funcPrivateConnect(const std::function &requestFunc, - const std::function &checkFunc, - const std::function &connectFunction) const { - - QMetaObject::Connection m_connection = connectFunction(); - if (requestFunc && !requestFunc()) { - QObject::disconnect(m_connection); - return false; - } - - bool return_value = TestUtils::wait(checkFunc, 10000); - QObject::disconnect(m_connection); - - return return_value; -} - -bool TestUtils::funcPrivateConnect(const std::function &requestFunc, - const std::function &checkFunc) const { - return funcPrivateConnect(requestFunc, checkFunc, [](){return QMetaObject::Connection();}); -} - -TestUtils::TestUtils() -{ - -} - -TestUtils::~TestUtils() { - -} - -bool TestUtils::wait(const std::function &forWait, int msec) const { - auto curmsec = QDateTime::currentMSecsSinceEpoch() + msec; - while (curmsec > QDateTime::currentMSecsSinceEpoch() && !forWait()) { - QCoreApplication::processEvents(); - } - QCoreApplication::processEvents(); - return forWait(); -} -} diff --git a/src/testcore/testcore/testutils.h b/src/testcore/testcore/testutils.h deleted file mode 100644 index aacfe1d..0000000 --- a/src/testcore/testcore/testutils.h +++ /dev/null @@ -1,35 +0,0 @@ -//# -//# Copyright (C) 2020-2025 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 TESTUTILS_H -#define TESTUTILS_H - -#include "functional" -#include -#include "testcore/global.h" - -namespace testcore { - -class TEST_CORE_EXPORT TestUtils -{ -public: - TestUtils(); - virtual ~TestUtils(); - bool wait(const std::function &forWait, int msec) const; - - - bool funcPrivateConnect(const std::function &requestFunc, - const std::function &checkFunc, - const std::function &connectFunction) const; - - bool funcPrivateConnect(const std::function &requestFunc, - const std::function &checkFunc) const; - -}; -} -#endif // TESTUTILS_H diff --git a/submodules/CMake b/submodules/CMake index 733e0ea..e4e873b 160000 --- a/submodules/CMake +++ b/submodules/CMake @@ -1 +1 @@ -Subproject commit 733e0eab52166b04c0e4e02cf0147d5d2cb2f46c +Subproject commit e4e873ba945d5cd60a1bfd610c21b0233789c58e diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cacc1c0..ae72f09 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2020-2025 QuasarApp. +# Copyright (C) 2020-2026 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. @@ -7,22 +7,40 @@ cmake_minimum_required(VERSION 3.19) -get_filename_component(CURRENT_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME) +# The tests module is the testing tool based on QtTest. +# It depends on Core and Qt. -set(CURRENT_PROJECT "${PROJECT_NAME}_${CURRENT_PROJECT_DIR}") +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED) -file(GLOB_RECURSE SOURCE_CPP - "*.cpp" "*.h" "*.qrc" -) +# The deployTest targets run cqtdeployer and create the deployment folders +# inside the common ${DIR_FOR_TESTING} directory. If that parent directory +# does not exist yet, the parallel cqtdeployer instances race on its +# creation. Create the directory in a dedicated target that every deploy +# target depends on. +add_custom_target( + prepareTestDir + COMMAND ${CMAKE_COMMAND} -E make_directory ${DIR_FOR_TESTING} + COMMENT "Create the ${DIR_FOR_TESTING} directory for the parallel test deployments") -set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -set(PUBLIC_INCUDE_DIR ${PUBLIC_INCUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/units") +# The deployTest targets of the addTestsArg helper pass the +# QT_ROOT_DIR variable to the cqtdeployer libDir option. It must contain +# the Qt installation directory, otherwise the Qt libraries of the test +# executable are classified as system libraries and are not deployed. +set(QT_ROOT_DIR "$ENV{QT_ROOT_DIR}") +message("QT_ROOT_DIR = ${QT_ROOT_DIR}") +set(TEST_CLASSES Core) -add_executable(${CURRENT_PROJECT} ${SOURCE_CPP}) -target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::Test ${PROJECT_NAME}) +foreach (TEST_CLASS ${TEST_CLASSES}) + string(TOLOWER ${TEST_CLASS} TEST_CLASS_LOWER) + set(TEST_EXEC ${PROJECT_NAME}-tests-${TEST_CLASS}) -target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) + add_executable(${TEST_EXEC} ${TEST_CLASS_LOWER}test.cpp ${TEST_CLASS_LOWER}test.h) + target_link_libraries(${TEST_EXEC} PRIVATE Qt${QT_VERSION_MAJOR}::Test Core) -initTests() -addTests(${PROJECT_NAME} ${CURRENT_PROJECT}) + # Register the test executable with the QuasarApp CI test targets. The + # test argument makes QtTest write the test_report.txt report. + addTestsArg(${TEST_CLASS} ${TEST_EXEC} "-o;test_report.txt;-txt") + + add_dependencies(deployTest${TEST_CLASS} ${TEST_EXEC} prepareTestDir) +endforeach() diff --git a/tests/coretest.cpp b/tests/coretest.cpp new file mode 100644 index 0000000..22c9681 --- /dev/null +++ b/tests/coretest.cpp @@ -0,0 +1,28 @@ +// +// Copyright (C) 2020-2026 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 "coretest.h" + +#include + +void CoreTest::initTestCase() { +} + +void CoreTest::cleanupTestCase() { +} + +void CoreTest::coreInit() { + QVERIFY(MrSpawner::init()); +} + +void CoreTest::coreVersion() { + QVERIFY(!MrSpawner::version().empty()); +} + +// Standard stand-alone QTest entry point, see the Qt test tutorial: +// https://doc.qt.io/qt-6/qttestlib-tutorial1-example.html +QTEST_GUILESS_MAIN(CoreTest) diff --git a/tests/coretest.h b/tests/coretest.h new file mode 100644 index 0000000..df49f8e --- /dev/null +++ b/tests/coretest.h @@ -0,0 +1,30 @@ +// +// Copyright (C) 2020-2026 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 CORETEST_H +#define CORETEST_H + +#include + +/** + * @brief The CoreTest class + * + * Fast unit tests of the Core module. These tests do not need any + * deployment, they only check the base skeleton of the Core library. + */ +class CoreTest : public QObject +{ + Q_OBJECT +private slots: + void initTestCase(); + void cleanupTestCase(); + + void coreInit(); + void coreVersion(); +}; + +#endif // CORETEST_H diff --git a/tests/tstMain.cpp b/tests/tstMain.cpp deleted file mode 100644 index 0ff79ce..0000000 --- a/tests/tstMain.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//# -//# Copyright (C) 2020-2025 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 -#include "exampletest.h" - -// Use This macros for initialize your own test classes. -// Check exampletests -#define TestCase(name, testClass) \ - void name() { \ - initTest(new testClass()); \ - } - -/** - * @brief The tstMain class - this is main test class - */ -class tstMain : public QObject -{ - Q_OBJECT - - -public: - tstMain(); - - ~tstMain(); - -private slots: - - - // BEGIN TESTS CASES - TestCase(exampleTest, ExampleTest) - // END TEST CASES - -private: - - /** - * @brief initTest This method prepare @a test for run in the QApplication loop. - * @param test are input test case class. - */ - void initTest(testcore::ITest* test); - - QCoreApplication *_app = nullptr; -}; - -/** - * @brief tstMain::tstMain - * init all availabel units for testsing - */ -tstMain::tstMain() { - - // init xample unit test - int argc =0; - char * argv[] = {nullptr}; - - _app = new QCoreApplication(argc, argv); - QCoreApplication::setApplicationName("testRENAME_ME"); - QCoreApplication::setOrganizationName("QuasarApp"); - - auto path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); - - QDir(path).removeRecursively(); - -} - -tstMain::~tstMain() { - _app->exit(0); - delete _app; -} - -void tstMain::initTest(testcore::ITest *test) { - QTimer::singleShot(0, this, [this, test]() { - test->test(); - delete test; - _app->exit(0); - }); - - _app->exec(); -} - -QTEST_APPLESS_MAIN(tstMain) - -#include "tstMain.moc" diff --git a/tests/units/exampletest.cpp b/tests/units/exampletest.cpp deleted file mode 100644 index 53115d3..0000000 --- a/tests/units/exampletest.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//# -//# Copyright (C) 2020-2025 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 "exampletest.h" - - -ExampleTest::ExampleTest() { - -} - -ExampleTest::~ExampleTest() { - -} - -void ExampleTest::test() { - QVERIFY(true); -} diff --git a/tests/units/exampletest.h b/tests/units/exampletest.h deleted file mode 100644 index 515e8e8..0000000 --- a/tests/units/exampletest.h +++ /dev/null @@ -1,27 +0,0 @@ -//# -//# Copyright (C) 2020-2025 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 EXAMPLE_TEST_H -#define EXAMPLE_TEST_H - -#include -#include "testcore/testutils.h" - -#include - -class ExampleTest: public testcore::ITest, protected testcore::TestUtils -{ -public: - ExampleTest(); - ~ExampleTest(); - - void test(); - -}; - -#endif // EXAMPLE_TEST_H