Skip to content

Commit

Permalink
Move scripts to scripts folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi committed May 15, 2024
1 parent 2d0a52f commit 952b1ff
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .ado/jobs/build-test-rntester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
- task: ShellScript@2
displayName: 'Setup packager and WebSocket test server'
inputs:
scriptPath: '.ado/ado-test-setup.sh'
scriptPath: '.ado/scripts/ado-test-setup.sh'
disableAutoCwd: true
cwd: ''

Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
- task: ShellScript@2
displayName: 'Cleanup packager and WebSocket test server'
inputs:
scriptPath: '.ado/ado-test-cleanup.sh'
scriptPath: '.ado/scripts/ado-test-cleanup.sh'
disableAutoCwd: true
cwd: ''
condition: always()
File renamed without changes.
File renamed without changes.
80 changes: 80 additions & 0 deletions .ado/scripts/xcodebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash
set -eox pipefail

workspace=$1
action=$2
shift 2

platform=$(grep -o '\w\+/ReactTestApp.xcodeproj' "$workspace/contents.xcworkspacedata")

if [[ $platform == ios/* ]]; then
if [[ $action == 'test' || $action == 'test-without-building' ]]; then
device=$(xcrun simctl list devices iPhone available)
re='iPhone [0-9]+ \(([-0-9A-Fa-f]+)\)'
[[ $device =~ $re ]] || exit 1
shift || true
destination="-destination \"platform=iOS Simulator,id=${BASH_REMATCH[1]}\""
else
destination='-destination "generic/platform=iOS Simulator"'
fi

skip_testing='-skip-testing:ReactTestAppTests/ReactNativePerformanceTests'
elif [[ $platform == macos/* ]]; then
destination=''
skip_testing=''
elif [[ $platform == visionos/* ]]; then
if [[ $action == 'test' || $action == 'test-without-building' ]]; then
device=$(xcrun simctl list devices visionOS available)
re='Apple Vision Pro \(([-0-9A-Fa-f]+)\)'
[[ $device =~ $re ]] || exit 1
shift || true
destination="-destination \"platform=visionOS Simulator,id=${BASH_REMATCH[1]}\""
else
destination='-destination "generic/platform=visionOS Simulator"'
fi

skip_testing='-skip-testing:ReactTestAppTests/ReactNativePerformanceTests'
else
echo "Cannot detect platform: $workspace"
exit 1
fi

build_cmd=$(
echo xcodebuild \
-workspace "$workspace" \
-scheme ReactTestApp \
"$destination" \
-derivedDataPath $(dirname $workspace)/build \
"$skip_testing" \
CODE_SIGNING_ALLOWED=NO \
COMPILER_INDEX_STORE_ENABLE=NO \
"$action" \
"$@" \
)

if [[ "$CCACHE_DISABLE" != "1" ]]; then
if ! command -v ccache 1> /dev/null; then
brew install ccache
fi

CCACHE_HOME=$(dirname $(dirname $(which ccache)))/opt/ccache

export CCACHE_DIR="$(git rev-parse --show-toplevel)/.ccache"

export CC="${CCACHE_HOME}/libexec/clang"
export CXX="${CCACHE_HOME}/libexec/clang++"
export CMAKE_C_COMPILER_LAUNCHER=$(which ccache)
export CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)

ccache --zero-stats 1> /dev/null
fi
if ! command -v xcbeautify 1> /dev/null; then
brew install xcbeautify
fi

eval "$build_cmd" | xcbeautify

if [[ "$CCACHE_DISABLE" != "1" ]]; then
ccache --show-stats --verbose
fi

0 comments on commit 952b1ff

Please sign in to comment.