diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f869712 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.cpp text eol=crlf +*.h text eol=crlf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a1435cc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: Build BSA Packer + +on: + push: + branches: [master] + pull_request: + types: [opened, synchronize, reopened] + +env: + VCPKG_BINARY_SOURCES: clear;x-azblob,${{ vars.AZ_BLOB_VCPKG_URL }},${{ secrets.AZ_BLOB_SAS }},readwrite + +jobs: + build: + runs-on: windows-2022 + steps: + - name: Build BSA Packer + id: build-bsa-packer + uses: ModOrganizer2/build-with-mob-action@master + with: + mo2-dependencies: uibase diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7bd1380 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-merge-conflict + - id: check-case-conflict + # - repo: https://github.com/pre-commit/mirrors-clang-format + # rev: v19.1.5 + # hooks: + # - id: clang-format + # 'types_or': [c++, c] + +ci: + autofix_commit_msg: "[pre-commit.ci] Auto fixes from pre-commit.com hooks." + autofix_prs: true + autoupdate_commit_msg: "[pre-commit.ci] Pre-commit autoupdate." + autoupdate_schedule: quarterly + submodules: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b02109..48f6a1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,16 +1,13 @@ cmake_minimum_required(VERSION 3.16) -if(DEFINED DEPENDENCIES_DIR) - include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake) -else() - include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake) -endif() +set(MO2_CMAKE_DEPRECATED_UIBASE_INCLUDE ON) project(bsa_packer) + add_subdirectory(src) -set(BSAPACKER_TESTS ${BSAPACKER_TESTS} CACHE BOOL "build tests for bsapacker plugin") -if(BSAPACKER_TESTS) +set(BUILD_TESTING ${BUILD_TESTING} CACHE BOOL "build tests for bsapacker plugin") +if(BUILD_TESTING) enable_testing() add_subdirectory(tests) endif() diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..0c06d1a --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,63 @@ +{ + "configurePresets": [ + { + "errors": { + "deprecated": true + }, + "hidden": true, + "name": "cmake-dev", + "warnings": { + "deprecated": true, + "dev": true + } + }, + { + "cacheVariables": { + "VCPKG_MANIFEST_NO_DEFAULT_FEATURES": { + "type": "BOOL", + "value": "ON" + } + }, + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "hidden": true, + "name": "vcpkg" + }, + { + "cacheVariables": { + "VCPKG_MANIFEST_FEATURES": { + "type": "STRING", + "value": "testing" + } + }, + "hidden": true, + "inherits": ["vcpkg"], + "name": "vcpkg-dev" + }, + { + "binaryDir": "${sourceDir}/vsbuild", + "architecture": { + "strategy": "set", + "value": "x64" + }, + "cacheVariables": { + "CMAKE_CXX_FLAGS": "/EHsc /MP /W4", + "VCPKG_TARGET_TRIPLET": { + "type": "STRING", + "value": "x64-windows-static-md" + } + }, + "generator": "Visual Studio 17 2022", + "inherits": ["cmake-dev", "vcpkg-dev"], + "name": "vs2022-windows", + "toolset": "v143" + } + ], + "buildPresets": [ + { + "name": "vs2022-windows", + "resolvePackageReferences": "on", + "configurePreset": "vs2022-windows" + } + ], + "version": 4 +} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2eaf315..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,41 +0,0 @@ -version: 1.0.{build} -skip_branch_with_pr: true -image: Visual Studio 2019 -environment: - WEBHOOK_URL: - secure: gOKbXaZM9ImtMD5XrYITvdyZUW/az082G9OIN1EC1Vbg57wBaeLhi49uGjxPw5GVujHku6kxN6ab89zhbS5GVeluR76GM83IbKV4Sh7udXzoYZZdg6YudtYHzdhCgUeiedpswbuczTq9ceIkkfSEWZuh/lMAAVVwvcGsJAnoPFw= -build_script: -- pwsh: >- - $ErrorActionPreference = 'Stop' - - git clone --depth=1 --no-single-branch https://github.com/ModOrganizer2/modorganizer-umbrella.git c:\projects\modorganizer-umbrella - - New-Item -ItemType Directory -Path c:\projects\modorganizer-build - - cd c:\projects\modorganizer-umbrella - - ($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH -eq $null) ? ($branch = $env:APPVEYOR_REPO_BRANCH) : ($branch = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH) - - git checkout $(git show-ref --verify --quiet refs/remotes/origin/${branch} || echo '-b') ${branch} - - C:\Python37-x64\python.exe unimake.py -d c:\projects\modorganizer-build -s Appveyor_Build=True ${env:APPVEYOR_PROJECT_NAME} - - if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode ) } -artifacts: -- path: vsbuild\src\RelWithDebInfo\bsa_packer.dll - name: bsa_packer_dll -- path: vsbuild\src\RelWithDebInfo\bsa_packer.pdb - name: bsa_packer_pdb -- path: vsbuild\src\RelWithDebInfo\bsa_packer.lib - name: bsa_packer_lib -- path: build\tests\bsa_packer_tests.exe -on_success: - - ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER - - ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1 - - ps: ./send.ps1 success $env:WEBHOOK_URL -on_failure: - - ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER - - ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stdout.log - - ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stderr.log - - ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1 - - ps: ./send.ps1 failure $env:WEBHOOK_URL diff --git a/src/ArchiveAutoService.cpp b/src/ArchiveAutoService.cpp index 37ec93f..3b325af 100644 --- a/src/ArchiveAutoService.cpp +++ b/src/ArchiveAutoService.cpp @@ -5,7 +5,7 @@ namespace BsaPacker { - bool ArchiveAutoService::CreateBSA(libbsarch::bs_archive_auto* archive, const QString& archiveName, const bsa_archive_type_e type) const + bool ArchiveAutoService::CreateBSA(libbsarch::bs_archive_auto* archive, const QString& archiveName, const bsa_archive_type_e) const { QProgressDialog savingDialog; savingDialog.setWindowFlags(savingDialog.windowFlags() & ~Qt::WindowCloseButtonHint); diff --git a/src/ArchiveBuilderHelper.cpp b/src/ArchiveBuilderHelper.cpp index 2c19e34..c5c956b 100644 --- a/src/ArchiveBuilderHelper.cpp +++ b/src/ArchiveBuilderHelper.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include "SettingsService.h" @@ -61,13 +61,13 @@ namespace BsaPacker bool ArchiveBuilderHelper::isExtensionBlacklisted(const path& filepath) const { const auto& setting = this->m_SettingsService->GetPluginSetting(SettingsService::SETTING_BLACKLISTED_FILES).toString().toStdString(); - std::set blacklist; - boost::split(blacklist, setting, [](char c){return c == ';';}); - - const auto& extension = filepath.extension().string(); - const auto& count = blacklist.count(extension); - const auto& result = count > 0; - return result; + const auto &extension = filepath.extension().string(); + const auto count = std::ranges::count( + setting | std::views::split(' '), + extension, + [](auto r) + { return std::string_view(r.data(), r.size()); }); + return count > 0; } bool ArchiveBuilderHelper::doesPathContainFiles(const path& filepath, const std::vector& files) const diff --git a/src/ArchiveNameService.cpp b/src/ArchiveNameService.cpp index d3f718d..9cea91b 100644 --- a/src/ArchiveNameService.cpp +++ b/src/ArchiveNameService.cpp @@ -72,4 +72,4 @@ namespace BsaPacker } return QString(); } -} \ No newline at end of file +} diff --git a/src/BSArchiveEntries.cpp b/src/BSArchiveEntries.cpp index 6a3045d..64ef838 100644 --- a/src/BSArchiveEntries.cpp +++ b/src/BSArchiveEntries.cpp @@ -63,4 +63,3 @@ bsa_entry_list_t BSArchiveEntries::getEntries() const { return _entries; } - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 59ffc74..a705720 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,25 @@ cmake_minimum_required(VERSION 3.16) +find_package(Qt6 COMPONENTS Concurrent) +find_path(BEXT_DI_INCLUDE_DIRS "boost/di.hpp") +find_package(mo2-cmake CONFIG REQUIRED) +find_package(mo2-uibase CONFIG REQUIRED) +find_package(mo2-libbsarch CONFIG REQUIRED) +find_package(mo2-dds-header CONFIG REQUIRED) +find_package(DirectXTex CONFIG REQUIRED) + add_library(bsa_packer SHARED) -mo2_configure_plugin(bsa_packer WARNINGS OFF - PRIVATE_DEPENDS boost Qt::Concurrent libbsarch) +mo2_configure_plugin(bsa_packer WARNINGS OFF) -target_include_directories(bsa_packer - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${BOOST_DI_ROOT}/include) +target_link_libraries(bsa_packer PUBLIC mo2::uibase Qt6::Concurrent mo2::libbsarch Microsoft::DirectXTex) +target_include_directories(bsa_packer PUBLIC ${BEXT_DI_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) target_compile_definitions(bsa_packer PRIVATE BSAPACKER_LIBRARY) -mo2_install_target(bsa_packer) +# need to deploy this here as MO2 does not depends on Qt6::Concurrent +install(FILES $ DESTINATION bin/dlls) + +# this is done by modorganizer itself now +# +# install(FILES $ DESTINATION bin/dlls) + +mo2_install_plugin(bsa_packer) diff --git a/src/DummyPluginServiceFactory.cpp b/src/DummyPluginServiceFactory.cpp index 8789bd6..fcd0705 100644 --- a/src/DummyPluginServiceFactory.cpp +++ b/src/DummyPluginServiceFactory.cpp @@ -52,4 +52,3 @@ namespace BsaPacker return std::make_unique(); } } // namespace BsaPacker - diff --git a/src/ModContext.cpp b/src/ModContext.cpp index d65656b..896df9b 100644 --- a/src/ModContext.cpp +++ b/src/ModContext.cpp @@ -37,7 +37,7 @@ namespace BsaPacker if (primarySource == "FalloutNV") { // TTW return NexusId::NewVegas; } - } + } return nexusId; } diff --git a/src/NewVegasDummyPluginService.cpp b/src/NewVegasDummyPluginService.cpp index 68fcd1b..d48f4b3 100644 --- a/src/NewVegasDummyPluginService.cpp +++ b/src/NewVegasDummyPluginService.cpp @@ -26,4 +26,3 @@ namespace BsaPacker sizeof(NewVegasDummyPluginService::RAW_NEWVEGAS)); } } - diff --git a/src/NullDummyPluginService.cpp b/src/NullDummyPluginService.cpp index 55382a1..52d8609 100644 --- a/src/NullDummyPluginService.cpp +++ b/src/NullDummyPluginService.cpp @@ -2,7 +2,7 @@ namespace BsaPacker { - bool NullDummyPluginService::CreatePlugin(const QString& modPath, const QString& archiveNameBase) const + bool NullDummyPluginService::CreatePlugin([[maybe_unused]] const QString& modPath, [[maybe_unused]] const QString& archiveNameBase) const { return false; } diff --git a/src/OblivionDummyPluginService.cpp b/src/OblivionDummyPluginService.cpp index 7addcb6..2f771f3 100644 --- a/src/OblivionDummyPluginService.cpp +++ b/src/OblivionDummyPluginService.cpp @@ -24,4 +24,3 @@ namespace BsaPacker sizeof(OblivionDummyPluginService::RAW_OBLIVION)); } } - diff --git a/src/OverrideFileService.cpp b/src/OverrideFileService.cpp index adf858d..3e4ebec 100644 --- a/src/OverrideFileService.cpp +++ b/src/OverrideFileService.cpp @@ -38,7 +38,7 @@ namespace BsaPacker { res = false; } } - + return res; } -} // namespace BsaPacker \ No newline at end of file +} // namespace BsaPacker diff --git a/src/OverrideFileService.h b/src/OverrideFileService.h index 6db30b1..ffcad17 100644 --- a/src/OverrideFileService.h +++ b/src/OverrideFileService.h @@ -18,4 +18,4 @@ namespace BsaPacker { }; } // namespace BsaPacker -#endif // OVERRIDEFILESERVICE_H \ No newline at end of file +#endif // OVERRIDEFILESERVICE_H diff --git a/src/TextureArchiveBuilder.cpp b/src/TextureArchiveBuilder.cpp index 4869653..a277248 100644 --- a/src/TextureArchiveBuilder.cpp +++ b/src/TextureArchiveBuilder.cpp @@ -97,7 +97,7 @@ namespace BsaPacker this->m_Cancelled = true; } - void TextureArchiveBuilder::DDSCallback(bsa_archive_t archive, const wchar_t* file_path, bsa_dds_info_t* dds_info, void* context) + void TextureArchiveBuilder::DDSCallback(bsa_archive_t, const wchar_t* file_path, bsa_dds_info_t* dds_info, void* context) { const auto& path = *static_cast(context) + L'/' + std::wstring(file_path); diff --git a/src/bsa_packer.json b/src/bsa_packer.json index 9e26dfe..0967ef4 100644 --- a/src/bsa_packer.json +++ b/src/bsa_packer.json @@ -1 +1 @@ -{} \ No newline at end of file +{} diff --git a/src/bsa_packer_en.ts b/src/bsa_packer_en.ts index cbed7d1..138987e 100644 --- a/src/bsa_packer_en.ts +++ b/src/bsa_packer_en.ts @@ -59,12 +59,13 @@ - Specify a semi-colon seperated list of file extensions to ignore when packing. + Specify a semi-colon separated list of file extensions to ignore when packing. + Specify a semi-colon seperated list of file extensions to ignore when packing. - Compress archives if they do not contain incompressible files. + Compress archives if they do not contain incompressible files. Texture archives for Fallout 4 and Starfield will always be compressed. Morrowind archives will never be compressed. diff --git a/src/bsapacker/ArchiveBuilderFactory.h b/src/bsapacker/ArchiveBuilderFactory.h index 7828be3..98ce8e1 100644 --- a/src/bsapacker/ArchiveBuilderFactory.h +++ b/src/bsapacker/ArchiveBuilderFactory.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include namespace BsaPacker { diff --git a/src/bsapacker/IArchiveAutoService.h b/src/bsapacker/IArchiveAutoService.h index bd3037b..4724741 100644 --- a/src/bsapacker/IArchiveAutoService.h +++ b/src/bsapacker/IArchiveAutoService.h @@ -1,7 +1,7 @@ #ifndef IARCHIVEAUTOSERVICE_H #define IARCHIVEAUTOSERVICE_H -#include +#include #include namespace BsaPacker diff --git a/src/bsapacker/IArchiveBuilder.h b/src/bsapacker/IArchiveBuilder.h index 11decb9..6c6ca4d 100644 --- a/src/bsapacker/IArchiveBuilder.h +++ b/src/bsapacker/IArchiveBuilder.h @@ -2,7 +2,7 @@ #define IARCHIVEBUILDER_H #include -#include +#include namespace BsaPacker { diff --git a/src/bsapacker/IOverrideFileService.h b/src/bsapacker/IOverrideFileService.h index dc33018..6e87c48 100644 --- a/src/bsapacker/IOverrideFileService.h +++ b/src/bsapacker/IOverrideFileService.h @@ -13,4 +13,4 @@ namespace BsaPacker { }; } // namespace BsaPacker -#endif // IOVERRIDEFILESERVICE_H \ No newline at end of file +#endif // IOVERRIDEFILESERVICE_H diff --git a/src/bsapacker_global.h b/src/bsapacker_global.h index 3a5de26..2ad3dc3 100644 --- a/src/bsapacker_global.h +++ b/src/bsapacker_global.h @@ -4,4 +4,4 @@ # define BSAPACKER_EXPORT Q_DECL_EXPORT #else # define BSAPACKER_EXPORT Q_DECL_IMPORT -#endif \ No newline at end of file +#endif diff --git a/src/qlibbsarch/BSArchiveAuto.h b/src/qlibbsarch/BSArchiveAuto.h index d4c3ee5..d632fa4 100644 --- a/src/qlibbsarch/BSArchiveAuto.h +++ b/src/qlibbsarch/BSArchiveAuto.h @@ -5,7 +5,7 @@ #include /*! - * \brief A convenience class for BSArchive and BSArchiveEntries. Its performance is worse than using these + * \brief A convenience class for BSArchive and BSArchiveEntries. Its performance is worse than using these * two classes separately, but it removes the need to manually handle the BSArchiveEntries. */ class BSArchiveAuto diff --git a/src/qlibbsarch/QLibbsarch.h b/src/qlibbsarch/QLibbsarch.h index d882010..7af53f4 100644 --- a/src/qlibbsarch/QLibbsarch.h +++ b/src/qlibbsarch/QLibbsarch.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include diff --git a/tests/ArchiveAutoServiceFacts.cpp b/tests/ArchiveAutoServiceFacts.cpp index bea73b3..8fd37f1 100644 --- a/tests/ArchiveAutoServiceFacts.cpp +++ b/tests/ArchiveAutoServiceFacts.cpp @@ -23,4 +23,4 @@ namespace BsaPackerTests auto result = ArchiveAutoService(); ); } -} \ No newline at end of file +} diff --git a/tests/ArchiveBuilderHelperFacts.cpp b/tests/ArchiveBuilderHelperFacts.cpp index 1cdb090..a970c24 100644 --- a/tests/ArchiveBuilderHelperFacts.cpp +++ b/tests/ArchiveBuilderHelperFacts.cpp @@ -34,4 +34,4 @@ namespace BsaPackerTests auto result = ArchiveBuilderHelper(naggyMockSettingsService); ); } -} \ No newline at end of file +} diff --git a/tests/ArchiveNameServiceFacts.cpp b/tests/ArchiveNameServiceFacts.cpp index e2ad697..c79c545 100644 --- a/tests/ArchiveNameServiceFacts.cpp +++ b/tests/ArchiveNameServiceFacts.cpp @@ -257,4 +257,4 @@ namespace BsaPackerTests // Assert EXPECT_EQ("C:/directory/archive.bsa", result.toStdString()); } -} \ No newline at end of file +} diff --git a/tests/BsaPackerWorkerFacts.cpp b/tests/BsaPackerWorkerFacts.cpp index 718af5b..851ae3c 100644 --- a/tests/BsaPackerWorkerFacts.cpp +++ b/tests/BsaPackerWorkerFacts.cpp @@ -9,6 +9,7 @@ #include "MockArchiveAutoService.h" #include "MockHideLooseAssetService.h" #include "MockArchiveNameService.h" +#include "MockOverrideFileService.h" using namespace BsaPacker; using ::testing::NaggyMock; @@ -18,7 +19,8 @@ namespace BsaPackerTests class BsaPackerWorkerFacts : public ::testing::Test { protected: - void SetUp() override { + void SetUp() override + { naggyMockSettingsService = new NaggyMock(); naggyMockModDtoFactory = new NaggyMock(); naggyMockArchiveBuilderFactory = new NaggyMock(); @@ -26,9 +28,11 @@ namespace BsaPackerTests naggyMockDummyPluginServiceFactory = new NaggyMock(); naggyMockHideLooseAssetService = new NaggyMock(); naggyMockArchiveNameService = new NaggyMock(); + naggyOverrideFileService = new NaggyMock(); } - void TearDown() override { + void TearDown() override + { delete naggyMockSettingsService; delete naggyMockModDtoFactory; delete naggyMockArchiveBuilderFactory; @@ -38,13 +42,14 @@ namespace BsaPackerTests delete naggyMockArchiveNameService; } - NaggyMock* naggyMockSettingsService; - NaggyMock* naggyMockModDtoFactory; - NaggyMock* naggyMockArchiveBuilderFactory; - NaggyMock* naggyMockArchiveAutoService; - NaggyMock* naggyMockDummyPluginServiceFactory; - NaggyMock* naggyMockHideLooseAssetService; - NaggyMock* naggyMockArchiveNameService; + NaggyMock *naggyMockSettingsService; + NaggyMock *naggyMockModDtoFactory; + NaggyMock *naggyMockArchiveBuilderFactory; + NaggyMock *naggyMockArchiveAutoService; + NaggyMock *naggyMockDummyPluginServiceFactory; + NaggyMock *naggyMockHideLooseAssetService; + NaggyMock *naggyMockArchiveNameService; + NaggyMock *naggyOverrideFileService; }; TEST_F(BsaPackerWorkerFacts, Ctor_Always_Constructs) @@ -56,6 +61,7 @@ namespace BsaPackerTests naggyMockArchiveAutoService, naggyMockDummyPluginServiceFactory, naggyMockHideLooseAssetService, - naggyMockArchiveNameService)); + naggyMockArchiveNameService, + naggyOverrideFileService)); } } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6618fee..5f482a7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.22) add_executable(bsa_packer_tests) -mo2_configure_tests(bsa_packer_tests - WARNINGS OFF DEPENDS bsa_packer) +mo2_configure_tests(bsa_packer_tests WARNINGS OFF) +target_link_libraries(bsa_packer_tests PRIVATE bsa_packer) diff --git a/tests/DummyPluginServiceFactoryFacts.cpp b/tests/DummyPluginServiceFactoryFacts.cpp index 413dcc5..c662438 100644 --- a/tests/DummyPluginServiceFactoryFacts.cpp +++ b/tests/DummyPluginServiceFactoryFacts.cpp @@ -41,4 +41,4 @@ namespace BsaPackerTests ); ); } -} \ No newline at end of file +} diff --git a/tests/Fallout3DummyPluginServiceFacts.cpp b/tests/Fallout3DummyPluginServiceFacts.cpp index dc946ec..e485d56 100644 --- a/tests/Fallout3DummyPluginServiceFacts.cpp +++ b/tests/Fallout3DummyPluginServiceFacts.cpp @@ -36,4 +36,4 @@ namespace BsaPackerTests ); ); } -} \ No newline at end of file +} diff --git a/tests/Fallout4DummyPluginServiceFacts.cpp b/tests/Fallout4DummyPluginServiceFacts.cpp index ff7a91c..07d7139 100644 --- a/tests/Fallout4DummyPluginServiceFacts.cpp +++ b/tests/Fallout4DummyPluginServiceFacts.cpp @@ -36,4 +36,4 @@ namespace BsaPackerTests ); ); } -} \ No newline at end of file +} diff --git a/tests/FileWriterServiceFacts.cpp b/tests/FileWriterServiceFacts.cpp index 23267c3..5038640 100644 --- a/tests/FileWriterServiceFacts.cpp +++ b/tests/FileWriterServiceFacts.cpp @@ -23,4 +23,4 @@ namespace BsaPackerTests auto result = FileWriterService(); ); } -} \ No newline at end of file +} diff --git a/tests/GeneralArchiveBuilderFacts.cpp b/tests/GeneralArchiveBuilderFacts.cpp index faaf82c..2139a44 100644 --- a/tests/GeneralArchiveBuilderFacts.cpp +++ b/tests/GeneralArchiveBuilderFacts.cpp @@ -32,4 +32,4 @@ namespace BsaPackerTests baNone); ); } -} \ No newline at end of file +} diff --git a/tests/HideLooseAssetServiceFacts.cpp b/tests/HideLooseAssetServiceFacts.cpp index 05f9a0d..c868b8d 100644 --- a/tests/HideLooseAssetServiceFacts.cpp +++ b/tests/HideLooseAssetServiceFacts.cpp @@ -30,4 +30,4 @@ namespace BsaPackerTests naggyMockSettingsService); ); } -} \ No newline at end of file +} diff --git a/tests/MockArchiveAutoService.h b/tests/MockArchiveAutoService.h index cf6eaf8..ebbbcfa 100644 --- a/tests/MockArchiveAutoService.h +++ b/tests/MockArchiveAutoService.h @@ -6,5 +6,5 @@ using namespace BsaPacker; class MockArchiveAutoService : public IArchiveAutoService { public: - MOCK_METHOD(void, CreateBSA, (libbsarch::bs_archive_auto*, const QString&, bsa_archive_type_e), (const, override)); -}; \ No newline at end of file + MOCK_METHOD(bool, CreateBSA, (libbsarch::bs_archive_auto *, const QString &, bsa_archive_type_e), (const, override)); +}; diff --git a/tests/MockArchiveBuilderFactory.h b/tests/MockArchiveBuilderFactory.h index 82520de..61a7ce4 100644 --- a/tests/MockArchiveBuilderFactory.h +++ b/tests/MockArchiveBuilderFactory.h @@ -8,4 +8,4 @@ class MockArchiveBuilderFactory : public IArchiveBuilderFactory public: MOCK_METHOD(std::vector, GetArchiveTypes, (const IModDto*), (const, override)); MOCK_METHOD(std::unique_ptr, Create, (bsa_archive_type_e, const IModDto*), (const, override)); -}; \ No newline at end of file +}; diff --git a/tests/MockArchiveBuilderHelper.h b/tests/MockArchiveBuilderHelper.h index ef24f20..632977e 100644 --- a/tests/MockArchiveBuilderHelper.h +++ b/tests/MockArchiveBuilderHelper.h @@ -12,4 +12,4 @@ class MockArchiveBuilderHelper : public IArchiveBuilderHelper MOCK_METHOD(uint32_t, getFileCount, (const std::filesystem::path&), (const, override)); MOCK_METHOD(std::vector, getRootDirectoryFilenames, (const std::filesystem::path&), (const, override)); MOCK_METHOD(bool, doesPathContainFiles, (const std::filesystem::path&, const std::vector&), (const, override)); -}; \ No newline at end of file +}; diff --git a/tests/MockArchiveNameService.h b/tests/MockArchiveNameService.h index 6d8e405..94dd68b 100644 --- a/tests/MockArchiveNameService.h +++ b/tests/MockArchiveNameService.h @@ -7,5 +7,7 @@ class MockArchiveNameService : public IArchiveNameService { public: MOCK_METHOD(QString, GetFileExtension, (), (const, override)); - MOCK_METHOD(QString, GetArchiveFullPath, (bsa_archive_type_e, const IModDto*), (const, override)); -}; \ No newline at end of file + MOCK_METHOD(QString, GetArchiveFullPath, (bsa_archive_type_e, const IModDto *), (const, override)); + MOCK_METHOD(QString, Infix, (bsa_archive_type_e type), (const, override)); + MOCK_METHOD(QString, Suffix, (const QString &pathNoExt), (const, override)); +}; diff --git a/tests/MockDummyPluginLogic.h b/tests/MockDummyPluginLogic.h index 26edf5f..5bdaa50 100644 --- a/tests/MockDummyPluginLogic.h +++ b/tests/MockDummyPluginLogic.h @@ -6,6 +6,6 @@ using namespace BsaPacker; class MockDummyPluginLogic : public IDummyPluginLogic { public: - MOCK_METHOD(bool, canCreateDummyESP, (const QString& fileNameNoExtension), (const, override)); - MOCK_METHOD(bool, canCreateDummyESL, (const QString& fileNameNoExtension), (const, override)); -}; \ No newline at end of file + MOCK_METHOD(bool, canCreateDummyESP, (const QString &, const bsa_archive_type_e), (const, override)); + MOCK_METHOD(bool, canCreateDummyESL, (const QString &, const bsa_archive_type_e), (const, override)); +}; diff --git a/tests/MockDummyPluginServiceFactory.h b/tests/MockDummyPluginServiceFactory.h index c5fc8fe..36ccc29 100644 --- a/tests/MockDummyPluginServiceFactory.h +++ b/tests/MockDummyPluginServiceFactory.h @@ -7,4 +7,4 @@ class MockDummyPluginServiceFactory : public IDummyPluginServiceFactory { public: MOCK_METHOD(std::unique_ptr, Create, (), (const, override)); -}; \ No newline at end of file +}; diff --git a/tests/MockFileWriterService.h b/tests/MockFileWriterService.h index ab1bc33..164ba5a 100644 --- a/tests/MockFileWriterService.h +++ b/tests/MockFileWriterService.h @@ -7,4 +7,4 @@ class MockFileWriterService : public IFileWriterService { public: MOCK_METHOD(bool, Write, (const std::string&, const char*, uint32_t), (const, override)); -}; \ No newline at end of file +}; diff --git a/tests/MockHideLooseAssetService.h b/tests/MockHideLooseAssetService.h index acb678d..681534d 100644 --- a/tests/MockHideLooseAssetService.h +++ b/tests/MockHideLooseAssetService.h @@ -7,4 +7,4 @@ class MockHideLooseAssetService : public IHideLooseAssetService { public: MOCK_METHOD(bool, HideLooseAssets, (const QDir&), (const, override)); -}; \ No newline at end of file +}; diff --git a/tests/MockModContext.h b/tests/MockModContext.h index e2a53b2..fedb3ff 100644 --- a/tests/MockModContext.h +++ b/tests/MockModContext.h @@ -10,4 +10,4 @@ class MockModContext : public IModContext MOCK_METHOD(int, GetNexusId, (), (const, override)); MOCK_METHOD(QStringList, GetPlugins, (const QDir& modDirectory), (const, override)); MOCK_METHOD(QStringList, GetValidMods, (), (const, override)); -}; \ No newline at end of file +}; diff --git a/tests/MockModDtoFactory.h b/tests/MockModDtoFactory.h index 103d692..d1f0331 100644 --- a/tests/MockModDtoFactory.h +++ b/tests/MockModDtoFactory.h @@ -7,4 +7,4 @@ class MockModDtoFactory : public IModDtoFactory { public: MOCK_METHOD(std::unique_ptr, Create, (), (const)); -}; \ No newline at end of file +}; diff --git a/tests/MockOrganizer.h b/tests/MockOrganizer.h index 183b18a..4c6762e 100644 --- a/tests/MockOrganizer.h +++ b/tests/MockOrganizer.h @@ -14,6 +14,7 @@ class MockOrganizer : public IOrganizer MOCK_METHOD(QString, overwritePath, (), (const, override)); MOCK_METHOD(QString, basePath, (), (const, override)); MOCK_METHOD(QString, modsPath, (), (const, override)); + MOCK_METHOD(Version, version, (), (const, override)); MOCK_METHOD(VersionInfo, appVersion, (), (const, override)); MOCK_METHOD(IModInterface*, createMod, (GuessedValue &name), (override)); MOCK_METHOD(IPluginGame*, getGame, (const QString &gameName), (const, override)); @@ -37,13 +38,16 @@ class MockOrganizer : public IOrganizer MOCK_METHOD(MOBase::IPluginList*, pluginList, (), (const, override)); MOCK_METHOD(MOBase::IModList*, modList, (), (const, override)); MOCK_METHOD(MOBase::IProfile*, profile, (), (const, override)); + MOCK_METHOD(IGameFeatures*, gameFeatures, (), (const, override)); MOCK_METHOD(HANDLE, startApplication, (const QString &executable, const QStringList &args, const QString &cwd, const QString &profile, const QString &forcedCustomOverwrite, bool ignoreCustomOverwrite), (override)); MOCK_METHOD(bool, waitForApplication, (HANDLE handle, bool refresh, LPDWORD exitCode), (const, override)); MOCK_METHOD(bool, onAboutToRun, (const std::function &func), (override)); + MOCK_METHOD(bool, onAboutToRun, (const std::function&), (override)); MOCK_METHOD(bool, onFinishedRun, (const std::function &func), (override)); MOCK_METHOD(void, refresh, (bool saveChanges), (override)); MOCK_METHOD(MOBase::IPluginGame const *, managedGame, (), (const, override)); MOCK_METHOD(bool, onUserInterfaceInitialized, (const std::function &), (override)); + MOCK_METHOD(bool, onNextRefresh, (const std::function &, bool), (override)); MOCK_METHOD(bool, onProfileCreated, (const std::function&), (override)); MOCK_METHOD(bool, onProfileRemoved, (const std::function&), (override)); MOCK_METHOD(bool, onProfileRenamed, (const std::function&), (override)); diff --git a/tests/MockOverrideFileService.h b/tests/MockOverrideFileService.h new file mode 100644 index 0000000..b7c0414 --- /dev/null +++ b/tests/MockOverrideFileService.h @@ -0,0 +1,10 @@ +#include +#include + +using namespace BsaPacker; + +class MockOverrideFileService : public IOverrideFileService +{ +public: + MOCK_METHOD(bool, CreateOverrideFile, (const int nexusId, const QString &modPath, const QStringList &archiveNames), (const, override)); +}; diff --git a/tests/MockPackerDialog.h b/tests/MockPackerDialog.h index 867eedc..aafad52 100644 --- a/tests/MockPackerDialog.h +++ b/tests/MockPackerDialog.h @@ -14,4 +14,4 @@ class MockPackerDialog : public IPackerDialog MOCK_METHOD(void, RefreshSelectedName, (), (override)); MOCK_METHOD(int, Exec, (), (override)); MOCK_METHOD(void, RefreshOkButton, (), (override)); -}; \ No newline at end of file +}; diff --git a/tests/MockSettingsService.h b/tests/MockSettingsService.h index 1ee5ff6..73bfea0 100644 --- a/tests/MockSettingsService.h +++ b/tests/MockSettingsService.h @@ -7,4 +7,4 @@ class MockSettingsService : public ISettingsService { public: MOCK_METHOD(QVariant, GetPluginSetting, (const QString&), (const, override)); -}; \ No newline at end of file +}; diff --git a/tests/ModContextFacts.cpp b/tests/ModContextFacts.cpp index 982effd..3ab1808 100644 --- a/tests/ModContextFacts.cpp +++ b/tests/ModContextFacts.cpp @@ -30,4 +30,4 @@ namespace BsaPackerTests naggyMockOrganizer); ); } -} \ No newline at end of file +} diff --git a/tests/ModDtoFactoryFacts.cpp b/tests/ModDtoFactoryFacts.cpp index c3367bb..ae9a9f7 100644 --- a/tests/ModDtoFactoryFacts.cpp +++ b/tests/ModDtoFactoryFacts.cpp @@ -50,4 +50,4 @@ namespace BsaPackerTests EXPECT_EQ(1, result->NexusId()); } -} \ No newline at end of file +} diff --git a/tests/NewVegasDummyPluginServiceFacts.cpp b/tests/NewVegasDummyPluginServiceFacts.cpp index ca9c2d3..98216ff 100644 --- a/tests/NewVegasDummyPluginServiceFacts.cpp +++ b/tests/NewVegasDummyPluginServiceFacts.cpp @@ -36,4 +36,4 @@ namespace BsaPackerTests ); ); } -} \ No newline at end of file +} diff --git a/tests/OblivionDummyPluginServiceFacts.cpp b/tests/OblivionDummyPluginServiceFacts.cpp index fc6396b..dbebbb1 100644 --- a/tests/OblivionDummyPluginServiceFacts.cpp +++ b/tests/OblivionDummyPluginServiceFacts.cpp @@ -36,4 +36,4 @@ namespace BsaPackerTests ); ); } -} \ No newline at end of file +} diff --git a/tests/SkyrimDummyPluginServiceFacts.cpp b/tests/SkyrimDummyPluginServiceFacts.cpp index a4ea2b0..e699c10 100644 --- a/tests/SkyrimDummyPluginServiceFacts.cpp +++ b/tests/SkyrimDummyPluginServiceFacts.cpp @@ -36,4 +36,4 @@ namespace BsaPackerTests ); ); } -} \ No newline at end of file +} diff --git a/tests/SkyrimSEDummyPluginServiceFacts.cpp b/tests/SkyrimSEDummyPluginServiceFacts.cpp index d1bcc9a..5a67937 100644 --- a/tests/SkyrimSEDummyPluginServiceFacts.cpp +++ b/tests/SkyrimSEDummyPluginServiceFacts.cpp @@ -36,4 +36,4 @@ namespace BsaPackerTests ); ); } -} \ No newline at end of file +} diff --git a/tests/TextureArchiveBuilderFacts.cpp b/tests/TextureArchiveBuilderFacts.cpp index 11eb961..3ada0de 100644 --- a/tests/TextureArchiveBuilderFacts.cpp +++ b/tests/TextureArchiveBuilderFacts.cpp @@ -32,4 +32,4 @@ namespace BsaPackerTests baNone); ); } -} \ No newline at end of file +} diff --git a/tests/TexturelessArchiveBuilderFacts.cpp b/tests/TexturelessArchiveBuilderFacts.cpp index 52ab12f..f0aa7d2 100644 --- a/tests/TexturelessArchiveBuilderFacts.cpp +++ b/tests/TexturelessArchiveBuilderFacts.cpp @@ -32,4 +32,4 @@ namespace BsaPackerTests baNone); ); } -} \ No newline at end of file +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..addd280 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,34 @@ +{ + "dependencies": ["mo2-libbsarch", "mo2-dds-header", "directxtex", "bext-di"], + "features": { + "standalone": { + "description": "Build Standalone.", + "dependencies": ["mo2-cmake"] + }, + "testing": { + "description": "Build BSA Packer tests.", + "dependencies": ["gtest"] + } + }, + "vcpkg-configuration": { + "default-registry": { + "kind": "git", + "repository": "https://github.com/Microsoft/vcpkg", + "baseline": "294f76666c3000630d828703e675814c05a4fd43" + }, + "registries": [ + { + "kind": "git", + "repository": "https://github.com/Microsoft/vcpkg", + "baseline": "294f76666c3000630d828703e675814c05a4fd43", + "packages": ["boost*", "boost-*", "bext-*"] + }, + { + "kind": "git", + "repository": "https://github.com/ModOrganizer2/vcpkg-registry", + "baseline": "9936967e7c0ba1968e54a2fa6e6ad27b4f992b9b", + "packages": ["mo2-*"] + } + ] + } +}