From fe3ce6ecb73407ffc746d11db5b0b8c1c16e71a8 Mon Sep 17 00:00:00 2001 From: Dominic Go Date: Mon, 16 Dec 2024 09:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Chore:=20Update=20Build-Re?= =?UTF-8?q?layed=20Scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +- scripts/build-ios.sh.sh | 25 ++++++ scripts/test-builds-quick.sh | 66 -------------- scripts/test-builds.sh | 165 ++++++++++++++++++++++++----------- 4 files changed, 142 insertions(+), 119 deletions(-) create mode 100644 scripts/build-ios.sh.sh delete mode 100644 scripts/test-builds-quick.sh diff --git a/package.json b/package.json index 093bef9..bb0e503 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/scripts/build-ios.sh.sh b/scripts/build-ios.sh.sh new file mode 100644 index 0000000..80f194a --- /dev/null +++ b/scripts/build-ios.sh.sh @@ -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 diff --git a/scripts/test-builds-quick.sh b/scripts/test-builds-quick.sh deleted file mode 100644 index 4b0b214..0000000 --- a/scripts/test-builds-quick.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -NEW_ARCH_STATIC=PENDING -OLD_ARCH_STATIC=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 "Build - OLD_ARCH_DYNAMIC: ${OLD_ARCH_DYNAMIC}" - echo "\n\n" -} - -log_build_status; - -echo '\n\nBuild - new-arch (fabric) + static: 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; - -log_build_status - -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=SUCCESS; -else - OLD_ARCH_STATIC=FAILED; -fi; - -log_build_status - -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; - -log_build_status; - -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; - -echo "\n\n All Builds Completed..." -log_build_status \ No newline at end of file diff --git a/scripts/test-builds.sh b/scripts/test-builds.sh index 1668722..e86e7c0 100644 --- a/scripts/test-builds.sh +++ b/scripts/test-builds.sh @@ -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; \ No newline at end of file +log_build_status \ No newline at end of file