From 812a951aba929102ff1cde34c8ef88963b2aede4 Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Mon, 21 Aug 2023 17:16:42 +1000 Subject: [PATCH] Added the group namespaces and added better build script error handling --- Scripts/build_libSession_util.sh | 19 +++++++++++++++++-- .../Pollers/ClosedGroupPoller.swift | 4 +++- .../Configs/ConfigGroupInfoSpec.swift | 3 +++ SessionSnodeKit/Types/SnodeAPINamespace.swift | 10 +++++++--- 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 SessionMessagingKitTests/LibSessionUtil/Configs/ConfigGroupInfoSpec.swift diff --git a/Scripts/build_libSession_util.sh b/Scripts/build_libSession_util.sh index c32606503..37cbaee77 100755 --- a/Scripts/build_libSession_util.sh +++ b/Scripts/build_libSession_util.sh @@ -196,8 +196,23 @@ for i in "${!TARGET_ARCHS[@]}"; do -DENABLE_BITCODE=$ENABLE_BITCODE if [ $? -ne 0 ]; then - LAST_OUTPUT=$(tail -n 4 "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log" | head -n 1) - echo_message "error: $LAST_OUTPUT" + ALL_ERROR_LINES=($(grep -n "error:" "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log" | cut -d ":" -f 1)) + + for e in "${!ALL_ERROR_LINES[@]}"; do + error_line="${ALL_ERROR_LINES[$e]}" + error=$(sed "${error_line}q;d" "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log") + + # If it was a CMake Error then the actual error will be on the next line so we want to append that info + if [[ $error == *'CMake Error'* ]]; then + actual_error_line=$((error_line + 1)) + error="${error}$(sed "${actual_error_line}q;d" "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log")" + fi + + # Exclude the 'ALL_ERROR_LINES' line and the 'grep' line + if [[ ! $error == *'grep -n "error'* ]] && [[ ! $error == *'grep -n error'* ]]; then + echo_message "error: $error" + fi + done exit 1 fi done diff --git a/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift b/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift index c4c77c7fa..b57002372 100644 --- a/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift +++ b/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift @@ -7,7 +7,9 @@ import SessionSnodeKit import SessionUtilitiesKit public final class ClosedGroupPoller: Poller { - public static var namespaces: [SnodeAPI.Namespace] = [.legacyClosedGroup] + public static var namespaces: [SnodeAPI.Namespace] = [ + .legacyClosedGroup, .default, .configGroupInfo, .configGroupMembers, .configGroupKeys + ] // MARK: - Settings diff --git a/SessionMessagingKitTests/LibSessionUtil/Configs/ConfigGroupInfoSpec.swift b/SessionMessagingKitTests/LibSessionUtil/Configs/ConfigGroupInfoSpec.swift new file mode 100644 index 000000000..04969735d --- /dev/null +++ b/SessionMessagingKitTests/LibSessionUtil/Configs/ConfigGroupInfoSpec.swift @@ -0,0 +1,3 @@ +// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved. + +import Foundation diff --git a/SessionSnodeKit/Types/SnodeAPINamespace.swift b/SessionSnodeKit/Types/SnodeAPINamespace.swift index 73dd9182d..6485c3811 100644 --- a/SessionSnodeKit/Types/SnodeAPINamespace.swift +++ b/SessionSnodeKit/Types/SnodeAPINamespace.swift @@ -10,7 +10,9 @@ public extension SnodeAPI { case configContacts = 3 case configConvoInfoVolatile = 4 case configUserGroups = 5 - case configClosedGroupInfo = 11 + case configGroupInfo = 11 + case configGroupMembers = 12 + case configGroupKeys = 13 case legacyClosedGroup = -10 @@ -52,7 +54,8 @@ public extension SnodeAPI { case .configUserProfile, .configContacts, .configConvoInfoVolatile, .configUserGroups, - .configClosedGroupInfo, .all: + .configGroupInfo, .configGroupMembers, .configGroupKeys, + .all: return false } } @@ -88,7 +91,8 @@ public extension SnodeAPI { case .configUserProfile, .configContacts, .configConvoInfoVolatile, .configUserGroups, - .configClosedGroupInfo, .all: + .configGroupInfo, .configGroupMembers, .configGroupKeys, + .all: return 1 } }