From 03824f630b3059976ecf78b9c4ca256c06798bfa Mon Sep 17 00:00:00 2001 From: Asaf Korem Date: Sun, 25 Aug 2024 17:54:40 +0300 Subject: [PATCH] build(iOS): improve XCUITest build, remove unnecessary files. --- detox/scripts/build_xcuitest.ios.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/detox/scripts/build_xcuitest.ios.sh b/detox/scripts/build_xcuitest.ios.sh index 73ba8f3df3..7327f53e42 100755 --- a/detox/scripts/build_xcuitest.ios.sh +++ b/detox/scripts/build_xcuitest.ios.sh @@ -15,4 +15,20 @@ mkdir -p "${XCUITEST_OUTPUT_DIR}" # Build Simulator version -env -i bash -c "xcodebuild -project \"${XCODEPROJ}\" -scheme \"${PROJECT_NAME}\" -UseNewBuildSystem=\"YES\" -configuration \"${CONFIGURATION}\" -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath \"${XCUITEST_OUTPUT_DIR}\" build-for-testing -quiet" +XCUITEST_OUTPUT_DIR_TEMP = "${XCUITEST_OUTPUT_DIR}/Temp" + +mkdir -p "${XCUITEST_OUTPUT_DIR_TEMP}" + +env -i bash -c "xcodebuild -project \"${XCODEPROJ}\" -scheme \"${PROJECT_NAME}\" -UseNewBuildSystem=\"YES\" -configuration \"${CONFIGURATION}\" -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' -derivedDataPath \"${XCUITEST_OUTPUT_DIR_TEMP}\" build-for-testing -quiet" + +# Find the .xctestrun file inside the output directory, copy it, and remove the rest + +XCTESTRUN_FILE=$(find "${XCUITEST_OUTPUT_DIR_TEMP}" -name "*.xctestrun") + +# Copy the .xctestrun file to the output directory + +cp "${XCTESTRUN_FILE}" "${XCUITEST_OUTPUT_DIR}/Detox.xctestrun" + +# Remove the temp directory + +rm -fr "${XCUITEST_OUTPUT_DIR_TEMP}"