diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 6fa39007aa2..8bcab6cd79e 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -2,15 +2,6 @@ name: android-release on: workflow_dispatch: - inputs: - renderer: - description: "Select renderering backend" - required: true - default: "OpenGL" - type: choice - options: - - OpenGL - - Vulkan jobs: build: @@ -28,15 +19,6 @@ jobs: submodules: recursive fetch-depth: 0 - - name: Map renderer input - id: backend_lowercase - run: | - if [ "${{ github.event.inputs.renderer }}" = "OpenGL" ]; then - echo "backend_lowercase=drawable" >> "$GITHUB_ENV" - elif [ "${{ github.event.inputs.renderer }}" = "Vulkan" ]; then - echo "backend_lowercase=vulkan" >> "$GITHUB_ENV" - fi - - run: echo "cmake.dir=$(dirname "$(dirname "$(command -v cmake)")")" >> local.properties - uses: actions/setup-java@v4 @@ -74,9 +56,9 @@ jobs: shell: bash - name: Build package - run: make apackage - env: - RENDERER: ${{ env.backend_lowercase }} + run: | + RENDERER=vulkan make apackage + RENDERER=opengl make apackage - name: Build release Test App run: | @@ -123,25 +105,44 @@ jobs: draft: false prerelease: ${{ env.prerelease }} - - name: Upload aar - id: upload-release-asset + - name: Upload aar (OpenGL) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: platform/android/MapLibreAndroid/build/outputs/aar/MapLibreAndroid-${{ env.backend_lowercase }}-release.aar + asset_path: platform/android/MapLibreAndroid/build/outputs/aar/MapLibreAndroid-drawable-release.aar asset_name: MapLibreAndroid-release.aar asset_content_type: application/zip - - name: Upload debug symbols + - name: Upload aar (Vulkan) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: platform/android/MapLibreAndroid/build/outputs/aar/MapLibreAndroid-vulkan-release.aar + asset_name: MapLibreAndroid-release-vulkan.aar + asset_content_type: application/zip + + - name: Upload debug symbols (OpenGL) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: platform/android/build/debug-symbols-opengl.tar.gz + asset_name: debug-symbols-maplibre-android-opengl-${{ steps.prepare_release.outputs.version_tag }}.tar.gz + asset_content_type: application/gzip + + - name: Upload debug symbols (Vulkan) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: platform/android/build/debug-symbols.tar.gz - asset_name: debug-symbols.tar.gz + asset_path: platform/android/build/debug-symbols-vulkan.tar.gz + asset_name: debug-symbols-maplibre-android-vulkan-${{ steps.prepare_release.outputs.version_tag }}.tar.gz asset_content_type: application/gzip - name: Clean release @@ -164,4 +165,3 @@ jobs: SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} - RENDERER: ${{ env.backend_lowercase }} diff --git a/platform/android/Makefile b/platform/android/Makefile index c1621751f82..8b1a85738e8 100644 --- a/platform/android/Makefile +++ b/platform/android/Makefile @@ -223,6 +223,8 @@ run-android-unit-test: run-android-unit-test-%: $(MLN_ANDROID_GRADLE) -Pmaplibre.abis=none :MapLibreAndroid:testLegacyDebugUnitTest --info --tests "$*" +DEBUG_TAR_FILE_NAME := $(if $(findstring drawable,$(RENDERER)),debug-symbols-opengl.tar.gz,debug-symbols-$(RENDERER).tar.gz) + # Builds a release package and .tar.gz with debug symbols of the Android SDK .PHONY: apackage apackage: @@ -230,7 +232,7 @@ apackage: make android-lib-arm-v7 && make android-lib-arm-v8 && make android-lib-x86 && make android-lib-x86-64 $(MLN_ANDROID_GRADLE) -Pmaplibre.abis=all assemble$(RENDERER)$(BUILDTYPE) mkdir -p build - tar -czvf build/debug-symbols.tar.gz -C MapLibreAndroid/build/intermediates/library_jni/*/*JniLibsProjectOnly/jni . + tar -czvf build/$(DEBUG_TAR_FILE_NAME) -C MapLibreAndroid/build/intermediates/library_jni/$(RENDERER)Release/*JniLibsProjectOnly/jni . # Build test app instrumentation tests apk and test app apk for all abi's .PHONY: android-ui-test @@ -245,7 +247,7 @@ run-android-test-app-center: # Uploads the compiled Android SDK to Maven Central Staging .PHONY: run-android-publish run-android-publish: - $(MLN_ANDROID_GRADLE_SINGLE_JOB)-Pmaplibre.abis=all :MapLibreAndroid:publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository + $(MLN_ANDROID_GRADLE_SINGLE_JOB)-Pmaplibre.abis=all :MapLibreAndroid:publishAllPublicationsToSonatypeRepository closeAndReleaseSonatypeStagingRepository # Dump system graphics information for the test app .PHONY: android-gfxinfo diff --git a/platform/android/buildSrc/src/main/kotlin/maplibre.artifact-settings.gradle.kts b/platform/android/buildSrc/src/main/kotlin/maplibre.artifact-settings.gradle.kts index 91784526335..20ef7345923 100644 --- a/platform/android/buildSrc/src/main/kotlin/maplibre.artifact-settings.gradle.kts +++ b/platform/android/buildSrc/src/main/kotlin/maplibre.artifact-settings.gradle.kts @@ -1,7 +1,7 @@ extra["mapLibreArtifactGroupId"] = "org.maplibre.gl" extra["mapLibreArtifactId"] = "android-sdk" -extra["mapLibreArtifactTitle"] = "MapLibre Maps SDK for Android" -extra["mapLibreArtifactDescription"] = "MapLibre Maps SDK for Android" +extra["mapLibreArtifactTitle"] = "MapLibre Android" +extra["mapLibreArtifactDescription"] = "MapLibre Android" extra["mapLibreDeveloperName"] = "MapLibre" extra["mapLibreDeveloperId"] = "maplibre" extra["mapLibreArtifactUrl"] = "https://github.com/maplibre/maplibre-native" diff --git a/platform/android/buildSrc/src/main/kotlin/maplibre.gradle-publish.gradle.kts b/platform/android/buildSrc/src/main/kotlin/maplibre.gradle-publish.gradle.kts index aff14ef5983..3058a4232f3 100644 --- a/platform/android/buildSrc/src/main/kotlin/maplibre.gradle-publish.gradle.kts +++ b/platform/android/buildSrc/src/main/kotlin/maplibre.gradle-publish.gradle.kts @@ -1,4 +1,5 @@ import org.gradle.kotlin.dsl.get +import java.util.Locale plugins { `maven-publish` @@ -43,20 +44,24 @@ project.logger.lifecycle(project.extra["versionName"].toString()) version = project.extra["versionName"] as String group = project.extra["mapLibreArtifactGroupId"] as String -afterEvaluate { +fun configureMavenPublication( + renderer: String, + publicationName: String, + artifactIdPostfix: String, + descriptionPostfix: String, +) { publishing { publications { - create("release") { - groupId = this@afterEvaluate.group.toString() - artifactId = project.extra["mapLibreArtifactId"].toString() - version = this@afterEvaluate.version.toString() + create(publicationName) { + groupId = project.group.toString() + artifactId = "${project.extra["mapLibreArtifactId"]}$artifactIdPostfix" + version = project.version.toString() - // Conditional component selection based on environment variable - from(components[if (System.getenv("RENDERER")?.lowercase() == "vulkan") "vulkanRelease" else "drawableRelease"]) + from(components["${renderer}Release"]) pom { - name.set(project.extra["mapLibreArtifactTitle"].toString()) - description.set(project.extra["mapLibreArtifactTitle"].toString()) + name.set("${project.extra["mapLibreArtifactTitle"]}$descriptionPostfix") + description.set("${project.extra["mapLibreArtifactTitle"]}$descriptionPostfix") url.set(project.extra["mapLibreArtifactUrl"].toString()) licenses { license { @@ -68,7 +73,7 @@ afterEvaluate { developer { id.set(project.extra["mapLibreDeveloperId"].toString()) name.set(project.extra["mapLibreDeveloperName"].toString()) - email.set("maplibre@maplibre.org") + email.set("team@maplibre.org") } } scm { @@ -80,7 +85,24 @@ afterEvaluate { } } } +} + +// workaround for https://github.com/gradle/gradle/issues/26091#issuecomment-1836156762 +// https://github.com/gradle-nexus/publish-plugin/issues/208 +tasks { + withType { + dependsOn(withType()) + } +} + +afterEvaluate { + configureMavenPublication("drawable", "opengl", "", "") + configureMavenPublication("vulkan", "vulkan", "-vulkan", "(Vulkan)") + // Right now this is the same as the first, but in the future we might release a major version + // which defaults to Vulkan (or has support for multiple backends). We will keep using only + // OpenGL ES with this artifact ID if that happens. + configureMavenPublication("drawable", "opengl2", "-opengl", " (OpenGL ES)") }