ci: fix android build
arcad/arcast/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
wpetit 2024-04-26 15:28:24 +02:00
parent d15ce3eabd
commit 34c58ab1e7
3 changed files with 10 additions and 10 deletions

4
Jenkinsfile vendored
View File

@ -15,7 +15,7 @@ standardMakePipeline([
# Install utilities
RUN apt-get update -y \
&& apt-get install -y wget curl tar build-essential ca-certificates git openjdk-17-jdk unzip locales jq moreutils
&& apt-get install -y wget git curl tar build-essential ca-certificates git openjdk-17-jdk unzip locales jq moreutils
# Set locale
RUN locale-gen en_US.UTF-8
@ -51,7 +51,7 @@ standardMakePipeline([
'extras;google;google_play_services'
''',
'hooks': [
'pre-release': {
'pre-build': {
sh '''
make .mktools
'''

View File

@ -18,6 +18,8 @@ ANDROID_KEYSTORE_KEY_VALIDITY ?= 365000
ANDROID_BUILD_TOOLS_VERSION ?= 34.0.0
VERSION_CODE ?= $(shell git rev-list master --first-parent --count)
APPS := main
watch: tools/modd/bin/modd deps ## Watching updated files - live reload
@ -48,10 +50,10 @@ build-client: deps ## Build executable
-o ./bin/client \
./cmd/client
build-android: tools/gogio/bin/gogio deps ## Build executable
build-android: .mktools tools/gogio/bin/gogio deps ## Build executable
mkdir -p dist
CGO_ENABLED=1 GOOS=android CGO_CFLAGS="-I${JDK_PATH}/include -I${JDK_PATH}/include/linux -w" tools/gogio/bin/gogio -target android -buildmode archive -o android/app/libs/mobile.aar -x ./cmd/mobile
( cd android && VERSION_NAME=$(MKT_PROJECT_VERSION)-debug ./gradlew assembleDebug )
( cd android && VERSION_CODE=$(VERSION_CODE) VERSION_NAME=$(MKT_PROJECT_VERSION)-debug ./gradlew assembleDebug )
$(ANDROID_KEYSTORE_FILE):
keytool -genkey -noprompt \
@ -65,7 +67,7 @@ $(ANDROID_KEYSTORE_FILE):
release-android: $(ANDROID_KEYSTORE_FILE) tools/gogio/bin/gogio deps ## Build executable
mkdir -p dist
CGO_ENABLED=1 GOOS=android CGO_CFLAGS="-I${JDK_PATH}/include -I${JDK_PATH}/include/linux -w" tools/gogio/bin/gogio -target android -buildmode archive -o android/app/libs/mobile.aar -x ./cmd/mobile
( cd android && VERSION_NAME=$(MKT_PROJECT_VERSION) ./gradlew assemble )
( cd android && VERSION_CODE=$(VERSION_CODE) VERSION_NAME=$(MKT_PROJECT_VERSION) ./gradlew assemble )
rm -f android/app/build/outputs/apk/release/app-release-unsigned-aligned.apk
"$(ANDROID_HOME)/build-tools/$(ANDROID_BUILD_TOOLS_VERSION)/zipalign" -p 4 android/app/build/outputs/apk/release/app-release-unsigned.apk android/app/build/outputs/apk/release/app-release-unsigned-aligned.apk
"$(ANDROID_HOME)/build-tools/$(ANDROID_BUILD_TOOLS_VERSION)/apksigner" \

View File

@ -3,10 +3,8 @@ plugins {
id 'org.jetbrains.kotlin.android'
}
def gitVersion() {
def counter = 0
def process = "git rev-list master --first-parent --count".execute()
return process.text.toInteger()
def versionCode() {
return System.env.VERSION_CODE ? System.env.VERSION_CODE.toInteger() : 0
}
def versionName() {
@ -21,7 +19,7 @@ android {
applicationId "com.cadoles.arcast_player"
minSdk 24
targetSdk 34
versionCode gitVersion()
versionCode versionCode()
versionName versionName()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"