Skip to content

Commit

Permalink
⚙️ Chore: Update Build-Relayed Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Dec 16, 2024
1 parent 75b8672 commit fe3ce6e
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 119 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"reopen:ios": "yarn run close:ios ; yarn run open:ios",
"build": "yarn run build:js ; yarn run build:ios",
"build:js": "yarn run lint ; yarn run lint:circular-dep ; yarn run typescript ; yarn run bob build",
"build:ios": "cd ./example/ios ; BUILD_INFO=$(xcodebuild -project ./*.xcodeproj -showBuildSettings -list -json | tr -d ' ' | tr -d '\n') ; SCHEME_NAME=$(node -pe 'JSON.parse(process.argv[1]).project.schemes[0]' $BUILD_INFO) ; xcodebuild -workspace *.xcworkspace -scheme $SCHEME_NAME -destination 'generic/platform=iOS' clean build",
"build:ios": "sh ./scripts/build-ios.sh",
"build:ios-release": "sh ./scripts/build-ios.sh Release",
"build:update-version": "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | sed 's/-.*//') ; cd example/ios ; agvtool new-marketing-version $PACKAGE_VERSION ; xcrun agvtool next-version -all ; cd ../..",
"build:ios-info": "cd ./example/ios ; xcodebuild -project ./*.xcodeproj -showBuildSettings -list ; xcodebuild -project ./*.xcodeproj -showBuildSettings",
"run:release": "cd example && npx react-native run-ios --configuration Release",
Expand All @@ -69,7 +70,7 @@
"initialize:js": "yarn install ; cd example ; yarn install ; cd ..",
"initialize:reset": "npm run nuke:all ; yarn ; npm run initialize",
"test-build:all": "sh ./scripts/test-builds.sh",
"test-build:all-quick": "sh ./scripts/test-builds-quick.sh"
"test-build:all-quick": "sh ./scripts/test-builds.sh quick"
},
"keywords": [
"react-native",
Expand Down
25 changes: 25 additions & 0 deletions scripts/build-ios.sh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

BUILD_CONFIG="${1:-DEBUG}"

cd ./example/ios

BUILD_INFO=$(
xcodebuild \
-project ./*.xcodeproj \
-showBuildSettings -list -json | tr -d ' ' | tr -d '\n'
)

SCHEME_NAME=$(
node -pe 'JSON.parse(process.argv[1]).project.schemes[0]' $BUILD_INFO
)
echo "Starting build..."
echo "Configuration: $BUILD_CONFIG"
echo "Scheme: $SCHEME_NAME"

xcodebuild \
-workspace *.xcworkspace \
-configuration Release \
-scheme $SCHEME_NAME \
-destination 'generic/platform=iOS' \
clean build
66 changes: 0 additions & 66 deletions scripts/test-builds-quick.sh

This file was deleted.

165 changes: 114 additions & 51 deletions scripts/test-builds.sh
Original file line number Diff line number Diff line change
@@ -1,76 +1,139 @@
#!/bin/bash

NEW_ARCH_STATIC=PENDING
OLD_ARCH_STATIC=PENDING
NEW_ARCH_DYNAMIC=PENDING
# value: either "quick" or "not-quick"
# default: "not-quick"
BUILD_MODE="${1:-not-quick}"

NEW_ARCH_STATIC_DEBUG=PENDING
OLD_ARCH_STATIC_DEBUG=PENDING
NEW_ARCH_STATIC_RELEASE=PENDING
OLD_ARCH_STATIC_RELEASE=PENDING
# NEW_ARCH_DYNAMIC=PENDING
OLD_ARCH_DYNAMIC=PENDING

log_build_status() {
echo "\n\n\nBUILD RESULTS...";
echo "Build - NEW_ARCH_STATIC: ${NEW_ARCH_STATIC}"
echo "Build - OLD_ARCH_STATIC: ${OLD_ARCH_STATIC}"
echo "Build - NEW_ARCH_DYNAMIC: ${NEW_ARCH_DYNAMIC}"
echo "\n\n\nBUILD RESULTS..."
echo "BUILD_MODE: $BUILD_MODE"
echo "Build - NEW_ARCH_STATIC_DEBUG: ${NEW_ARCH_STATIC_DEBUG}"
echo "Build - OLD_ARCH_STATIC_DEBUG: ${OLD_ARCH_STATIC_DEBUG}"
echo "Build - NEW_ARCH_STATIC_RELEASE: ${NEW_ARCH_STATIC_RELEASE}"
echo "Build - OLD_ARCH_STATIC_RELEASE: ${OLD_ARCH_STATIC_RELEASE}"
# echo "Build - NEW_ARCH_DYNAMIC: ${NEW_ARCH_DYNAMIC}"
echo "Build - OLD_ARCH_DYNAMIC: ${OLD_ARCH_DYNAMIC}"
echo "\n\n"
}

clear_cache(){
echo '\nclearing pods + derived data...'
yarn run nuke:example-pods
yarn run nuke:derived-data
echo "\nBUILD_MODE: $BUILD_MODE"

# Check the value of BUILD_MODE
if [ "$BUILD_MODE" = "quick" ]; then
echo "Skipping cleanup..."

elif [ "$BUILD_MODE" = "not-quick" ]; then
echo 'clearing pods + derived data...'
yarn run nuke:example-pods
yarn run nuke:derived-data
else
echo "Invalid BUILD_MODE. Please use 'quick' or 'not-quick'."
fi
}

log_build_status;
clear_cache;
build_A1(){
log_build_status
clear_cache;

echo '\n\nBuild - new-arch (fabric) + static: Begin...\n'
yarn run pod-install:new-static
yarn run build:ios ;
echo '\n\nBuild - new-arch (fabric) + static, debug: Begin...\n'
yarn run pod-install:new-static
yarn run build:ios ;

if [ $? -eq 0 ]; then
NEW_ARCH_STATIC=SUCCESS;
else
NEW_ARCH_STATIC=FAILED;
fi;
if [ $? -eq 0 ]; then
NEW_ARCH_STATIC_DEBUG=SUCCESS;
else
NEW_ARCH_STATIC_DEBUG=FAILED;
fi
}

build_A2(){
log_build_status
clear_cache

log_build_status
clear_cache
echo '\n\nBuild - old-arch (paper) + static, debug: Begin...'
yarn run pod-install:old-static
yarn run build:ios ;

echo '\n\nBuild - old-arch (paper) + static: Begin...'
yarn run pod-install:old-static
yarn run build:ios ;
if [ $? -eq 0 ]; then
OLD_ARCH_STATIC_DEBUG=SUCCESS;
else
OLD_ARCH_STATIC_DEBUG=FAILED;
fi
}

if [ $? -eq 0 ]; then
OLD_ARCH_STATIC=SUCCESS;
else
OLD_ARCH_STATIC=FAILED;
fi;
build_B1(){
log_build_status
clear_cache

log_build_status
clear_cache
echo '\n\nBuild - new-arch (fabric) + static, release: Begin...'
yarn run pod-install:new-static
yarn run build:ios-release ;

echo '\nBuild - new-arch (fabric) + dynamic: Begin...\n'
yarn run pod-install:new-dynamic
yarn run build:ios ;
if [ $? -eq 0 ]; then
NEW_ARCH_STATIC_RELEASE=SUCCESS;
else
NEW_ARCH_STATIC_RELEASE=FAILED;
fi
}

if [ $? -eq 0 ]; then
NEW_ARCH_DYNAMIC=SUCCESS;
else
NEW_ARCH_DYNAMIC=FAILED;
fi;
build_B2(){
log_build_status
clear_cache

log_build_status;
clear_cache;
echo '\n\nBuild - old-arch (paper) + static, release: Begin...'
yarn run pod-install:old-static
yarn run build:ios-release ;

echo 'Build - old-arch (paper) + static: Begin...'
yarn run pod-install:old-dynamic
yarn run build:ios ;
if [ $? -eq 0 ]; then
OLD_ARCH_STATIC_RELEASE=SUCCESS;
else
OLD_ARCH_STATIC_RELEASE=FAILED;
fi
}

# build_C1(){
# log_build_status
# clear_cache

# echo '\nBuild - new-arch (fabric) + dynamic: Begin...\n'
# yarn run pod-install:new-dynamic
# yarn run build:ios ;

# if [ $? -eq 0 ]; then
# NEW_ARCH_DYNAMIC=SUCCESS;
# else
# NEW_ARCH_DYNAMIC=FAILED;
# fi
# }

build_C2(){
log_build_status;
clear_cache;

echo 'Build - old-arch (paper) + static: Begin...'
yarn run pod-install:old-dynamic
yarn run build:ios ;

if [ $? -eq 0 ]; then
OLD_ARCH_DYNAMIC=SUCCESS;
else
OLD_ARCH_DYNAMIC=FAILED;
fi
}

if [ $? -eq 0 ]; then
OLD_ARCH_DYNAMIC=SUCCESS;
else
OLD_ARCH_DYNAMIC=FAILED;
fi;
build_A1
build_A2
build_B1
build_B2
build_C2

echo "\n\n All Builds Completed..."
log_build_status;
log_build_status

0 comments on commit fe3ce6e

Please sign in to comment.