Skip to content

Commit

Permalink
Merge pull request #437 from AgoraIO/dev/4.5.0_android
Browse files Browse the repository at this point in the history
feat: modify ci for build android
  • Loading branch information
tamworth authored Oct 31, 2024
2 parents 7e6ddab + ec9d9bc commit 1937ee0
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .github/ci/build/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ echo release_version: $release_version
echo short_version: $short_version
echo pwd: `pwd`
echo sdk_url: $sdk_url
unzip_name=Agora_Native_SDK_for_Android_FULL
unzip_name=Agora_Native_SDK_for_Android_FULL_DEFAULT
zip_name=Agora_Native_SDK_for_Android_FULL_DEFAULT.zip
if [ -z "$sdk_url" ]; then
echo "sdk_url is empty"
echo unzip_name: $unzip_name
echo zip_name: $zip_name
else
zip_name=${sdk_url##*/}
echo zip_name: $zip_name
Expand Down
9 changes: 8 additions & 1 deletion Android/APIExample-Audio/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
apply plugin: 'com.android.application'


def sdkVersionFile = file("../gradle.properties")
def properties = new Properties()
sdkVersionFile.withInputStream { stream ->
properties.load(stream)
}
def agoraSdkVersion = properties.getProperty("rtc_sdk_version")
println("${rootProject.project.name} agoraSdkVersion: ${agoraSdkVersion}")
def localSdkPath= "${rootProject.projectDir.absolutePath}/../../sdk"
def agoraSdkVersion = '4.5.0'

android {
compileSdkVersion 32
Expand Down
19 changes: 18 additions & 1 deletion Android/APIExample-Audio/cloud_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,24 @@ rm -f app/src/main/res/values/string_configs.xml-e

./gradlew clean || exit 1
./gradlew :app:assembleRelease || exit 1

SDK_VERSION=""
if [ "$1" = "false" ]; then
sdk_version_file="./gradle.properties"
if [[ -f "$sdk_version_file" ]]; then
rtc_sdk_version=$(grep "rtc_sdk_version" "$sdk_version_file" | cut -d'=' -f2)
if [[ -n "$rtc_sdk_version" ]]; then
SDK_VERSION=$(echo "$rtc_sdk_version" | sed 's/^[ \t]*//;s/[ \t]*$//')
else
echo "rtc_sdk_version value not found"
fi
else
echo "file not found: $sdk_version_file"
fi
else
SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
fi

if [ "$WORKSPACE" != "" ]; then
SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
cp app/build/outputs/apk/release/*.apk $WORKSPACE/APIExample-Audio_${BUILD_NUMBER}_${SDK_VERSION}_$(date "+%Y%m%d%H%M%S").apk
fi
4 changes: 3 additions & 1 deletion Android/APIExample-Audio/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ android.useAndroidX=true
android.enableJetifier=true

# read enable simple filter section on README first before set this flag to TRUE
simpleFilter = false
simpleFilter = false

rtc_sdk_version = 4.5.0
13 changes: 10 additions & 3 deletions Android/APIExample-Compose/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ plugins {
alias(libs.plugins.jetbrainsKotlinAndroid)
}

val sdkVersionFile = file("../gradle.properties")
val properties = Properties()
properties.load(sdkVersionFile.inputStream())
val agoraSdkVersion = properties.getProperty("rtc_sdk_version")
println("${rootProject.project.name} agoraSdkVersion: ${agoraSdkVersion}")
val localSdkPath = "${rootProject.projectDir.absolutePath}/../../sdk"

android {
Expand Down Expand Up @@ -85,7 +90,7 @@ android {
outputs.all {
if (this is ApkVariantOutputImpl) {
this.outputFileName =
"${rootProject.name}_${libs.versions.agoraSdk.get()}_${
"${rootProject.name}_${agoraSdkVersion}_${
SimpleDateFormat("yyyyMMddHHmm").format(
Date()
)
Expand Down Expand Up @@ -129,8 +134,10 @@ dependencies {
if (File(localSdkPath).exists()) {
implementation(fileTree(localSdkPath).include("*.jar", "*.aar"))
} else {
implementation(libs.agora.full.sdk)
implementation(libs.agora.full.screen.sharing)
implementation("io.agora.rtc:full-sdk:${agoraSdkVersion}")
implementation("io.agora.rtc:full-screen-sharing:${agoraSdkVersion}")
// implementation(libs.agora.full.sdk)
// implementation(libs.agora.full.screen.sharing)
}

}
19 changes: 18 additions & 1 deletion Android/APIExample-Compose/cloud_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,24 @@ fi

./gradlew clean || exit 1
./gradlew :app:assembleRelease || exit 1

SDK_VERSION=""
if [ "$1" = "false" ]; then
sdk_version_file="./gradle.properties"
if [[ -f "$sdk_version_file" ]]; then
rtc_sdk_version=$(grep "rtc_sdk_version" "$sdk_version_file" | cut -d'=' -f2)
if [[ -n "$rtc_sdk_version" ]]; then
SDK_VERSION=$(echo "$rtc_sdk_version" | sed 's/^[ \t]*//;s/[ \t]*$//')
else
echo "rtc_sdk_version value not found"
fi
else
echo "file not found: $sdk_version_file"
fi
else
SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
fi

if [ "$WORKSPACE" != "" ]; then
SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
cp app/build/outputs/apk/release/*.apk $WORKSPACE/APIExample-Compose_${BUILD_NUMBER}_${SDK_VERSION}_$(date "+%Y%m%d%H%M%S").apk
fi
4 changes: 3 additions & 1 deletion Android/APIExample-Compose/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true

rtc_sdk_version = 4.5.0
6 changes: 3 additions & 3 deletions Android/APIExample-Compose/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ composeBom = "2023.08.00"
loggingInterceptor = "4.10.0"
materialIconsExtended = "1.6.0"
navigationCompose = "2.7.7"
agoraSdk = "4.5.0"
#agoraSdk = "4.5.0"
okhttp = "4.10.0"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-datastore = { module = "androidx.datastore:datastore", version.ref = "datastore" }
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastore" }
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "materialIconsExtended" }
agora-full-sdk = { module = "io.agora.rtc:full-sdk", version.ref = "agoraSdk" }
agora-full-screen-sharing = { module = "io.agora.rtc:full-screen-sharing", version.ref = "agoraSdk" }
#agora-full-sdk = { module = "io.agora.rtc:full-sdk", version.ref = "agoraSdk" }
#agora-full-screen-sharing = { module = "io.agora.rtc:full-screen-sharing", version.ref = "agoraSdk" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
Expand Down
9 changes: 8 additions & 1 deletion Android/APIExample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ apply plugin: 'kotlin-android'
apply from: "${rootDir.absolutePath}/git-hooks.gradle"
apply from: 'vendors.gradle'

def agoraSdkVersion = "4.5.0"

def sdkVersionFile = file("../gradle.properties")
def properties = new Properties()
sdkVersionFile.withInputStream { stream ->
properties.load(stream)
}
def agoraSdkVersion = properties.getProperty("rtc_sdk_version")
println("${rootProject.project.name} agoraSdkVersion: ${agoraSdkVersion}")
def localSdkPath= "${rootProject.projectDir.absolutePath}/../../sdk"


Expand Down
18 changes: 17 additions & 1 deletion Android/APIExample/cloud_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,23 @@ cd - || exit 1
./gradlew clean || exit 1
./gradlew :app:assembleRelease || exit 1

SDK_VERSION=""
if [ "$1" = "false" ]; then
sdk_version_file="./gradle.properties"
if [[ -f "$sdk_version_file" ]]; then
rtc_sdk_version=$(grep "rtc_sdk_version" "$sdk_version_file" | cut -d'=' -f2)
if [[ -n "$rtc_sdk_version" ]]; then
SDK_VERSION=$(echo "$rtc_sdk_version" | sed 's/^[ \t]*//;s/[ \t]*$//')
else
echo "rtc_sdk_version value not found"
fi
else
echo "file not found: $sdk_version_file"
fi
else
SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
fi

if [ "$WORKSPACE" != "" ]; then
SDK_VERSION=$(echo $sdk_url | cut -d "/" -f 5)
cp app/build/outputs/apk/release/*.apk $WORKSPACE/APIExample_${BUILD_NUMBER}_${SDK_VERSION}_$(date "+%Y%m%d%H%M%S").apk
fi
2 changes: 2 additions & 0 deletions Android/APIExample/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ android.enableJetifier=true
simpleFilter = false
# read enable stream encrypt section on README first before set this flag to TRUE
streamEncrypt = false

rtc_sdk_version = 4.5.0

0 comments on commit 1937ee0

Please sign in to comment.