123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- #!/bin/sh
- set -e
- set -u
- set -o pipefail
- function on_error {
- echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
- }
- trap 'on_error $LINENO' ERR
- RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
- copy_dir()
- {
- local source="$1"
- local destination="$2"
-
- echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" \"${source}\" \"${destination}\""
- rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" "${source}" "${destination}"
- }
- SELECT_SLICE_RETVAL=""
- select_slice() {
- local paths=("$@")
-
- local target_path=""
-
- local target_archs=$(echo $ARCHS | tr " " "\n")
- local target_variant=""
- if [[ "$PLATFORM_NAME" == *"simulator" ]]; then
- target_variant="simulator"
- fi
- if [[ ! -z ${EFFECTIVE_PLATFORM_NAME+x} && "$EFFECTIVE_PLATFORM_NAME" == *"maccatalyst" ]]; then
- target_variant="maccatalyst"
- fi
- for i in ${!paths[@]}; do
- local matched_all_archs="1"
- for target_arch in $target_archs
- do
- if ! [[ "${paths[$i]}" == *"$target_variant"* ]]; then
- matched_all_archs="0"
- break
- fi
-
- if [[ -z "$target_variant" && ("${paths[$i]}" == *"simulator"* || "${paths[$i]}" == *"maccatalyst"*) ]]; then
- matched_all_archs="0"
- break
- fi
-
-
-
-
-
-
-
-
- local target_arch_regex="[_\-]${target_arch}([\/_\-]|$)"
- if ! [[ "${paths[$i]}" =~ $target_arch_regex ]]; then
- matched_all_archs="0"
- break
- fi
- done
- if [[ "$matched_all_archs" == "1" ]]; then
-
- echo "Selected xcframework slice ${paths[$i]}"
- SELECT_SLICE_RETVAL=${paths[$i]}
- break
- fi
- done
- }
- install_library() {
- local source="$1"
- local name="$2"
- local destination="${PODS_XCFRAMEWORKS_BUILD_DIR}/${name}"
-
- local source="$binary"
- echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" \"${source}/*\" \"${destination}\""
- rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" "${source}/*" "${destination}"
- }
- install_framework()
- {
- local source="$1"
- local name="$2"
- local destination="${PODS_XCFRAMEWORKS_BUILD_DIR}/${name}"
- if [ ! -d "$destination" ]; then
- mkdir -p "$destination"
- fi
- copy_dir "$source" "$destination"
- echo "Copied $source to $destination"
- }
- install_xcframework_library() {
- local basepath="$1"
- local name="$2"
- local paths=("$@")
-
- select_slice "${paths[@]}"
- local target_path="$SELECT_SLICE_RETVAL"
- if [[ -z "$target_path" ]]; then
- echo "warning: [CP] Unable to find matching .xcframework slice in '${paths[@]}' for the current build architectures ($ARCHS)."
- return
- fi
- install_framework "$basepath/$target_path" "$name"
- }
- install_xcframework() {
- local basepath="$1"
- local name="$2"
- local package_type="$3"
- local paths=("$@")
-
- select_slice "${paths[@]}"
- local target_path="$SELECT_SLICE_RETVAL"
- if [[ -z "$target_path" ]]; then
- echo "warning: [CP] Unable to find matching .xcframework slice in '${paths[@]}' for the current build architectures ($ARCHS)."
- return
- fi
- local source="$basepath/$target_path"
- local destination="${PODS_XCFRAMEWORKS_BUILD_DIR}/${name}"
- if [ ! -d "$destination" ]; then
- mkdir -p "$destination"
- fi
- copy_dir "$source/" "$destination"
- echo "Copied $source to $destination"
- }
- install_xcframework "${PODS_ROOT}/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework" "GoogleMobileAds" "framework" "ios-arm64_armv7" "ios-arm64_i386_x86_64-simulator"
|