Skip to content

Commit b040339

Browse files
authored
Merge pull request #682 from session-foundation/dev
Release 2.15.0
2 parents 7985e8c + f076e37 commit b040339

723 files changed

Lines changed: 94077 additions & 53248 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.drone.jsonnet

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ local version_info = {
77
environment: { LANG: 'en_US.UTF-8' },
88
commands: [
99
'git --version',
10-
'xcodebuild -version',
1110
'xcbeautify --version',
12-
'xcresultparser --version'
11+
'xcresultparser --version',
12+
'xcodebuild -version',
13+
'xcodebuild -showsdks'
1314
],
1415
};
1516

@@ -150,7 +151,7 @@ local clean_up_old_test_sims_on_commit_trigger = {
150151
{
151152
name: 'Build',
152153
commands: [
153-
'./Scripts/build_ci.sh archive -sdk iphonesimulator -archivePath ./build/Session_sim.xcarchive -destination "generic/platform=iOS Simulator"',
154+
'./Scripts/build_ci.sh archive -sdk iphonesimulator -archivePath ./build/Session_sim.xcarchive -destination "generic/platform=iOS Simulator" DEBUG_INFORMATION_FORMAT=dwarf',
154155
],
155156
depends_on: [
156157
'Reset SPM Cache if Needed',

Scripts/build_ci.sh

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,26 @@ if [ $# -lt 1 ]; then
99
exit 1
1010
fi
1111

12+
COMMIT_MSG="$(git log -1 --format='%s' HEAD)"
13+
echo "--- Log Mode Detection ---"
14+
echo "Latest commit message: '${COMMIT_MSG}'"
15+
if echo "$COMMIT_MSG" | grep -iq '^\[raw\]'; then
16+
USE_RAW_LOGS=1
17+
echo "⚠️ [raw] commit prefix detected – xcbeautify and xcresultparser are DISABLED."
18+
echo " Raw xcodebuild output will be emitted directly."
19+
echo ""
20+
else
21+
USE_RAW_LOGS=0
22+
fi
23+
24+
echo "--- SDK Version ---"
25+
SDK_VERSION="$(xcrun --sdk iphoneos --show-sdk-version 2>/dev/null || echo "unknown")"
26+
SDK_PATH="$(xcrun --sdk iphoneos --show-sdk-path 2>/dev/null || echo "unknown")"
27+
echo "iOS SDK version : ${SDK_VERSION}"
28+
echo "iOS SDK path : ${SDK_PATH}"
29+
echo ""
30+
31+
1232
MODE="$1"
1333
shift
1434

@@ -31,14 +51,23 @@ if [[ "$MODE" == "test" ]]; then
3151

3252
xcodebuild_exit_code=0
3353

34-
# We wrap the pipeline in parentheses to capture the exit code of xcodebuild
35-
# which is at PIPESTATUS[0]. We do not use tee to a file here, as the complexity
36-
# of reading back the UUID is not necessary if we pass it via args.
37-
(
38-
NSUnbufferedIO=YES xcodebuild test \
39-
"${COMMON_ARGS[@]}" \
40-
"${UNIQUE_ARGS[@]}" 2>&1 | tee "$XCODEBUILD_RAW_LOG" | xcbeautify --is-ci
41-
) || xcodebuild_exit_code=${PIPESTATUS[0]}
54+
if [[ "$USE_RAW_LOGS" -eq 1 ]]; then
55+
# Raw mode: pipe directly to tee only, no xcbeautify
56+
(
57+
NSUnbufferedIO=YES xcodebuild test \
58+
"${COMMON_ARGS[@]}" \
59+
"${UNIQUE_ARGS[@]}" 2>&1 | tee "$XCODEBUILD_RAW_LOG"
60+
) || xcodebuild_exit_code=${PIPESTATUS[0]}
61+
else
62+
# We wrap the pipeline in parentheses to capture the exit code of xcodebuild
63+
# which is at PIPESTATUS[0]. We do not use tee to a file here, as the complexity
64+
# of reading back the UUID is not necessary if we pass it via args.
65+
(
66+
NSUnbufferedIO=YES xcodebuild test \
67+
"${COMMON_ARGS[@]}" \
68+
"${UNIQUE_ARGS[@]}" 2>&1 | tee "$XCODEBUILD_RAW_LOG" | xcbeautify --is-ci
69+
) || xcodebuild_exit_code=${PIPESTATUS[0]}
70+
fi
4271

4372
echo ""
4473
echo "--- xcodebuild finished with exit code: $xcodebuild_exit_code ---"
@@ -51,6 +80,22 @@ if [[ "$MODE" == "test" ]]; then
5180
echo ""
5281
echo "🔴 Build failed"
5382
echo "----------------------------------------------------"
83+
84+
if [[ "$USE_RAW_LOGS" -eq 1 ]]; then
85+
# Raw mode: skip xcresultparser entirely, show grep summary + tail
86+
echo "Skipping xcresultparser (raw mode). Scanning raw log for errors..."
87+
echo ""
88+
echo "--- Matched Error Lines ---"
89+
grep -En --color=always \
90+
'(:[0-9]+:[0-9]+: error:)|(ld: error:)|(error: linker command failed)|(PhaseScriptExecution)|(rsync error:)|(warning: .* error)|(fatal error:)' \
91+
"$XCODEBUILD_RAW_LOG" || echo "(no lines matched error patterns)"
92+
echo ""
93+
echo "--- Last 40 Lines of Raw Log ---"
94+
tail -n 40 "$XCODEBUILD_RAW_LOG"
95+
echo "----------------------------------------------------"
96+
exit "$xcodebuild_exit_code"
97+
fi
98+
5499
echo "Checking for test failures in xcresult bundle..."
55100

56101
xcresultparser --output-format cli --no-test-result --coverage-report-format targets --coverage ./build/artifacts/testResults.xcresult
@@ -68,6 +113,9 @@ if [[ "$MODE" == "test" ]]; then
68113
else
69114
echo "No test failures found in results. Failure was likely a build error."
70115
echo ""
116+
echo "💡 Tip: if no errors are visible above, retry with a [raw] commit prefix"
117+
echo " to bypass xcresultparser and see unfiltered xcodebuild output."
118+
echo ""
71119

72120
echo "--- Summary of Potential Build Errors ---"
73121
grep -E --color=always '(:[0-9]+:[0-9]+: error:)|(ld: error:)|(error: linker command failed)|(PhaseScriptExecution)|(rsync error:)' "$XCODEBUILD_RAW_LOG" || true
@@ -85,9 +133,16 @@ elif [[ "$MODE" == "archive" ]]; then
85133

86134
echo "--- Running Simulator Archive Build (App_Store_Release) ---"
87135

88-
NSUnbufferedIO=YES xcodebuild archive \
89-
"${COMMON_ARGS[@]}" \
90-
"${UNIQUE_ARGS[@]}" 2>&1 | xcbeautify --is-ci
136+
if [[ "$USE_RAW_LOGS" -eq 1 ]]; then
137+
# Raw mode: no xcbeautify
138+
NSUnbufferedIO=YES xcodebuild archive \
139+
"${COMMON_ARGS[@]}" \
140+
"${UNIQUE_ARGS[@]}" 2>&1
141+
else
142+
NSUnbufferedIO=YES xcodebuild archive \
143+
"${COMMON_ARGS[@]}" \
144+
"${UNIQUE_ARGS[@]}" 2>&1 | xcbeautify --is-ci
145+
fi
91146

92147
else
93148
echo "Error: Invalid mode '$MODE' specified. Use 'test' or 'archive'."

Scripts/build_libSession_util.sh

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ COMPILE_DIR="${TARGET_BUILD_DIR}/LibSessionUtil"
1212
INDEX_DIR="${DERIVED_DATA_PATH}/Index.noindex/Build/Products/Debug-${PLATFORM_NAME}"
1313
LAST_SUCCESSFUL_HASH_FILE="${TARGET_BUILD_DIR}/last_successful_source_tree.hash.log"
1414
LAST_BUILT_FRAMEWORK_SLICE_DIR_FILE="${TARGET_BUILD_DIR}/last_built_framework_slice_dir.log"
15+
TIMESTAMP_FILE="${TARGET_BUILD_DIR}/LibSessionUtil_BuildCache/libsession_util_built.timestamp"
1516

1617
# Modify the platform detection to handle archive builds
1718
if [ "${ACTION}" = "install" ] || [ "${CONFIGURATION}" = "Release" ]; then
@@ -44,14 +45,14 @@ sync_headers() {
4445
for dest in "${destinations[@]}"; do
4546
if [ -n "$dest" ]; then
4647
local unique_id=$(uuidgen)
47-
local temp_dest="${BUILD_DIR}/headers_staging_$(unique_id)"
48+
local temp_dest="${BUILD_DIR}/headers_staging_${unique_id}"
4849
rm -rf "$temp_dest"
4950
mkdir -p "$temp_dest"
5051

5152
rsync -rtc --delete --exclude='.DS_Store' "${source_dir}/" "$temp_dest/"
5253

5354
# Atomically move the old directory out of the way
54-
local old_dest="${BUILD_DIR}/headers_old_$(unique_id)"
55+
local old_dest="${BUILD_DIR}/headers_old_${unique_id}"
5556
if [ -d "$dest" ]; then
5657
mv "$dest" "$old_dest"
5758
fi
@@ -71,6 +72,27 @@ sync_headers() {
7172
done
7273
}
7374

75+
# Robustly removes a directory, first clearing any immutable flags (work around Xcode's indexer file locking)
76+
remove_locked_dir() {
77+
local dir_to_remove="$1"
78+
if [ -d "${dir_to_remove}" ]; then
79+
echo "- Unlocking and removing ${dir_to_remove}"
80+
chflags -R nouchg "${dir_to_remove}" &>/dev/null || true
81+
rm -rf "${dir_to_remove}"
82+
fi
83+
}
84+
85+
# Modify the platform detection to handle archive builds
86+
if [ "${ACTION}" = "install" ] || [ "${CONFIGURATION}" = "Release" ]; then
87+
# Archive builds typically use 'install' action
88+
if [ -z "$PLATFORM_NAME" ]; then
89+
# During archive, PLATFORM_NAME might not be set correctly
90+
# Default to device build for archives
91+
PLATFORM_NAME="iphoneos"
92+
echo "Missing 'PLATFORM_NAME' value, manually set to ${PLATFORM_NAME}"
93+
fi
94+
fi
95+
7496
# Determine whether we want to build from source
7597
TARGET_ARCH_DIR=""
7698

@@ -86,7 +108,7 @@ fi
86108
if [ "${COMPILE_LIB_SESSION}" != "YES" ]; then
87109
echo "Using pre-packaged SessionUtil"
88110

89-
if [ "$CI" = "true" ] || [ "$DRONE" = "true" ]; then
111+
if [ "$CI" = "true" ] || [ "$DRONE" = "true" ]; then
90112
# In CI, Xcode's SPM integration is reliable. Skip manual header sync
91113
# to avoid the 'redefinition of module' error.
92114
echo "- CI environment detected, skipping manual header sync to rely on SPM"
@@ -98,6 +120,10 @@ if [ "${COMPILE_LIB_SESSION}" != "YES" ]; then
98120
# Create the placeholder in the FINAL products directory to satisfy dependency
99121
touch "${BUILT_PRODUCTS_DIR}/libsession-util.a"
100122

123+
# Create the timestamp file to satisfy Xcode's output file requirement
124+
mkdir -p "$(dirname "${TIMESTAMP_FILE}")"
125+
echo "Using SPM pre-built version at $(date)" > "${TIMESTAMP_FILE}"
126+
101127
echo "- Revert to SPM complete."
102128
exit 0
103129
fi
@@ -186,6 +212,7 @@ else
186212
fi
187213

188214
if [ "${REQUIRES_BUILD}" == 1 ]; then
215+
189216
# Import settings from XCode (defaulting values if not present)
190217
VALID_SIM_ARCHS=(arm64 x86_64)
191218
VALID_DEVICE_ARCHS=(arm64)
@@ -272,6 +299,8 @@ if [ "${REQUIRES_BUILD}" == 1 ]; then
272299
-DBUILD_TESTS=OFF \
273300
-DBUILD_STATIC_DEPS=ON \
274301
-DENABLE_VISIBILITY=ON \
302+
-DSROUTER_FULL=OFF \
303+
-DSROUTER_DAEMON=OFF \
275304
-DSUBMODULE_CHECK=$submodule_check \
276305
-DCMAKE_BUILD_TYPE=$build_type \
277306
-DLOCAL_MIRROR=https://oxen.rocks/deps
@@ -332,7 +361,7 @@ if [ "${REQUIRES_BUILD}" == 1 ]; then
332361
echo "- Saving successful build cache files"
333362
echo "${TARGET_ARCH_DIR}" > "${LAST_BUILT_FRAMEWORK_SLICE_DIR_FILE}"
334363
echo "${CURRENT_SOURCE_TREE_HASH}" > "${LAST_SUCCESSFUL_HASH_FILE}"
335-
364+
336365
echo "- Build complete"
337366
fi
338367

@@ -351,5 +380,9 @@ fi
351380
sync_headers "${COMPILE_DIR}/Headers/"
352381
echo "- Sync complete."
353382

383+
# Update the timestamp to indicate build completed
384+
mkdir -p "$(dirname "${TIMESTAMP_FILE}")"
385+
echo "Built from source at $(date)" > "${TIMESTAMP_FILE}"
386+
354387
# Output to XCode just so the output is good
355388
echo "LibSession is Ready"

Scripts/clean_up_old_test_simulators.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ yellow="\e[33;1m"
1515
blue="\e[34;1m"
1616
cyan="\e[36;1m"
1717

18-
if ! echo "${DRONE_COMMIT_MESSAGE:-}" | grep -q -F "$TRIGGER_PHRASE"; then
18+
if ! echo "${DRONE_COMMIT_MESSAGE:-}" | grep -iq -F "$TRIGGER_PHRASE"; then
1919
echo -e "\n${green}Trigger phrase '$TRIGGER_PHRASE' not found in commit message. Skipping old simulator cleanup.${reset}"
2020
exit 0
2121
else

Scripts/reset_spm_cache.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44

55
green="\e[32;1m"
66

7-
if echo "${DRONE_COMMIT_MESSAGE}" | grep -q -F "[Reset SPM]"; then
7+
if echo "${DRONE_COMMIT_MESSAGE}" | grep -iq -F "[Reset SPM]"; then
88
echo "Trigger phrase found in commit message. Clearing SPM caches..."
99

1010
echo "--> Clearing global SwiftPM caches..."

0 commit comments

Comments
 (0)