fix social-app ios build_number
This commit is contained in:
@@ -5,6 +5,15 @@ cd ${0:a:h}
|
||||
# iOS Social App Patch Setup Script
|
||||
# Usage: ./ios/setup.zsh [patch|reset]
|
||||
|
||||
# Cross-platform sed (macOS vs Linux)
|
||||
function sediment() {
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' "$@"
|
||||
else
|
||||
sed -i "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Arrays for patch management
|
||||
typeset -a FAILED_PATCHES
|
||||
|
||||
@@ -114,6 +123,30 @@ function patch-apply() {
|
||||
apply-patch "${name}" "$target_dir" "$patching_dir/${patch_file}"
|
||||
}
|
||||
|
||||
# Generate build number from timestamp (YYMMDDHHMMSS)
|
||||
function ios-generate-build-number() {
|
||||
local build_number=$(date +%y%m%d%H%M%S)
|
||||
local config_patch="$patching_dir/001-social-app-ios-config.patch"
|
||||
|
||||
if [ -f "$config_patch" ]; then
|
||||
# Replace placeholder with timestamp
|
||||
sediment "s/__BUILD_NUMBER__/${build_number}/" "$config_patch"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "🔢 Build number: ${build_number}"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# Restore placeholder after patching (for git cleanliness)
|
||||
function ios-restore-build-placeholder() {
|
||||
local config_patch="$patching_dir/001-social-app-ios-config.patch"
|
||||
|
||||
if [ -f "$config_patch" ]; then
|
||||
# Restore placeholder for next build
|
||||
sediment "s/buildNumber: '[0-9]*'/buildNumber: '__BUILD_NUMBER__'/" "$config_patch"
|
||||
fi
|
||||
}
|
||||
|
||||
# Auto-apply patches from list
|
||||
function ios-patch-apply-all() {
|
||||
for filename in "${PATCH_FILES_IOS[@]}"; do
|
||||
@@ -166,7 +199,9 @@ ios-env
|
||||
case "$1" in
|
||||
patch)
|
||||
ios-setup-clone
|
||||
ios-generate-build-number
|
||||
ios-patch-apply-all
|
||||
ios-restore-build-placeholder
|
||||
ios-copy-new-files
|
||||
show-failed-patches
|
||||
exit
|
||||
@@ -177,7 +212,9 @@ case "$1" in
|
||||
;;
|
||||
*)
|
||||
ios-setup-clone
|
||||
ios-generate-build-number
|
||||
ios-patch-apply-all
|
||||
ios-restore-build-placeholder
|
||||
ios-copy-new-files
|
||||
show-failed-patches
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user