20 Commits

Author SHA1 Message Date
9648abf4b9 fix
All checks were successful
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
2024-07-10 15:16:18 -05:00
cc1246d0f5 moved version.rc.in 2024-07-10 14:59:33 -05:00
726aa43a95 fix 2024-07-10 14:56:09 -05:00
224f983ca8 fix 2024-07-10 14:48:31 -05:00
f962884341 updated build system 2024-07-10 14:46:17 -05:00
6f35cc8bfa remove unused file 2024-07-10 10:14:25 -05:00
c08c9bc216 updated build system 2024-07-09 15:04:45 -05:00
239652be7c updated build system 2024-07-09 14:58:56 -05:00
68c9ec0f82 updated build system 2024-07-09 14:28:39 -05:00
da07122997 updated build system 2024-07-09 13:30:49 -05:00
5fb66dc6ee updated build system 2024-07-09 13:25:46 -05:00
0c414fc8a6 updated build system 2024-07-09 13:12:02 -05:00
097507a2d9 version handling 2024-07-09 12:38:10 -05:00
466b3fcead update build system 2024-07-09 12:22:47 -05:00
81dc6d1269 updated build system 2024-07-09 12:09:52 -05:00
b6c020d35d updated build system 2024-07-09 11:42:30 -05:00
dfbe97988f fixes 2024-07-09 08:37:31 -05:00
cd36679a1c update build system 2024-06-27 12:12:09 -05:00
4d555bce96 updated build system 2024-06-27 12:04:37 -05:00
d96c6012c5 update build system 2024-06-27 08:33:54 -05:00
20 changed files with 359 additions and 221 deletions

3
.gitignore vendored
View File

@ -6,6 +6,7 @@ cspell.json
support/Dockerfile support/Dockerfile
dist/ dist/
deps/ deps/
repertory/librepertory/src/common.cpp
scripts/cleanup.cmd scripts/cleanup.cmd
scripts/cleanup.sh scripts/cleanup.sh
version.rc
version.cpp

View File

