Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenWrt updates #109

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.15)

project(RealmCxx)

Expand All @@ -16,19 +16,12 @@ endif()

set(REALM_BUILD_LIB_ONLY ON)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(REALM_USE_SYSTEM_OPENSSL ON)
set(OPENSSL_USE_STATIC_LIBS OFF)
set(REALM_USE_SYSTEM_OPENSSL ON CACHE BOOL "Find OpenSSL installed on the system instead of using a prebuilt copy")
set(OPENSSL_USE_STATIC_LIBS OFF CACHE BOOL "Link statically against OpenSSL")
endif()

add_subdirectory(realm-core)

set(REALM_NO_CONFIG)
set(REALM_ENABLE_SYNC)
set(REALM_NO_TESTS)
set(REALM_BUILD_LIB_ONLY)
set(REALM_INSTALL_LIBEXECDIR)
set(REALM_ENABLE_ENCRYPTION 1)

list(APPEND CMAKE_MODULE_PATH
"${RealmCxx_SOURCE_DIR}/tools/cmake" # for GetVersion
"${RealmCxx_SOURCE_DIR}/realm-core/tools/cmake") # for GetGitRevisionDescription
Expand All @@ -38,12 +31,6 @@ if(NOT DEFINED REALMCXX_VERSION)
git_describe(REALMCXX_VERSION)
endif()

add_compile_definitions(REALM_NO_CONFIG)
add_compile_definitions(REALM_ENABLE_SYNC)
add_compile_definitions(REALM_ENABLE_ENCRYPTION)
add_compile_definitions(REALM_INSTALL_LIBEXECDIR)
add_compile_definitions(REALM_BUILD_LIB_ONLY)

