ci: fix android build
arcad/arcast/pipeline/head This commit is unstable Details

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

4
Jenkinsfile vendored
View File

@ -15,7 +15,7 @@ standardMakePipeline([
# Install utilities # Install utilities
RUN apt-get update -y \ 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 # Set locale
RUN locale-gen en_US.UTF-8 RUN locale-gen en_US.UTF-8
@ -51,7 +51,7 @@ standardMakePipeline([
'extras;google;google_play_services' 'extras;google;google_play_services'
''', ''',
'hooks': [ 'hooks': [
'pre-release': { 'pre-build': {
sh ''' sh '''
make .mktools make .mktools
''' '''

View File

@ -18,6 +18,8 @@ ANDROID_KEYSTORE_KEY_VALIDITY ?= 365000
ANDROID_BUILD_TOOLS_VERSION ?= 34.0.0 ANDROID_BUILD_TOOLS_VERSION ?= 34.0.0
VERSION_CODE ?= $(shell git rev-list HEAD --first-parent --count)
APPS := main APPS := main
watch: tools/modd/bin/modd deps ## Watching updated files - live reload watch: tools/modd/bin/modd deps ## Watching updated files - live reload
@ -48,10 +50,10 @@ build-client: deps ## Build executable
-o ./bin/client \ -o ./bin/client \
./cmd/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 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 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): $(ANDROID_KEYSTORE_FILE):
keytool -genkey -noprompt \ keytool -genkey -noprompt \
@ -65,7 +67,7 @@ $(ANDROID_KEYSTORE_FILE):
release-android: $(ANDROID_KEYSTORE_FILE) tools/gogio/bin/gogio deps ## Build executable release-android: $(ANDROID_KEYSTORE_FILE) tools/gogio/bin/gogio deps ## Build executable
mkdir -p dist 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 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 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)/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" \ "$(ANDROID_HOME)/build-tools/$(ANDROID_BUILD_TOOLS_VERSION)/apksigner" \

View File

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