@ -22,16 +22,39 @@ include(cmake/functions.cmake)
include(cmake/libraries.cmake) include(cmake/libraries.cmake)
if(PROJECT_BUILD) if(PROJECT_BUILD)
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE PROJECT_GIT_REV
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/version.cpp "")
file(GLOB_RECURSE ADDITIONAL_SOURCES file(GLOB_RECURSE ADDITIONAL_SOURCES
${PROJECT_3RD_PARTY_DIR}/src/*.c ${PROJECT_3RD_PARTY_DIR}/src/*.c
${PROJECT_3RD_PARTY_DIR}/src/*.cpp ${PROJECT_3RD_PARTY_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/version.cpp
) )
list(APPEND PROJECT_ADDITIONAL_SOURCES list(APPEND PROJECT_ADDITIONAL_SOURCES
${ADDITIONAL_SOURCES} ${ADDITIONAL_SOURCES}
) )
unset(PROJECT_GIT_REV CACHE)
unset(PROJECT_VERSION CACHE)
include(project.cmake) include(project.cmake)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/version.cpp.in
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/version.cpp
@ONLY
)
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/build/version.sh "export PROJECT_VERSION=${PROJECT_VERSION}")
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/build/git_rev.sh "export PROJECT_GIT_REV=${PROJECT_GIT_REV}")
else() else()
message(STATUS "-=[CMake Settings]=-") message(STATUS "-=[CMake Settings]=-")
message(STATUS " C standard: ${CMAKE_C_STANDARD}") message(STATUS " C standard: ${CMAKE_C_STANDARD}")

View File

@ -41,6 +41,10 @@ function(add_project_executable name dependencies libraries)
${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/${name}/src/*.cxx ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/${name}/src/*.cxx
) )
if (PROJECT_WINDOWS_VERSION_RC)
list(APPEND sources ${PROJECT_WINDOWS_VERSION_RC})
endif()
add_executable(${name} add_executable(${name}
${headers} ${headers}
${sources} ${sources}

View File

@ -3,7 +3,8 @@ set(REPERTORY_MINOR 0)
set(REPERTORY_REV 2) set(REPERTORY_REV 2)
set(REPERTORY_RELEASE_NUM 0) set(REPERTORY_RELEASE_NUM 0)
set(REPERTORY_RELEASE_ITER rc) set(REPERTORY_RELEASE_ITER rc)
set(REPERTORY_VERSION ${REPERTORY_MAJOR}.${REPERTORY_MINOR}.${REPERTORY_REV}-${REPERTORY_RELEASE_ITER})
set(PROJECT_VERSION ${REPERTORY_MAJOR}.${REPERTORY_MINOR}.${REPERTORY_REV}-${REPERTORY_RELEASE_ITER})
set(REPERTORY_VER_FILEVERSION ${REPERTORY_MAJOR},${REPERTORY_MINOR},${REPERTORY_REV},${REPERTORY_RELEASE_NUM}) set(REPERTORY_VER_FILEVERSION ${REPERTORY_MAJOR},${REPERTORY_MINOR},${REPERTORY_REV},${REPERTORY_RELEASE_NUM})
set(REPERTORY_VER_FILEVERSION_STR ${REPERTORY_MAJOR}.${REPERTORY_MINOR}.${REPERTORY_REV}.${REPERTORY_RELEASE_NUM}) set(REPERTORY_VER_FILEVERSION_STR ${REPERTORY_MAJOR}.${REPERTORY_MINOR}.${REPERTORY_REV}.${REPERTORY_RELEASE_NUM})
@ -19,13 +20,14 @@ if (REPERTORY_ENABLE_S3)
add_definitions(-DREPERTORY_ENABLE_S3) add_definitions(-DREPERTORY_ENABLE_S3)
endif() endif()
# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in ${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc @ONLY) if (PROJECT_IS_MINGW)
# set(WINDOWS_VERSION_RC ${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc) configure_file(
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/version.rc.in
${CMAKE_CURRENT_SOURCE_DIR}/repertory/librepertory/src/common.cpp.in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/version.rc
${CMAKE_CURRENT_SOURCE_DIR}/repertory/librepertory/src/common.cpp @ONLY
@ONLY )
) set(PROJECT_WINDOWS_VERSION_RC ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/version.rc)
endif()
set(CMAKE_CXX_FLAGS "-include common.hpp ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-include common.hpp ${CMAKE_CXX_FLAGS}")

View File

@ -403,11 +403,6 @@ using FileInfo = FSP_FSCTL_FILE_INFO;
using namespace Fsp; using namespace Fsp;
namespace repertory {
auto get_repertory_git_revision() -> const std::string &;
auto get_repertory_version() -> const std::string &;
} // namespace repertory
namespace { namespace {
template <class... Ts> struct overloaded : Ts... { template <class... Ts> struct overloaded : Ts... {
using Ts::operator()...; using Ts::operator()...;

View File

@ -1,35 +1,31 @@
/* /*
Copyright <2018-2024> <scott.e.graves@protonmail.com> Copyright <2018-2024> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#include "types/repertory.hpp" #ifndef LIBREPERTORY_INCLUDE_VERSION_HPP_
#include "utils/utils.hpp" #define LIBREPERTORY_INCLUDE_VERSION_HPP_
namespace repertory { namespace repertory {
auto get_repertory_git_revision() -> const std::string & { [[nodiscard]] auto project_get_git_rev() -> std::string_view;
static const std::string git_revision = "@REPERTORY_GIT_REV@";
return git_revision; [[nodiscard]] auto project_get_version() -> std::string_view;
} } // namespace repertory
auto get_repertory_version() -> const std::string & { #endif // LIBREPERTORY_INCLUDE_VERSION_HPP_
static const std::string version = "@REPERTORY_VERSION@";
return version;
}
} // namespace repertory

View File

@ -25,6 +25,7 @@
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/error_utils.hpp" #include "utils/error_utils.hpp"
#include "utils/timeout.hpp" #include "utils/timeout.hpp"
#include "version.hpp"
namespace repertory { namespace repertory {
// clang-format off // clang-format off
@ -116,8 +117,8 @@ void packet_client::put_client(std::shared_ptr<client> &cli) {
} }
} }
auto packet_client::read_packet(client &cli, packet &response) auto packet_client::read_packet(client &cli,
-> packet::error_type { packet &response) -> packet::error_type {
data_buffer buffer(sizeof(std::uint32_t)); data_buffer buffer(sizeof(std::uint32_t));
const auto read_buffer = [&]() { const auto read_buffer = [&]() {
std::uint32_t offset{}; std::uint32_t offset{};
@ -168,8 +169,8 @@ auto packet_client::send(const std::string &method, packet &request,
} }
auto packet_client::send(const std::string &method, packet &request, auto packet_client::send(const std::string &method, packet &request,
packet &response, std::uint32_t &service_flags) packet &response,
-> packet::error_type { std::uint32_t &service_flags) -> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
auto success = false; auto success = false;
@ -178,7 +179,7 @@ auto packet_client::send(const std::string &method, packet &request,
request.encode_top(utils::get_thread_id()); request.encode_top(utils::get_thread_id());
request.encode_top(unique_id_); request.encode_top(unique_id_);
request.encode_top(PACKET_SERVICE_FLAGS); request.encode_top(PACKET_SERVICE_FLAGS);
request.encode_top(get_repertory_version()); request.encode_top(std::string{project_get_version()});
static const std::uint8_t max_attempts{5U}; static const std::uint8_t max_attempts{5U};
for (std::uint8_t i = 1U; for (std::uint8_t i = 1U;

View File

@ -27,6 +27,7 @@
#include "events/events.hpp" #include "events/events.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/path_utils.hpp" #include "utils/path_utils.hpp"
#include "version.hpp"
namespace repertory::remote_winfsp { namespace repertory::remote_winfsp {
#define RAISE_REMOTE_WINFSP_CLIENT_EVENT(func, file, ret) \ #define RAISE_REMOTE_WINFSP_CLIENT_EVENT(func, file, ret) \
@ -52,8 +53,8 @@ remote_client::remote_client(const app_config &config)
config.get_remote_receive_timeout_secs(), config.get_remote_receive_timeout_secs(),
config.get_remote_send_timeout_secs(), config.get_remote_token()) {} config.get_remote_send_timeout_secs(), config.get_remote_token()) {}
auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name) auto remote_client::winfsp_can_delete(PVOID file_desc,
-> packet::error_type { PWSTR file_name) -> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -68,9 +69,8 @@ auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
return ret; return ret;
} }
auto remote_client::json_create_directory_snapshot(const std::string &path, auto remote_client::json_create_directory_snapshot(
json &json_data) const std::string &path, json &json_data) -> packet::error_type {
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -111,8 +111,8 @@ auto remote_client::json_read_directory_snapshot(
} }
auto remote_client::json_release_directory_snapshot( auto remote_client::json_release_directory_snapshot(
const std::string &path, const remote::file_handle &handle) const std::string &path,
-> packet::error_type { const remote::file_handle &handle) -> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -127,8 +127,8 @@ auto remote_client::json_release_directory_snapshot(
} }
auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name, auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
UINT32 flags, BOOLEAN &was_closed) UINT32 flags,
-> packet::error_type { BOOLEAN &was_closed) -> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
auto handle = to_handle(file_desc); auto handle = to_handle(file_desc);
@ -177,8 +177,8 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 attributes,
UINT64 allocation_size, PVOID *file_desc, UINT64 allocation_size, PVOID *file_desc,
remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name, BOOLEAN &exists) std::string &normalized_name,
-> packet::error_type { BOOLEAN &exists) -> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -245,9 +245,8 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc,
return STATUS_INVALID_HANDLE; return STATUS_INVALID_HANDLE;
} }
auto remote_client::winfsp_get_file_info(PVOID file_desc, auto remote_client::winfsp_get_file_info(
remote::file_info *file_info) PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -264,11 +263,9 @@ auto remote_client::winfsp_get_file_info(PVOID file_desc,
return ret; return ret;
} }
auto remote_client::winfsp_get_security_by_name(PWSTR file_name, auto remote_client::winfsp_get_security_by_name(
PUINT32 attributes, PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
std::uint64_t *descriptor_size, std::wstring &string_descriptor) -> packet::error_type {
std::wstring &string_descriptor)
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -297,10 +294,9 @@ auto remote_client::winfsp_get_security_by_name(PWSTR file_name,
return ret; return ret;
} }
auto remote_client::winfsp_get_volume_info(UINT64 &total_size, auto remote_client::winfsp_get_volume_info(
UINT64 &free_size, UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) std::string &volume_label) -> packet::error_type {
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -320,7 +316,7 @@ auto remote_client::winfsp_mounted(const std::wstring &location)
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
request.encode(get_repertory_version()); request.encode(std::string{project_get_version()});
request.encode(location); request.encode(location);
std::uint32_t service_flags{}; std::uint32_t service_flags{};
@ -332,11 +328,10 @@ auto remote_client::winfsp_mounted(const std::wstring &location)
return ret; return ret;
} }
auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options, auto remote_client::winfsp_open(
UINT32 granted_access, PVOID *file_desc, PWSTR file_name, UINT32 create_options, UINT32 granted_access,
remote::file_info *file_info, PVOID *file_desc, remote::file_info *file_info,
std::string &normalized_name) std::string &normalized_name) -> packet::error_type {
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -367,11 +362,10 @@ auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options,
return ret; return ret;
} }
auto remote_client::winfsp_overwrite(PVOID file_desc, UINT32 attributes, auto remote_client::winfsp_overwrite(
BOOLEAN replace_attributes, PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
UINT64 allocation_size, UINT64 allocation_size,
remote::file_info *file_info) remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -447,10 +441,9 @@ auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern,
return ret; return ret;
} }
auto remote_client::winfsp_rename(PVOID file_desc, PWSTR file_name, auto remote_client::winfsp_rename(
PWSTR new_file_name, PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) BOOLEAN replace_if_exists) -> packet::error_type {
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -494,10 +487,9 @@ auto remote_client::winfsp_set_basic_info(
return ret; return ret;
} }
auto remote_client::winfsp_set_file_size(PVOID file_desc, UINT64 new_size, auto remote_client::winfsp_set_file_size(
BOOLEAN set_allocation_size, PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
remote::file_info *file_info) remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;
@ -533,12 +525,10 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
return ret; return ret;
} }
auto remote_client::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, auto remote_client::winfsp_write(
UINT32 length, BOOLEAN write_to_end, PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
BOOLEAN constrained_io, BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred,
PUINT32 bytes_transferred, remote::file_info *file_info) -> packet::error_type {
remote::file_info *file_info)
-> packet::error_type {
constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__);
packet request; packet request;

View File

@ -28,6 +28,7 @@
#include "cli/get.hpp" #include "cli/get.hpp"
#include "cli/get_directory_items.hpp" #include "cli/get_directory_items.hpp"
#include "cli/get_pinned_files.hpp" #include "cli/get_pinned_files.hpp"
#include "cli/get_version.hpp"
#include "cli/help.hpp" #include "cli/help.hpp"
#include "cli/mount.hpp" #include "cli/mount.hpp"
#include "cli/open_files.hpp" #include "cli/open_files.hpp"
@ -37,7 +38,6 @@
#include "cli/status.hpp" #include "cli/status.hpp"
#include "cli/unmount.hpp" #include "cli/unmount.hpp"
#include "cli/unpin_file.hpp" #include "cli/unpin_file.hpp"
#include "cli/version.hpp"
#include "utils/cli_utils.hpp" #include "utils/cli_utils.hpp"
namespace repertory::cli::actions { namespace repertory::cli::actions {

View File

@ -1,35 +1,35 @@
/* /*
Copyright <2018-2024> <scott.e.graves@protonmail.com> Copyright <2018-2024> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_VERSION_HPP_ #ifndef INCLUDE_CLI_VERSION_HPP_
#define INCLUDE_CLI_VERSION_HPP_ #define INCLUDE_CLI_VERSION_HPP_
namespace repertory::cli::actions { #include "version.hpp"
template <typename drive> inline void version(std::vector<const char *> args) {
std::cout << "Repertory core version: " << get_repertory_version() namespace repertory::cli::actions {
<< std::endl; template <typename drive> inline void version(std::vector<const char *> args) {
std::cout << "Repertory Git revision: " << get_repertory_git_revision() std::cout << "Repertory core version: " << project_get_version() << std::endl;
<< std::endl; std::cout << "Repertory Git revision: " << project_get_git_rev() << std::endl;
drive::display_version_information(args); drive::display_version_information(args);
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_VERSION_HPP_ #endif // INCLUDE_CLI_VERSION_HPP_

33
repertory/version.cpp.in Normal file
View File

@ -0,0 +1,33 @@
/*
Copyright <2018-2024> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "version.hpp"
namespace {
static constexpr const std::string_view git_rev = "@PROJECT_GIT_REV@";
static constexpr const std::string_view version = "@PROJECT_VERSION@";
} // namespace
namespace repertory {
auto project_get_git_rev() -> std::string_view { return git_rev; }
auto project_get_version() -> std::string_view { return version; }
} // namespace repertory

View File

@ -1,64 +1,64 @@
#include <windows.h> #include <windows.h>
#define VER_FILEVERSION 2,0,2,0 #define VER_FILEVERSION @REPERTORY_VER_FILEVERSION@
#define VER_FILEVERSION_STR "2.0.2.0\0" #define VER_FILEVERSION_STR "@REPERTORY_VER_FILEVERSION_STR@\0"
#define VER_PRODUCTVERSION 2,0,2,0 #define VER_PRODUCTVERSION @REPERTORY_VER_PRODUCTVERSION@
#define VER_PRODUCTVERSION_STR "2.0.2.0\0" #define VER_PRODUCTVERSION_STR "@REPERTORY_VER_PRODUCTVERSION_STR@\0"
#define VER_COMPANYNAME_STR "https://git.fifthgrid.com/blockstorage\0" #define VER_COMPANYNAME_STR "@REPERTORY_VER_COMPANYNAME_STR@\0"
#define VER_INTERNALNAME_STR "Repertory 2.0.2-rc\0" #define VER_INTERNALNAME_STR "Repertory @PROJECT_VERSION@\0"
#define VER_LEGALCOPYRIGHT_STR "Copyright <2018-2024> <MIT License> <https://git.fifthgrid.com/blockstorage/repertory>\0" #define VER_LEGALCOPYRIGHT_STR "@REPERTORY_VER_LEGALCOPYRIGHT_STR@\0"
#define VER_ORIGINALFILENAME_STR "repertory.exe\0" #define VER_ORIGINALFILENAME_STR "repertory.exe\0"
#define VER_LEGALTRADEMARKS1_STR "\0" #define VER_LEGALTRADEMARKS1_STR "\0"
#define VER_LEGALTRADEMARKS2_STR "\0" #define VER_LEGALTRADEMARKS2_STR "\0"
#define VER_FILEDESCRIPTION_STR "Mount utility for Sia and S3\0" #define VER_FILEDESCRIPTION_STR "@REPERTORY_VER_FILEDESCRIPTION_STR@\0"
#define VER_PRODUCTNAME_STR "Repertory v2.0.2-rc\0" #define VER_PRODUCTNAME_STR "Repertory @PROJECT_VERSION@\0"
#ifdef DEBUG #ifdef DEBUG
#define VER_DEBUG VS_FF_DEBUG #define VER_DEBUG VS_FF_DEBUG
#else #else
#define VER_DEBUG 0 #define VER_DEBUG 0
#endif #endif
#define VER_PRERELEASE VS_FF_PRERELEASE #define VER_PRERELEASE @REPERTORY_VER_PRERELEASE@
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK (VS_FF_DEBUG|VS_FF_PRERELEASE) FILEFLAGSMASK (VS_FF_DEBUG|VS_FF_PRERELEASE)
FILEFLAGS (VER_DEBUG|VER_PRERELEASE) FILEFLAGS (VER_DEBUG|VER_PRERELEASE)
FILEOS VOS__WINDOWS32 FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN FILESUBTYPE VFT2_UNKNOWN
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
BLOCK "040904E4" BLOCK "040904E4"
BEGIN BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
BEGIN BEGIN
/* The following line should only be modified for localized versions. */ /* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */ /* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */ /* describing a language,codepage combination supported by the file. */
/* */ /* */
/* For example, a file might have values "0x409,1252" indicating that it */ /* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */ /* supports English language (0x409) in the Windows ANSI codepage (1252). */
VALUE "Translation", 0x409, 1252 VALUE "Translation", 0x409, 1252
END END
END END

View File

@ -111,10 +111,6 @@ if [ "${PROJECT_IS_MINGW}" == "1" ] && [ "${PROJECT_STATIC_LINK}" == "OFF" ]; th
PROJECT_MINGW64_COPY_DEPENDENCIES+=(/mingw64/bin/opengl*.dll) PROJECT_MINGW64_COPY_DEPENDENCIES+=(/mingw64/bin/opengl*.dll)
fi fi
for PROJECT_DEPENDENCY in "${PROJECT_MINGW64_COPY_DEPENDENCIES[@]}"; do
rsync -av --progress ${PROJECT_DEPENDENCY} "${PROJECT_DIST_DIR}/"
done
rsync -av --progress ${PROJECT_EXTERNAL_BUILD_ROOT}/bin/*.dll "${PROJECT_DIST_DIR}/" rsync -av --progress ${PROJECT_EXTERNAL_BUILD_ROOT}/bin/*.dll "${PROJECT_DIST_DIR}/"
rsync -av --progress ${PROJECT_EXTERNAL_BUILD_ROOT}/lib/*.dll "${PROJECT_DIST_DIR}/" rsync -av --progress ${PROJECT_EXTERNAL_BUILD_ROOT}/lib/*.dll "${PROJECT_DIST_DIR}/"
if [ "${PROJECT_ENABLE_WXWIDGETS}" == "ON" ]; then if [ "${PROJECT_ENABLE_WXWIDGETS}" == "ON" ]; then
@ -131,3 +127,7 @@ if [ "${PROJECT_IS_MINGW}" == "1" ] && [ "${PROJECT_ENABLE_WINFSP}" == "ON" ]; t
PROJECT_MINGW64_COPY_DEPENDENCIES+=(${PROJECT_3RD_PARTY_DIR}/winfsp-2.0/bin/winfsp-${WINFSP_DLL_PART}.dll) PROJECT_MINGW64_COPY_DEPENDENCIES+=(${PROJECT_3RD_PARTY_DIR}/winfsp-2.0/bin/winfsp-${WINFSP_DLL_PART}.dll)
fi fi
fi fi
for PROJECT_DEPENDENCY in "${PROJECT_MINGW64_COPY_DEPENDENCIES[@]}"; do
rsync -av --progress ${PROJECT_DEPENDENCY} "${PROJECT_DIST_DIR}/"
done

View File

@ -174,6 +174,8 @@ else
PROJECT_BUILD_DIR=${PROJECT_BUILD_DIR}/x86_64 PROJECT_BUILD_DIR=${PROJECT_BUILD_DIR}/x86_64
fi fi
PROJECT_DIST_DIR=${PROJECT_DIST_DIR}/${PROJECT_APP_NAME}
PROJECT_EXTERNAL_BUILD_ROOT=${PROJECT_BUILD_DIR}/deps PROJECT_EXTERNAL_BUILD_ROOT=${PROJECT_BUILD_DIR}/deps
PROJECT_3RD_PARTY_DIR=${SOURCE_DIR}/support/3rd_party PROJECT_3RD_PARTY_DIR=${SOURCE_DIR}/support/3rd_party
@ -228,6 +230,12 @@ fi
PATH="${PROJECT_EXTERNAL_BUILD_ROOT}/bin:${PATH}" PATH="${PROJECT_EXTERNAL_BUILD_ROOT}/bin:${PATH}"
if [ "${PROJECT_IS_MINGW}" == "1" ]; then
PROJECT_OS=win32
else
PROJECT_OS=linux
fi
export MSYS export MSYS
export NUM_JOBS export NUM_JOBS
export OPENSSL_ROOT_DIR export OPENSSL_ROOT_DIR
@ -252,6 +260,9 @@ export PROJECT_LINK_TYPE
export PROJECT_MINGW64_COPY_DEPENDENCIES export PROJECT_MINGW64_COPY_DEPENDENCIES
export PROJECT_MINGW64_DOCKER_BUILD_ARGS export PROJECT_MINGW64_DOCKER_BUILD_ARGS
export PROJECT_MSYS2_PACKAGE_LIST export PROJECT_MSYS2_PACKAGE_LIST
export PROJECT_OS
export PROJECT_PRIVATE_KEY
export PROJECT_PUBLIC_KEY
export PROJECT_REQUIRE_ALPINE export PROJECT_REQUIRE_ALPINE
export PROJECT_STATIC_LINK export PROJECT_STATIC_LINK
export PROJECT_TOOLCHAIN_FILE_CMAKE export PROJECT_TOOLCHAIN_FILE_CMAKE

View File

@ -1,9 +1,12 @@
@echo off @echo off
setlocal
set ARG1=%~1 set ARG1=%~1
set ARG2=%~2 set ARG2=%~2
set ARG3=%~3
pushd "%~dp0%" pushd "%~dp0%"
call mingw64 -no-start ./info.sh "x86_64" "%ARG1%" "%ARG2%" 1 0 call mingw64 -no-start ./info.sh "%ARG1%" "%ARG2%" "%ARG3%" 1 0
popd popd

View File

@ -1,13 +1,4 @@
#!/bin/bash #!/bin/bash
# clean dist on each build
# repertory - add back git rev
# - store in PROJECT_GIT_REV
# add make_package.sh/cmd
# - signature / sha256
# - add PROJECT_PUBLIC_KEY
# - add PROJECT_PRIVATE_KEY
# - [optional] post_package.sh for copy to destination
# update nvim-lua mmr/mmd
CURRENT_DIR=$(dirname "$0") CURRENT_DIR=$(dirname "$0")
CURRENT_DIR=$(realpath ${CURRENT_DIR}) CURRENT_DIR=$(realpath ${CURRENT_DIR})
@ -16,6 +7,11 @@ CURRENT_DIR=$(realpath ${CURRENT_DIR})
mkdir -p "${PROJECT_BUILD_DIR}/build" mkdir -p "${PROJECT_BUILD_DIR}/build"
if [ -d "${PROJECT_DIST_DIR}" ]; then
rm -rf "${PROJECT_DIST_DIR}"
mkdir -p "${PROJECT_DIST_DIR}"
fi
if [ -f "${SOURCE_DIR}/pre_build.sh" ]; then if [ -f "${SOURCE_DIR}/pre_build.sh" ]; then
"${SOURCE_DIR}/pre_build.sh" "${SOURCE_DIR}/pre_build.sh"
fi fi
@ -71,6 +67,8 @@ export LD_LIBRARY_PATH="\${CURRENT_DIR}/lib:\${CURRENT_DIR}/lib64:\${LD_LIBRARY_
\${CURRENT_DIR}/bin/${APP}${APP_BINARY_EXT} \$* \${CURRENT_DIR}/bin/${APP}${APP_BINARY_EXT} \$*
EOF EOF
chmod +x "${PROJECT_DIST_DIR}/${APP}${APP_BINARY_EXT}" chmod +x "${PROJECT_DIST_DIR}/${APP}${APP_BINARY_EXT}"
else
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
fi fi
else else
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/" rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
@ -82,3 +80,7 @@ if [ "${PROJECT_IS_MINGW}" == "1" ]; then
fi fi
ln -sf "${PROJECT_BUILD_DIR}/build/compile_commands.json" "${SOURCE_DIR}/compile_commands.json" ln -sf "${PROJECT_BUILD_DIR}/build/compile_commands.json" "${SOURCE_DIR}/compile_commands.json"
if [ -f "${SOURCE_DIR}/post_build.sh" ]; then
"${SOURCE_DIR}/post_build.sh"
fi

12
scripts/make_package.cmd Normal file
View File

@ -0,0 +1,12 @@
@echo off
setlocal
set DEST=%~1
set ARG1=%~2
set ARG2=%~3
set ARG3=%~4
pushd "%~dp0%"
call mingw64 -no-start ./make_package.sh "%DEST%" "%ARG1%" "%ARG2%" "%ARG3%" 1 0 || exit 1
popd

59
scripts/make_package.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
TEMP_DIR=$(mktemp -d)
DEST_DIR=$1
CURRENT_DIR=$(dirname "$0")
CURRENT_DIR=$(realpath ${CURRENT_DIR})
. "${CURRENT_DIR}/env.sh" "$2" "$3" "$4" "$5" "$6"
if [ -f "${CURRENT_DIR}/../build/version.sh" ]; then
source ${CURRENT_DIR}/../build/version.sh
fi
if [ -f "${CURRENT_DIR}/../build/git_rev.sh" ]; then
source ${CURRENT_DIR}/../build/git_rev.sh
fi
function exit_and_clean() {
echo $1
rm -rf ${TEMP_DIR}
exit $2
}
if [ "${PROJECT_VERSION}" == "" ]; then
echo "Project version not set"
exit 1
fi
if [ "${PROJECT_GIT_REV}" == "" ]; then
echo "Project git revision not set"
exit 1
fi
if [ ! -d "${PROJECT_DIST_DIR}" ]; then
echo "Dist directory not found: ${PROJECT_DIST_DIR}"
exit 1
fi
if [ "${DEST_DIR}" == "" ]; then
DEST_DIR="${CURRENT_DIR}/../dist"
fi
DEST_DIR=$(realpath "${DEST_DIR}")
if [ ! -d "${DEST_DIR}" ]; then
echo "Destination directory not found: ${DEST_DIR}"
exit 1
fi
PACKAGE_ROOT="${PROJECT_DIST_DIR}/.."
PACKAGE_ROOT=$(realpath "${PACKAGE_ROOT}")
rsync -av --progress ${PACKAGE_ROOT}/ ${TEMP_DIR}/ || exit_and_clean "Failed to rsync" 1
pushd "${DEST_DIR}"
tar cvzf ${PROJECT_APP_NAME}_${PROJECT_VERSION}_${PROJECT_GIT_REV}_${PROJECT_BUILD_ARCH}_${PROJECT_OS}.tar.gz -C ${TEMP_DIR} . || exit_and_clean "Failed to create archive" 1
popd
exit_and_clean "Created package successfully" 0

View File

@ -1,13 +1,16 @@
@echo off @echo off
setlocal
set ARG1=%~1 set ARG1=%~1
set ARG2=%~2 set ARG2=%~2
set ARG3=%~3
pushd "%~dp0%" pushd "%~dp0%"
call setup_msys2.cmd "%ARG1%" "%ARG2%" call setup_msys2.cmd "%ARG1%" "%ARG2%" "%ARG3%"
if exist "cleanup.cmd" ( if exist "cleanup.cmd" (
call cleanup.cmd "x86_64" "%ARG1%" "%ARG2%" 1 0 call cleanup.cmd "%ARG1%" "%ARG2%" "%ARG3%" 1 0
del cleanup.* del cleanup.*
) )
call mingw64 -no-start ./make_common.sh "x86_64" "%ARG1%" "%ARG2%" 1 0 || exit 1 call mingw64 -no-start ./make_common.sh "%ARG1%" "%ARG2%" "%ARG3%" 1 0 || exit 1
popd popd

View File

@ -1,9 +1,12 @@
@echo off @echo off
setlocal
set ARG1=%~1 set ARG1=%~1
set ARG2=%~2 set ARG2=%~2
set ARG3=%~3
pushd "%~dp0%" pushd "%~dp0%"
call mingw64 -no-start ./setup_msys2.sh "x86_64" "%ARG1%" "%ARG2%" 1 0 call mingw64 -no-start ./setup_msys2.sh "%ARG1%" "%ARG2%" "%ARG3%" 1 0
call mingw64 -no-start ./setup_msys2.sh "x86_64" "%ARG1%" "%ARG2%" 1 0 call mingw64 -no-start ./setup_msys2.sh "%ARG1%" "%ARG2%" "%ARG3%" 1 0
popd popd