# Check if the compiler is Clang or GCC >= 11
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0"))
set(ENABLE_ALPHA_SDK TRUE)
Expand Down
2 changes: 1 addition & 1 deletion realm-core
Submodule realm-core updated 94 files
+57 −1 CHANGELOG.md
+34 −1 CMakeLists.txt
+36 −41 Jenkinsfile
+1 −1 Package.swift
+2 −0 alpine.Dockerfile
+6 −2 bindgen/src/realm_helpers.h
+1 −1 dependencies.list
+87 −0 evergreen/config.yml
+13,470 −11,749 src/external/json/json.hpp
+1 −0 src/external/s2/CMakeLists.txt
+71 −27 src/realm.h
+9 −3 src/realm/CMakeLists.txt
+33 −87 src/realm/array.cpp
+2 −0 src/realm/array.hpp
+1 −1 src/realm/array_integer.cpp
+7 −9 src/realm/array_integer.hpp
+18 −23 src/realm/array_integer_tpl.hpp
+7 −7 src/realm/array_with_find.cpp
+148 −240 src/realm/array_with_find.hpp
+1 −0 src/realm/cluster.cpp
+1 −1 src/realm/cluster_tree.cpp
+1 −1 src/realm/cluster_tree.hpp
+21 −1 src/realm/collection.hpp
+4 −4 src/realm/db.cpp
+12 −0 src/realm/error_codes.h
+10 −16 src/realm/group.hpp
+1 −3 src/realm/list.hpp
+6 −6 src/realm/object-store/c_api/scheduler.cpp
+40 −42 src/realm/object-store/c_api/socket_provider.cpp
+13 −5 src/realm/object-store/c_api/types.hpp
+10 −30 src/realm/object-store/set.cpp
+16 −10 src/realm/object-store/sync/sync_session.cpp
+3 −4 src/realm/object-store/sync/sync_session.hpp
+8 −2 src/realm/object-store/util/bson/bson.cpp
+35 −1 src/realm/query_conditions_tpl.hpp
+3 −11 src/realm/query_engine.cpp
+1 −23 src/realm/query_engine.hpp
+17 −1 src/realm/query_state.hpp
+290 −93 src/realm/set.cpp
+100 −384 src/realm/set.hpp
+19 −5 src/realm/sync/client.cpp
+34 −4 src/realm/sync/network/default_socket.cpp
+5 −0 src/realm/sync/network/network_ssl.cpp
+13 −19 src/realm/sync/network/websocket.cpp
+6 −7 src/realm/sync/network/websocket.hpp
+1 −0 src/realm/sync/noinst/client_history_impl.cpp
+16 −14 src/realm/sync/noinst/client_impl_base.cpp
+2 −0 src/realm/sync/noinst/client_impl_base.hpp
+3 −2 src/realm/sync/noinst/client_reset.cpp
+12 −9 src/realm/sync/noinst/server/server.cpp
+12 −15 src/realm/sync/subscriptions.cpp
+1 −2 src/realm/sync/subscriptions.hpp
+8 −6 src/realm/sync/transform.cpp
+19 −16 src/realm/table.cpp
+8 −7 src/realm/table.hpp
+3 −3 src/realm/timestamp.hpp
+12 −2 src/realm/util/backtrace.cpp
+7 −2 src/realm/util/config.h.in
+4 −4 src/realm/util/file.cpp
+7 −3 src/realm/util/interprocess_mutex.hpp
+2 −0 src/realm/util/logger.cpp
+4 −4 src/realm/util/serializer.cpp
+16 −6 src/realm/util/thread.cpp
+2 −0 src/realm/util/timestamp_logger.cpp
+4 −1 test/CMakeLists.txt
+106 −0 test/benchmark-common-tasks/main.cpp
+1 −1 test/fuzz_tester.hpp
+5 −5 test/large_tests/test_column_large.cpp
+19 −14 test/object-store/audit.cpp
+1,184 −1,009 test/object-store/c_api/c_api.cpp
+4 −2 test/object-store/migrations.cpp
+9 −0 test/object-store/object.cpp
+8 −6 test/object-store/realm.cpp
+4 −0 test/object-store/set.cpp
+5 −3 test/object-store/sync/flx_migration.cpp
+77 −1 test/object-store/sync/flx_sync.cpp
+1 −1 test/object-store/sync/session/wait_for_completion.cpp
+6 −2 test/object-store/util/sync/sync_test_utils.cpp
+13 −0 test/test_file.cpp
+8 −8 test/test_json.cpp
+4 −1 test/test_set.cpp
+64 −0 test/test_shared.cpp
+3 −3 test/test_sync_subscriptions.cpp
+2 −2 test/test_table.cpp
+5 −0 test/test_util_error.cpp
+3 −0 test/test_util_file.cpp
+3 −3 test/test_util_websocket.cpp
+10 −4 test/util/test_path.cpp
+8 −1 test/util/test_path.hpp
+4 −5 test/util/unit_test.cpp
+1 −1 test/util/unit_test.hpp
+6 −0 tools/build-apple-device.sh
+47 −19 tools/cmake/SpecialtyBuilds.cmake
+10 −6 tools/cmake/xcode.toolchain.cmake
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ add_subdirectory(cpprealm/internal/bridge/generator)

include(GetVersion)
# Configure source code to use right version number
configure_file(${RealmCxx_SOURCE_DIR}/src/cpprealm/internal/version_numbers.hpp.in ${RealmCxx_SOURCE_DIR}/src/cpprealm/internal/version_numbers.hpp)
install(FILES ${RealmCxx_SOURCE_DIR}/src/cpprealm/internal/version_numbers.hpp
configure_file(cpprealm/internal/version_numbers.hpp.in cpprealm/internal/version_numbers.hpp)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cpprealm/internal/version_numbers.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpprealm/internal
COMPONENT devel)

Expand Down
86 changes: 40 additions & 46 deletions src/cpprealm/analytics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
////////////////////////////////////////////////////////////////////////////

#include <cpprealm/analytics.hpp>
#include <external/json/json.hpp>

#if __APPLE__ || __MACH__
#include <CommonCrypto/CommonDigest.h>
Expand All @@ -38,11 +37,10 @@

