Skip to content

Commit 780b736

Browse files
authored
Prepare Android release workflow for Vulkan release (#3081)
1 parent 2f13366 commit 780b736

File tree

4 files changed

+66
-42
lines changed

4 files changed

+66
-42
lines changed

.github/workflows/android-release.yml

+28-28
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ name: android-release
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
renderer:
7-
description: "Select renderering backend"
8-
required: true
9-
default: "OpenGL"
10-
type: choice
11-
options:
12-
- OpenGL
13-
- Vulkan
145

156
jobs:
167
build:
@@ -28,15 +19,6 @@ jobs:
2819
submodules: recursive
2920
fetch-depth: 0
3021

31-
- name: Map renderer input
32-
id: backend_lowercase
33-
run: |
34-
if [ "${{ github.event.inputs.renderer }}" = "OpenGL" ]; then
35-
echo "backend_lowercase=drawable" >> "$GITHUB_ENV"
36-
elif [ "${{ github.event.inputs.renderer }}" = "Vulkan" ]; then
37-
echo "backend_lowercase=vulkan" >> "$GITHUB_ENV"
38-
fi
39-
4022
- run: echo "cmake.dir=$(dirname "$(dirname "$(command -v cmake)")")" >> local.properties
4123

4224
- uses: actions/setup-java@v4
@@ -74,9 +56,9 @@ jobs:
7456
shell: bash
7557

7658
- name: Build package
77-
run: make apackage
78-
env:
79-
RENDERER: ${{ env.backend_lowercase }}
59+
run: |
60+
RENDERER=vulkan make apackage
61+
RENDERER=opengl make apackage
8062
8163
- name: Build release Test App
8264
run: |
@@ -123,25 +105,44 @@ jobs:
123105
draft: false
124106
prerelease: ${{ env.prerelease }}
125107

126-
- name: Upload aar
127-
id: upload-release-asset
108+
- name: Upload aar (OpenGL)
128109
uses: actions/upload-release-asset@v1
129110
env:
130111
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131112
with:
132113
upload_url: ${{ steps.create_release.outputs.upload_url }}
133-
asset_path: platform/android/MapLibreAndroid/build/outputs/aar/MapLibreAndroid-${{ env.backend_lowercase }}-release.aar
114+
asset_path: platform/android/MapLibreAndroid/build/outputs/aar/MapLibreAndroid-drawable-release.aar
134115
asset_name: MapLibreAndroid-release.aar
135116
asset_content_type: application/zip
136117

137-
- name: Upload debug symbols
118+
- name: Upload aar (Vulkan)
119+
uses: actions/upload-release-asset@v1
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
with:
123+
upload_url: ${{ steps.create_release.outputs.upload_url }}
124+
asset_path: platform/android/MapLibreAndroid/build/outputs/aar/MapLibreAndroid-vulkan-release.aar
125+
asset_name: MapLibreAndroid-release-vulkan.aar
126+
asset_content_type: application/zip
127+
128+
- name: Upload debug symbols (OpenGL)
129+
uses: actions/upload-release-asset@v1
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
with:
133+
upload_url: ${{ steps.create_release.outputs.upload_url }}
134+
asset_path: platform/android/build/debug-symbols-opengl.tar.gz
135+
asset_name: debug-symbols-maplibre-android-opengl-${{ steps.prepare_release.outputs.version_tag }}.tar.gz
136+
asset_content_type: application/gzip
137+
138+
- name: Upload debug symbols (Vulkan)
138139
uses: actions/upload-release-asset@v1
139140
env:
140141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141142
with:
142143
upload_url: ${{ steps.create_release.outputs.upload_url }}
143-
asset_path: platform/android/build/debug-symbols.tar.gz
144-
asset_name: debug-symbols.tar.gz
144+
asset_path: platform/android/build/debug-symbols-vulkan.tar.gz
145+
asset_name: debug-symbols-maplibre-android-vulkan-${{ steps.prepare_release.outputs.version_tag }}.tar.gz
145146
asset_content_type: application/gzip
146147

147148
- name: Clean release
@@ -164,4 +165,3 @@ jobs:
164165
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
165166
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
166167
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
167-
RENDERER: ${{ env.backend_lowercase }}

platform/android/Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,16 @@ run-android-unit-test:
223223
run-android-unit-test-%:
224224
$(MLN_ANDROID_GRADLE) -Pmaplibre.abis=none :MapLibreAndroid:testLegacyDebugUnitTest --info --tests "$*"
225225

226+
DEBUG_TAR_FILE_NAME := $(if $(findstring drawable,$(RENDERER)),debug-symbols-opengl.tar.gz,debug-symbols-$(RENDERER).tar.gz)
227+
226228
# Builds a release package and .tar.gz with debug symbols of the Android SDK
227229
.PHONY: apackage
228230
apackage:
229231
echo "Building for $(RENDERER)"
230232
make android-lib-arm-v7 && make android-lib-arm-v8 && make android-lib-x86 && make android-lib-x86-64
231233
$(MLN_ANDROID_GRADLE) -Pmaplibre.abis=all assemble$(RENDERER)$(BUILDTYPE)
232234
mkdir -p build
233-
tar -czvf build/debug-symbols.tar.gz -C MapLibreAndroid/build/intermediates/library_jni/*/*JniLibsProjectOnly/jni .
235+
tar -czvf build/$(DEBUG_TAR_FILE_NAME) -C MapLibreAndroid/build/intermediates/library_jni/$(RENDERER)Release/*JniLibsProjectOnly/jni .
234236

235237
# Build test app instrumentation tests apk and test app apk for all abi's
236238
.PHONY: android-ui-test
@@ -245,7 +247,7 @@ run-android-test-app-center:
245247
# Uploads the compiled Android SDK to Maven Central Staging
246248
.PHONY: run-android-publish
247249
run-android-publish:
248-
$(MLN_ANDROID_GRADLE_SINGLE_JOB)-Pmaplibre.abis=all :MapLibreAndroid:publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository
250+
$(MLN_ANDROID_GRADLE_SINGLE_JOB)-Pmaplibre.abis=all :MapLibreAndroid:publishAllPublicationsToSonatypeRepository closeAndReleaseSonatypeStagingRepository
249251

250252
# Dump system graphics information for the test app
251253
.PHONY: android-gfxinfo

platform/android/buildSrc/src/main/kotlin/maplibre.artifact-settings.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extra["mapLibreArtifactGroupId"] = "org.maplibre.gl"
22
extra["mapLibreArtifactId"] = "android-sdk"
3-
extra["mapLibreArtifactTitle"] = "MapLibre Maps SDK for Android"
4-
extra["mapLibreArtifactDescription"] = "MapLibre Maps SDK for Android"
3+
extra["mapLibreArtifactTitle"] = "MapLibre Android"
4+
extra["mapLibreArtifactDescription"] = "MapLibre Android"
55
extra["mapLibreDeveloperName"] = "MapLibre"
66
extra["mapLibreDeveloperId"] = "maplibre"
77
extra["mapLibreArtifactUrl"] = "https://github.com/maplibre/maplibre-native"

platform/android/buildSrc/src/main/kotlin/maplibre.gradle-publish.gradle.kts

+32-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.gradle.kotlin.dsl.get
2+
import java.util.Locale
23

34
plugins {
45
`maven-publish`
@@ -43,20 +44,24 @@ project.logger.lifecycle(project.extra["versionName"].toString())
4344
version = project.extra["versionName"] as String
4445
group = project.extra["mapLibreArtifactGroupId"] as String
4546

46-
afterEvaluate {
47+
fun configureMavenPublication(
48+
renderer: String,
49+
publicationName: String,
50+
artifactIdPostfix: String,
51+
descriptionPostfix: String,
52+
) {
4753
publishing {
4854
publications {
49-
create<MavenPublication>("release") {
50-
groupId = this@afterEvaluate.group.toString()
51-
artifactId = project.extra["mapLibreArtifactId"].toString()
52-
version = this@afterEvaluate.version.toString()
55+
create<MavenPublication>(publicationName) {
56+
groupId = project.group.toString()
57+
artifactId = "${project.extra["mapLibreArtifactId"]}$artifactIdPostfix"
58+
version = project.version.toString()
5359

54-
// Conditional component selection based on environment variable
55-
from(components[if (System.getenv("RENDERER")?.lowercase() == "vulkan") "vulkanRelease" else "drawableRelease"])
60+
from(components["${renderer}Release"])
5661

5762
pom {
58-
name.set(project.extra["mapLibreArtifactTitle"].toString())
59-
description.set(project.extra["mapLibreArtifactTitle"].toString())
63+
name.set("${project.extra["mapLibreArtifactTitle"]}$descriptionPostfix")
64+
description.set("${project.extra["mapLibreArtifactTitle"]}$descriptionPostfix")
6065
url.set(project.extra["mapLibreArtifactUrl"].toString())
6166
licenses {
6267
license {
@@ -68,7 +73,7 @@ afterEvaluate {
6873
developer {
6974
id.set(project.extra["mapLibreDeveloperId"].toString())
7075
name.set(project.extra["mapLibreDeveloperName"].toString())
71-
email.set("maplibre@maplibre.org")
76+
email.set("team@maplibre.org")
7277
}
7378
}
7479
scm {
@@ -80,7 +85,24 @@ afterEvaluate {
8085
}
8186
}
8287
}
88+
}
8389

90+
91+
// workaround for https://github.com/gradle/gradle/issues/26091#issuecomment-1836156762
92+
// https://github.com/gradle-nexus/publish-plugin/issues/208
93+
tasks {
94+
withType<PublishToMavenRepository> {
95+
dependsOn(withType<Sign>())
96+
}
97+
}
98+
99+
afterEvaluate {
100+
configureMavenPublication("drawable", "opengl", "", "")
101+
configureMavenPublication("vulkan", "vulkan", "-vulkan", "(Vulkan)")
102+
// Right now this is the same as the first, but in the future we might release a major version
103+
// which defaults to Vulkan (or has support for multiple backends). We will keep using only
104+
// OpenGL ES with this artifact ID if that happens.
105+
configureMavenPublication("drawable", "opengl2", "-opengl", " (OpenGL ES)")
84106
}
85107

86108

0 commit comments

Comments
 (0)