Skip to content

Commit 615813c

Browse files
author
zhangwei
committed
[Android]Update ci.
1 parent 0b4a2f9 commit 615813c

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

.github/ci/build/build_android.sh

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ echo short_version: $short_version
5151
echo pwd: `pwd`
5252
echo sdk_url: $sdk_url
5353
echo compress_apiexample: $compress_apiexample
54+
5455
unzip_name=Agora_Native_SDK_for_Android_FULL_DEFAULT
5556
zip_name=Agora_Native_SDK_for_Android_FULL_DEFAULT.zip
57+
5658
if [ -z "$sdk_url" ] || [ "$sdk_url" == "none" ]; then
5759
echo "sdk_url is empty"
5860
echo unzip_name: $unzip_name
@@ -79,27 +81,52 @@ fi
7981
mkdir -p ./$unzip_name/rtc/samples
8082
cp -rf ./Android/${android_direction} ./$unzip_name/rtc/samples/API-Example || exit 1
8183

84+
# Define build path variable based on compress_apiexample parameter
85+
if [ $compress_apiexample = true ]; then
86+
build_path="./temp_apiexample"
87+
result_file="apiExample_${BUILD_NUMBER}_$zip_name"
88+
else
89+
build_path="./$unzip_name"
90+
result_file="withAPIExample_${BUILD_NUMBER}_$zip_name"
91+
fi
92+
8293
# Decide how to package based on compress_apiexample parameter
83-
if [ "$compress_apiexample" = "true" ]; then
94+
if [ $compress_apiexample = true ]; then
8495
# Only compress API-Example code
8596
echo "Only compressing API-Example code"
8697
mkdir -p ./temp_apiexample/rtc/samples
8798
cp -rf ./$unzip_name/rtc/samples/API-Example ./temp_apiexample/rtc/samples/ || exit 1
88-
7za a -tzip result.zip -r temp_apiexample > log.txt
99+
7za a -tzip apiExample_android.zip -r temp_apiexample > log.txt
89100
rm -rf ./temp_apiexample
90-
mv result.zip $WORKSPACE/apiExample_${BUILD_NUMBER}_$zip_name
101+
mv apiExample_android.zip $WORKSPACE/$result_file
91102
else
92103
# Compress the entire SDK including API-Example
93104
echo "Compressing the entire SDK including API-Example"
94-
7za a -tzip result.zip -r $unzip_name > log.txt
95-
mv result.zip $WORKSPACE/withAPIExample_${BUILD_NUMBER}_$zip_name
105+
7za a -tzip apiExample_android_with_sdk.zip -r $unzip_name > log.txt
106+
mv apiExample_android_with_sdk.zip $WORKSPACE/$result_file
96107
fi
97108

98109
if [ $compile_project = true ]; then
99-
cd ./$unzip_name/rtc/samples/API-Example || exit 1
110+
# Based on compress_apiexample, use the appropriate build path
111+
if [ $compress_apiexample = true ]; then
112+
echo "Building with API-Example only package"
113+
mkdir -p ./temp_apiexample/rtc/samples
114+
cp -rf ./$unzip_name/rtc/samples/API-Example ./temp_apiexample/rtc/samples/ || exit 1
115+
cd ./temp_apiexample/rtc/samples/API-Example || exit 1
116+
else
117+
echo "Building with full SDK package"
118+
cd ./$unzip_name/rtc/samples/API-Example || exit 1
119+
fi
120+
100121
if [ -z "$sdk_url" ] || [ "$sdk_url" == "none" ]; then
101122
./cloud_build.sh false || exit 1
102123
else
103124
./cloud_build.sh true || exit 1
104125
fi
126+
127+
# Cleanup temp directory if needed
128+
if [ $compress_apiexample = true ]; then
129+
cd ../../../../
130+
rm -rf ./temp_apiexample
131+
fi
105132
fi

0 commit comments

Comments
 (0)