Skip to content

Commit

Permalink
Modify the script and add SDK link empty judgment
Browse files Browse the repository at this point in the history
  • Loading branch information
qinhui committed Oct 30, 2024
1 parent d2a01fd commit 7d08dde
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
35 changes: 20 additions & 15 deletions .github/ci/build/build_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,32 @@ echo short_version: $short_version
echo pwd: `pwd`
echo sdk_url: $sdk_url

zip_name=${sdk_url##*/}
echo zip_name: $zip_name

curl -o $zip_name $sdk_url || exit 1
7za x ./$zip_name -y > log.txt

unzip_name=`ls -S -d */ | grep Agora | sed 's/\///g'`
echo unzip_name: $unzip_name

rm -rf ./$unzip_name/bin
rm ./$unzip_name/commits
rm ./$unzip_name/package_size_report.txt
mkdir ./$unzip_name/samples
unzip_name=Agora_Native_SDK_for_iOS_FULL
sdk_url_flag=false
if [ -z "$sdk_url" ]; then
sdk_url_flag=false
echo "sdk_url is empty"
echo unzip_name: $unzip_name
else
sdk_url_flag=true
zip_name=${sdk_url##*/}
echo zip_name: $zip_name
curl -o $zip_name $sdk_url || exit 1
7za x ./$zip_name -y > log.txt
unzip_name=`ls -S -d */ | grep Agora | sed 's/\///g'`
echo unzip_name: $unzip_name
rm -rf ./$unzip_name/bin
rm ./$unzip_name/commits
rm ./$unzip_name/package_size_report.txt
fi

mkdir -p ./$unzip_name/samples
cp -rf ./iOS/${ios_direction} ./$unzip_name/samples/API-Example || exit 1
ls -al ./$unzip_name/samples/API-Example/
mv ./$unzip_name/samples/API-Example/sdk.podspec ./$unzip_name/ || exit 1

echo "work space1: $WORKSPACE"
python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/API-Example/Podfile || exit 1

python3 ./.github/ci/build/modify_podfile.py ./$unzip_name/samples/API-Example/Podfile $sdk_url_flag || exit 1

7za a -tzip result.zip -r $unzip_name > log.txt
mv result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name
Expand Down
14 changes: 9 additions & 5 deletions .github/ci/build/modify_podfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import os, sys

def modfiy(path):
def modfiy(path, sdk_flag):
with open(path, 'r', encoding='utf-8') as file:
contents = []
for num, line in enumerate(file):
if "pod 'Agora" in line:
line = '\t'+"pod 'sdk', :path => '../../sdk.podspec'" + "\n"
if sdk_flag:
line = '\t'+"pod 'sdk', :path => '../../sdk.podspec'" + "\n"
elif "pod 'sdk" in line:
line = ""
if sdk_flag:
line = ""
elif 'sh .download_script' in line:
line = line.replace('true', 'false') + "\n"
contents.append(line)
Expand All @@ -19,6 +21,8 @@ def modfiy(path):
fw.close()



if __name__ == '__main__':
path = sys.argv[1:][0]
modfiy(path.strip())
path = sys.argv[1]
sdk_url_is_not_empty = sys.argv[2].lower() == 'true'
modfiy(path.strip(), sdk_url_is_not_empty)

0 comments on commit 7d08dde

Please sign in to comment.