forked from HaxeExtension/extension-admob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_admob_ios.sh
executable file
·59 lines (44 loc) · 1.62 KB
/
setup_admob_ios.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
URL="https://dl.google.com/googleadmobadssdk/googlemobileadssdkios.zip"
OUTPUT_DIR="project/admob-ios/frameworks"
TEMP_DIR="temp_admob_sdk"
ZIP_FILE="googlemobileadssdkios.zip"
rm -rf "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"
mkdir -p "$TEMP_DIR"
echo "Downloading AdMob SDK..."
curl -o "$ZIP_FILE" "$URL"
echo "Unzipping the file..."
unzip -q "$ZIP_FILE" -d "$TEMP_DIR"
EXTRACTED_DIR=$(find "$TEMP_DIR" -maxdepth 1 -type d -name "GoogleMobileAdsSdkiOS*" | head -n 1)
if [ -z "$EXTRACTED_DIR" ]; then
echo "Error: Extracted directory not found."
exit 1
fi
cd "$EXTRACTED_DIR" || exit 1
for XCFRAMEWORK_DIR in *.xcframework; do
if [ -d "$XCFRAMEWORK_DIR" ]; then
echo "Processing $XCFRAMEWORK_DIR..."
for ARCH_DIR in "$XCFRAMEWORK_DIR"/*; do
if [[ "$ARCH_DIR" =~ ios-.* ]]; then
echo "Found architecture directory: $ARCH_DIR"
FRAMEWORK_DIR=$(find "$ARCH_DIR" -type d -name "*.framework")
if [ -d "$FRAMEWORK_DIR" ]; then
ARCH_NAME=$(basename "$ARCH_DIR" | sed 's/^ios-//')
DEST_DIR="../../$OUTPUT_DIR/$ARCH_NAME"
mkdir -p "$DEST_DIR"
FRAMEWORK_NAME=$(basename "$FRAMEWORK_DIR")
echo "Copying $FRAMEWORK_NAME to $DEST_DIR."
cp -R "$FRAMEWORK_DIR" "$DEST_DIR"
else
echo "No .framework file found in $ARCH_DIR"
fi
fi
done
fi
done
echo "Cleaning up..."
cd ../../
rm -rf "$TEMP_DIR"
rm -f "$ZIP_FILE"
echo "Frameworks have been organized in $OUTPUT_DIR."