Skip to content

Commit 769367b

Browse files
committed
ci: refactor Jenkinsfile.android
1 parent 281d795 commit 769367b

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

ci/Jenkinsfile.android

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ pipeline {
1616
}
1717

1818
parameters {
19-
choice(
20-
name: 'ARCH',
21-
description: 'Target architecture',
22-
choices: ['arm64', 'x86_64']
23-
)
2419
booleanParam(
2520
name: 'RELEASE',
2621
description: 'Decides whether release credentials are used.',
@@ -46,49 +41,70 @@ pipeline {
4641
}
4742

4843
environment {
44+
/* Architecture */
45+
ARCH = "arm64"
46+
OS = "android"
47+
48+
/* Build system */
4949
USE_SYSTEM_NIM = "1"
50+
51+
/* Cache directories */
5052
GOCACHE = "/tmp/go-cache"
5153
GOMODCACHE = "/tmp/go-mod-cache"
5254
GOTMPDIR = "/tmp"
53-
STATUS_APK_ARTIFACT = "pkg/Status-tablet-${BUILD_NUMBER}.apk"
54-
PLATFORM = "android/${ARCH}"
55+
NIMCACHE = "/tmp/nim-cache"
56+
57+
/* Platform and artifacts */
58+
PLATFORM = "android/arm64"
59+
STATUS_APK_ARTIFACT = "pkg/Status-tablet-arm64-${BUILD_NUMBER}.apk"
60+
STATUS_APK = "${WORKSPACE}/mobile/bin/android/arm64/qt6/Status-tablet.apk"
61+
62+
/* Android SDK/NDK paths */
63+
ANDROID_SDK_ROOT = "/opt/android-sdk"
64+
ANDROID_NDK_ROOT = "/opt/android-ndk"
65+
66+
/* Qt paths */
67+
QT_BASE_PATH = "/opt/qt/6.9.0"
68+
QT_HOST_PATH = "/opt/qt/6.9.0/gcc_64"
69+
QT_ANDROID_PATH = "/opt/qt/6.9.0/android_arm64_v8a"
70+
71+
/* Build configuration */
72+
PKG_CONFIG_PATH = "/opt/qt/6.9.0/android_arm64_v8a/lib/pkgconfig"
73+
PATH = "/opt/qt/6.9.0/android_arm64_v8a/bin:/opt/qt/6.9.0/gcc_64/bin:/opt/qt/6.9.0/gcc_64/libexec:/opt/qt/6.9.0/android_arm64_v8a/libexec:/opt/android-sdk/emulator:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/opt/android-sdk/platform-tools:${PATH}"
5574
}
5675

5776
stages {
5877
stage('Prepare') {
5978
steps {
6079
sh 'git submodule update --init --recursive'
61-
script {
62-
def qtPath = getQtAndroidPath(params.ARCH)
63-
env.QT_ANDROID_PATH = qtPath
64-
env.STATUS_APK = "${env.WORKSPACE}/mobile/bin/android/qt6/Status-tablet.apk"
65-
66-
echo "Building for architecture: ${params.ARCH}"
67-
echo "Qt Android path: ${qtPath}"
68-
}
6980
}
7081
}
7182

7283
stage('Build Android APK') {
7384
steps {
7485
sh """
75-
export ARCH="${params.ARCH}"
76-
export PKG_CONFIG_PATH="${env.QT_ANDROID_PATH}/lib/pkgconfig"
77-
export PATH="${env.QT_ANDROID_PATH}/bin:/opt/qt/6.9.0/gcc_64/bin:/opt/qt/6.9.0/gcc_64/libexec:${env.QT_ANDROID_PATH}/libexec:/opt/android-sdk/emulator:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/opt/android-sdk/platform-tools:${env.PATH}"
86+
set -e
87+
88+
echo "Cleaning previous build..."
7889
make mobile-clean
79-
make -j${utils.getProcCount()} mobile-build V=3 USE_SYSTEM_NIM=1
90+
91+
echo "Building APK..."
92+
make -j${utils.getProcCount()} mobile-build V=3
8093
"""
8194
}
8295
}
8396

8497
stage('Package APK') {
8598
steps {
8699
sh """
100+
set -e
101+
87102
mkdir -p pkg
88103
cp '${env.STATUS_APK}' '${env.STATUS_APK_ARTIFACT}'
89-
ls -la '${env.STATUS_APK_ARTIFACT}'
104+
105+
echo "APK packaged successfully:"
106+
ls -lah '${env.STATUS_APK_ARTIFACT}'
90107
"""
91-
echo "APK packaged: ${env.STATUS_APK_ARTIFACT}"
92108
}
93109
}
94110

@@ -99,6 +115,7 @@ pipeline {
99115
script {
100116
env.PKG_URL = s5cmd.upload(env.STATUS_APK_ARTIFACT)
101117
jenkins.setBuildDesc(APK: env.PKG_URL)
118+
echo "Upload complete: ${env.PKG_URL}"
102119
}
103120
}
104121
}
@@ -117,14 +134,3 @@ pipeline {
117134
cleanup { sh './scripts/clean-git.sh' }
118135
}
119136
}
120-
121-
def getQtAndroidPath(architecture) {
122-
switch(architecture) {
123-
case 'arm64':
124-
return '/opt/qt/6.9.0/android_arm64_v8a'
125-
case 'x86_64':
126-
return '/opt/qt/6.9.0/android_x86_64'
127-
default:
128-
return '/opt/qt/6.9.0/android_arm64_v8a'
129-
}
130-
}

0 commit comments

Comments
 (0)