Skip to content

Commit

Permalink
simplify the build-maestro-ios-runner.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Sep 9, 2024
1 parent 86d08e6 commit cbcb24c
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions maestro-ios-xctest-runner/build-maestro-ios-runner.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

set -eu
set -euo pipefail

if [ "$(basename "$PWD")" != "maestro" ]; then
echo "This script must be run from the maestro root directory"
Expand All @@ -9,8 +9,10 @@ fi

## Build the UI test

rm -rf ./build/Products || exit 1
xcodebuild ARCHS="x86_64 arm64" \
rm -rf ./build/Products

xcodebuild \
ARCHS="x86_64 arm64" \
ONLY_ACTIVE_ARCH=NO \
-project ./maestro-ios-xctest-runner/maestro-driver-ios.xcodeproj \
-scheme maestro-driver-ios \
Expand All @@ -19,15 +21,24 @@ xcodebuild ARCHS="x86_64 arm64" \
-IDEBuildLocationStyle=Custom \
-IDECustomBuildLocationType=Absolute \
-IDECustomBuildProductsPath="$PWD/build/Products" \
build-for-testing || exit 1
build-for-testing

## Remove intermediates, output and copy runner in maestro-ios-driver
mv "$PWD"/build/Products/Debug-iphonesimulator/maestro-driver-iosUITests-Runner.app ./maestro-ios-driver/src/main/resources/maestro-driver-iosUITests-Runner.app || exit 1

mv "$PWD"/build/Products/Debug-iphonesimulator/maestro-driver-ios.app ./maestro-ios-driver/src/main/resources/maestro-driver-ios.app || exit 1
cp -r \
"$PWD/build/Products/Debug-iphonesimulator/maestro-driver-iosUITests-Runner.app" \
./maestro-ios-driver/src/main/resources/maestro-driver-iosUITests-Runner.app

cp -r \
"$PWD/build/Products/Debug-iphonesimulator/maestro-driver-ios.app" \
./maestro-ios-driver/src/main/resources/maestro-driver-ios.app

mv "$PWD"/build/Products/*.xctestrun ./maestro-ios-driver/src/main/resources/maestro-driver-ios-config.xctestrun || exit 1
cp -r \
"$PWD/build/Products/*.xctestrun" \
./maestro-ios-driver/src/main/resources/maestro-driver-ios-config.xctestrun

(cd ./maestro-ios-driver/src/main/resources && zip -r maestro-driver-iosUITests-Runner.zip ./maestro-driver-iosUITests-Runner.app) || exit 1
(cd ./maestro-ios-driver/src/main/resources && zip -r maestro-driver-ios.zip ./maestro-driver-ios.app) || exit 1
rm -r ./maestro-ios-driver/src/main/resources/*.app || exit 1
cd ./maestro-ios-driver/src/main/resources
zip -r maestro-driver-iosUITests-Runner.zip ./maestro-driver-iosUITests-Runner.app
zip -r maestro-driver-ios.zip ./maestro-driver-ios.app
rm -r ./*.app
cd -

0 comments on commit cbcb24c

Please sign in to comment.