Skip to content

Commit 3338635

Browse files
i2h3claude
andcommitted
fix(macOS): disable index store for nested xcodebuild invocations
The Xcode scheme drives the developer build through a legacy target with passBuildSettingsInEnvironment, so the outer build exports its settings β€” COMPILER_INDEX_STORE_ENABLE=Default among them β€” into Craft.sh and on down to the xcodebuild invocations that build the Finder Sync and File Provider extensions, which pick them up as setting overrides. INDEX_DATA_STORE_DIR is not exported with them, and those invocations override SYMROOT without a derived data path, so in Debug the index store is enabled with nowhere to write and clang is handed a valueless -index-store-path. It swallows the argument behind it, which for the Realm package is the include path carrying realm-core's headers, and the extension fails to build on RLMUtil.hpp:23:9: fatal error: 'realm/array.hpp' file not found Release builds never saw this: COMPILER_INDEX_STORE_ENABLE=Default leaves the index store off there. Pass COMPILER_INDEX_STORE_ENABLE=NO on the xcodebuild command lines, where it outranks the inherited environment, and drop the index store variables in Craft.sh so a build started from the scheme sees the same environment as one started from a terminal. Signed-off-by: Iva Horn <iva.horn@nextcloud.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent c726b86 commit 3338635

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

β€Žshell_integration/MacOSX/CMakeLists.txtβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ if(APPLE)
2424
# hardcoded default in Build.xcconfig. A branded build signed by a different team would
2525
# then point the extension at an app group it does not own, while the client β€” which takes
2626
# the team from CMake β€” points at the right one, and the two could never reach each other.
27+
# COMPILER_INDEX_STORE_ENABLE has to be forced off: the Xcode scheme drives these builds
28+
# through a legacy target with passBuildSettingsInEnvironment, so every setting of the outer
29+
# build β€” including COMPILER_INDEX_STORE_ENABLE=Default β€” is exported into the environment
30+
# and picked up here as a setting override. INDEX_DATA_STORE_DIR is not exported with it, and
31+
# these invocations override SYMROOT without a derived data path, so in Debug the index store
32+
# is enabled with nowhere to write: clang is then handed a bare "-index-store-path" that eats
33+
# the following argument. For the Realm package that argument is the include path carrying
34+
# realm-core's headers, and the extension fails to build on 'realm/array.hpp' file not found.
2735
add_custom_target( mac_overlayplugin ALL
2836
xcodebuild
2937
ARCHS=${CMAKE_OSX_ARCHITECTURES}
@@ -32,6 +40,7 @@ if(APPLE)
3240
-target FinderSyncExt
3341
-configuration ${XCODE_TARGET_CONFIGURATION}
3442
"SYMROOT=${CMAKE_CURRENT_BINARY_DIR}"
43+
"COMPILER_INDEX_STORE_ENABLE=NO"
3544
"MARKETING_VERSION=${MIRALL_VERSION}"
3645
"CURRENT_PROJECT_VERSION=${MIRALL_VERSION_BUILD}"
3746
"OC_OEM_SHARE_ICNS=${OC_OEM_SHARE_ICNS}"
@@ -55,6 +64,7 @@ if(APPLE)
5564
-target ${OSX_FINDERSYNC_BROKER_TARGET}
5665
-configuration ${XCODE_TARGET_CONFIGURATION}
5766
"SYMROOT=${CMAKE_CURRENT_BINARY_DIR}"
67+
"COMPILER_INDEX_STORE_ENABLE=NO"
5868
"MARKETING_VERSION=${MIRALL_VERSION}"
5969
"CURRENT_PROJECT_VERSION=${MIRALL_VERSION_BUILD}"
6070
"OC_APPLICATION_NAME=${APPLICATION_NAME}"
@@ -72,6 +82,7 @@ if(APPLE)
7282
-target FileProviderExt
7383
-configuration ${XCODE_TARGET_CONFIGURATION}
7484
"SYMROOT=${CMAKE_CURRENT_BINARY_DIR}"
85+
"COMPILER_INDEX_STORE_ENABLE=NO"
7586
"MARKETING_VERSION=${MIRALL_VERSION}"
7687
"CURRENT_PROJECT_VERSION=${MIRALL_VERSION_BUILD}"
7788
"OC_APPLICATION_EXECUTABLE_NAME=${APPLICATION_EXECUTABLE}"
@@ -90,6 +101,7 @@ if(APPLE)
90101
-target FileProviderUIExt
91102
-configuration ${XCODE_TARGET_CONFIGURATION}
92103
"SYMROOT=${CMAKE_CURRENT_BINARY_DIR}"
104+
"COMPILER_INDEX_STORE_ENABLE=NO"
93105
"MARKETING_VERSION=${MIRALL_VERSION}"
94106
"CURRENT_PROJECT_VERSION=${MIRALL_VERSION_BUILD}"
95107
"OC_APPLICATION_EXECUTABLE_NAME=${APPLICATION_EXECUTABLE}"

β€Žshell_integration/MacOSX/NextcloudIntegration/NextcloudDev/Craft.shβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ else
2929
exit 1
3030
fi
3131

32+
# Xcode exports the settings of the build that started this script into the environment, and
33+
# every nested xcodebuild down the line takes them as setting overrides. The index store ones
34+
# travel without INDEX_DATA_STORE_DIR, which makes the extension builds pass clang a bare
35+
# -index-store-path that swallows the argument behind it. Drop them so a build started from the
36+
# scheme sees the same environment as one started from a terminal.
37+
unset COMPILER_INDEX_STORE_ENABLE
38+
unset INDEX_ENABLE_DATA_STORE
39+
unset INDEX_DATA_STORE_DIR
40+
unset INDEX_ENABLE_OPTIMIZATION_LEVEL_OVERRIDE
41+
unset INDEX_STORE_COMPRESS
42+
unset INDEX_STORE_ONLY_PROJECT_FILES
43+
3244
swift run mac-crafter \
3345
--build-path="$DESKTOP_CLIENT_PROJECT_ROOT/build" \
3446
--product-path="/Applications" \

0 commit comments

Comments
Β (0)