#include <cpprealm/app.hpp>
#include <cpprealm/internal/generic_network_transport.hpp>
#include <cpprealm/internal/version_numbers.hpp>

Check failure on line 40 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / iOS Release, Xcode 15.0

'cpprealm/internal/version_numbers.hpp' file not found

Check failure on line 40 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / iOS Simulator Release, Xcode 15.0

'cpprealm/internal/version_numbers.hpp' file not found

Check failure on line 40 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / tvOS Simulator Release, Xcode 15.0

'cpprealm/internal/version_numbers.hpp' file not found

Check failure on line 40 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / tvOS Release, Xcode 15.0

'cpprealm/internal/version_numbers.hpp' file not found

Check failure on line 40 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Release, Xcode 15.0

'cpprealm/internal/version_numbers.hpp' file not found

Check failure on line 40 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS,variant=Mac Catalyst Release, Xcode 15.0

'cpprealm/internal/version_numbers.hpp' file not found

#include <realm/util/base64.hpp>

#include <sstream>

namespace realm {
#if __APPLE__ || __MACH__
// Wrapper for sysctl() that handles the memory management stuff
Expand Down Expand Up @@ -100,7 +98,7 @@
return hash_data(mac, 6);
}

std::string get_host_os_verion() {
std::string get_host_os_version() {
std::array<int, 2> mib = {{CTL_KERN, KERN_OSRELEASE}};
size_t buffer_size;
auto buffer = do_sysctl(&mib[0], mib.size(), &buffer_size);
Expand Down Expand Up @@ -160,7 +158,7 @@
return std::to_string(std::hash<std::string>{}(concatenated_mac_addresses));
}

std::string get_host_os_verion() {
std::string get_host_os_version() {
struct utsname host_info;
std::stringstream ss;
if (uname(&host_info) == 0) {
Expand Down Expand Up @@ -203,11 +201,11 @@

return false;
}
#elif _WIN32 || _WIN64
#elif _WIN32
std::string get_mac_address() {
return "unknown";
}
std::string get_host_os_verion() {
std::string get_host_os_version() {
return "unknown";
}
bool debugger_attached() {
Expand All @@ -217,7 +215,7 @@
std::string get_mac_address() {
return "unknown";
}
std::string get_host_os_verion() {
std::string get_host_os_version() {
return "unknown"
}
bool debugger_attached() {
Expand All @@ -231,59 +229,55 @@
#endif
if (!debugger_attached() || getenv("REALM_DISABLE_ANALYTICS"))
return;
std::string os_name;
#ifdef _WIN32
os_name = "Windows 32-bit";
#elif _WIN64
os_name = "Windows 64-bit";
#define OS_NAME "Windows";
#elif __APPLE__ || __MACH__
os_name = "macOS";
#define OS_NAME "macOS";
#elif __linux__
os_name = "Linux";
#define OS_NAME "Linux";
#elif __FreeBSD__
os_name = "FreeBSD";
#define OS_NAME "FreeBSD";
#elif __unix || __unix__
os_name = "Unix";
#define OS_NAME "Unix";
#else
os_name = "Other";
#define OS_NAME "Other";
#endif

auto mac_address = get_mac_address();
nlohmann::json post_data{
{"event", "Run"},
{"properties", {{"token", "ce0fac19508f6c8f20066d345d360fd0"}, {"distinct_id", mac_address}, {"Anonymized MAC Address", mac_address}, {"Anonymized Bundle ID", "unknown"}, {"Binding", "cpp"},
#if __cplusplus >= 202002L
{"Language", "cpp20"},
#else
{"Language", "cpp17"},
#define STRINGIZE_DETAIL_(v) #v
#define STRINGIZE(v) STRINGIZE_DETAIL_(v)
auto post_payload = R"(
{
"event": "Run",
"properties": {
"token": "ce0fac19508f6c8f20066d345d360fd0",
"distinct_id": "%1",
"Anonymized MAC Address": "%1",
"Anonymized Bundle ID": "unknown",
"Binding": "cpp",)""\n"
#if __cplusplus == 202002L
R"("Language": "cpp20",)""\n"
#elif __cplusplus == 201703L
R"("Language": "cpp17",)""\n"
#endif
{"Realm Version", "0.0.0"},
{"Target OS Type", "unknown"},
"\"Realm Version\": \"" REALMCXX_VERSION_STRING "\",\n"
#if defined(__clang__)
{"Clang Version", __clang_version__},
{"Clang Major Version", __clang_major__},
"\"Clang Version\": \"" STRINGIZE(__clang_major__) "\",\n"
"\"Clang Minor Version\": \"" STRINGIZE(__clang_minor__) "\",\n"
#elif defined(__GNUC__) || defined(__GNUG__)
{"GCC Version", __GNUC__},
{"GCC Minor Version", __GNUC_MINOR__},
"\"GCC Version\": \"" STRINGIZE(__GNUC__) "\",\n"
"\"GCC Minor Version\": \"" STRINGIZE(__GNUC_MINOR__) "\",\n"
#endif
{"Host OS Type", os_name},
{"Host OS Version", get_host_os_verion()}}}};

std::stringstream json_ss;
json_ss << post_data;
auto json_str = json_ss.str();
"\"Host OS Type\": \"" OS_NAME "\",\n"

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Sync Debug (preset macos, Xcode 15.0)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / Linux Debug (clang 15)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / Linux Release (clang 15)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Sync Debug (preset default, Xcode 15.0)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Debug (preset macos, Xcode 15.0)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Alpha Debug (preset default, Xcode 15.0)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Alpha Debug (preset macos, Xcode 15.0)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Debug (preset default, Xcode 15.0)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Debug (preset default, Xcode 13.1)

expression result unused [-Wunused-value]

Check warning on line 270 in src/cpprealm/analytics.cpp

View workflow job for this annotation

GitHub Actions / macOS Debug (preset macos, Xcode 13.1)

expression result unused [-Wunused-value]
R"("Host OS Version": "%2")""\n"
"}}";
auto json_str = util::format(post_payload, get_mac_address(), get_host_os_version());
auto transport = std::make_unique<internal::DefaultTransport>();

std::vector<char> buffer;
buffer.resize(5000);
realm::util::base64_encode(json_str.c_str(), json_str.size(),
buffer.data(), buffer.size());

size_t s = 0;
while (buffer[s] != '\0') {
s++;
}
buffer.resize(s);
buffer.resize(util::base64_encoded_size(json_str.size()));
auto encoded_size = util::base64_encode(json_str.c_str(), json_str.size(),
buffer.data(), buffer.size());
buffer.resize(encoded_size);

auto base64_str = std::string(buffer.begin(), buffer.end());
app::Request request;
Expand Down
3 changes: 3 additions & 0 deletions src/cpprealm/internal/bridge/generator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ endforeach()

configure_file(bridge_type_info_generator.cpp.in bridge_type_info_generator.cpp)
add_library(BridgeTypeInfoGenerator STATIC ${CMAKE_CURRENT_BINARY_DIR}/bridge_type_info_generator.cpp)
set_target_properties(BridgeTypeInfoGenerator PROPERTIES
INTERPROCEDURAL_OPTIMIZATION OFF
)

if(MSVC)
target_compile_options(BridgeTypeInfoGenerator PRIVATE /O0)
Expand Down
2 changes: 1 addition & 1 deletion src/cpprealm/sdk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
#include <cpprealm/persisted_uuid.hpp>
#include <cpprealm/persisted_object_id.hpp>
#include <cpprealm/persisted_decimal128.hpp>
#include <cpprealm/results.hpp>
#endif

#include <cpprealm/schema.hpp>
#include <cpprealm/results.hpp>
#include <cpprealm/notifications.hpp>
#include <cpprealm/asymmetric_object.hpp>
#include <cpprealm/object.hpp>
Expand Down
Loading