Skip to content

Commit

Permalink
Merge branch 'main' into pmtiles-support
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers authored Jan 4, 2025
2 parents 28c4b01 + 0efd06c commit 2e20f53
Show file tree
Hide file tree
Showing 73 changed files with 360 additions and 228 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ jobs:
working-directory: test/android

steps:
- name: Free Disk Space (Ubuntu)
if: startsWith(runner.name, 'GitHub Actions')
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: false
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false

- uses: actions/checkout@v4
with:
submodules: recursive
Expand Down
80 changes: 34 additions & 46 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@ name: android-release

on:
workflow_dispatch:
inputs:
renderer:
description: "Select renderering backend"
required: true
default: "OpenGL"
type: choice
options:
- OpenGL
- Vulkan

jobs:
build:
runs-on: ubuntu-24.04
runs-on: MapLibre_Native_Ubuntu_24_04_x84_16_core
defaults:
run:
working-directory: platform/android
Expand All @@ -28,17 +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
with:
distribution: "temurin"
Expand All @@ -65,6 +45,7 @@ jobs:
- name: Update version name
run: |
RELEASE_VERSION="$( git describe --tags --match=android-v*.*.* --abbrev=0 | sed 's/^android-v//' )"
echo version="$RELEASE_VERSION" >> "$GITHUB_ENV"
echo "Latest version from tag: $RELEASE_VERSION"
if [ -n "$RELEASE_VERSION" ]; then
sed -i -e "s/^VERSION_NAME=.*/VERSION_NAME=${RELEASE_VERSION}/" MapLibreAndroid/gradle.properties
Expand All @@ -74,20 +55,9 @@ jobs:
shell: bash

- name: Build package
run: make apackage
env:
RENDERER: ${{ env.backend_lowercase }}

- name: Build release Test App
run: |
MAPLIBRE_DEVELOPER_CONFIG_XML='${{ secrets.MAPLIBRE_DEVELOPER_CONFIG_XML }}'
if [ -n "${MAPLIBRE_DEVELOPER_CONFIG_XML}" ]; then
echo "${MAPLIBRE_DEVELOPER_CONFIG_XML}" > MapLibreAndroidTestApp/src/main/res/values/developer-config.xml
make android
else
echo "No secrets.MAPLIBRE_DEVELOPER_CONFIG_XML variable set, skipping apk build..."
fi
shell: bash
RENDERER=vulkan make apackage
RENDERER=drawable make apackage
# create github release
- name: Prepare release
Expand All @@ -99,15 +69,15 @@ jobs:
echo version_tag="$( git describe --tags --match=android-v*.*.* --abbrev=0 )" >> "$GITHUB_OUTPUT"
shell: bash

- name: Check if version is valid semver
- name: Check if version is pre-release
id: check_version
run: |
version_tag="${{ steps.prepare_release.outputs.version_tag }}"
if [[ $version_tag =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Valid semver: $version_tag"
version="${{ env.version }}"
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Valid semver: $version"
echo "prerelease=false" >> "$GITHUB_ENV"
else
echo "Invalid semver: $version_tag"
echo "Invalid semver: $version"
echo "prerelease=true" >> "$GITHUB_ENV"
fi
Expand All @@ -123,25 +93,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
Expand All @@ -164,4 +153,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 }}
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-android-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: ./gradlew dokkaGenerate

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.6.9
uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
branch: gh-pages
folder: platform/android/MapLibreAndroid/build/dokka/html
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-android-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: make mkdocs-build

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.6.9
uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
branch: gh-pages
folder: platform/android/site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-cpp-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: doxygen

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.6.9
uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
branch: gh-pages
folder: docs/doxygen/html
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-mdbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
name: book
path: artifacts/book
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.6.9
uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
branch: gh-pages
folder: artifacts/book
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jobs:
- name: Deploy DocC documentation (main) 🚀
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4.6.9
uses: JamesIves/github-pages-deploy-action@v4.7.2
continue-on-error: true
with:
branch: gh-pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: mozilla-actions/[email protected].6
- uses: mozilla-actions/[email protected].7

- name: Initialize sccache
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
- id: actionlint
additional_dependencies: [shellcheck-py]
- repo: https://github.com/nicklockwood/SwiftFormat
rev: "0.55.2"
rev: "0.55.3"
hooks:
- id: swiftformat
args: [--swiftversion, "5.8"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class MainActivity : AppCompatActivity() {
```
</details>

For more information, refer to the [Android API Documentation](https://maplibre.org/maplibre-native/android/api/), [Android Examples Documentation](https://maplibre.org/maplibre-native/docs/book/android/getting-started-guide.html) or the [MapLibre Native Android `README.md`](platform/android/README.md).
For more information, refer to the [Android API Documentation](https://maplibre.org/maplibre-native/android/api/), [Android Examples Documentation](https://maplibre.org/maplibre-native/android/examples/getting-started/) or the [MapLibre Native Android `README.md`](platform/android/README.md).

## iOS

Expand Down Expand Up @@ -213,7 +213,7 @@ xed platform/ios/MapLibre.xcodeproj

To generate and open the Xcode project.

More information: [`platform/android/CONTRIBUTING.md`](platform/ios/CONTRIBUTING.md).
More information: [`platform/ios/CONTRIBUTING.md`](platform/ios/CONTRIBUTING.md).

## Other Platforms

Expand Down
2 changes: 1 addition & 1 deletion benchmark/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions benchmark/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
33 changes: 22 additions & 11 deletions bin/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ int main(int argc, char* argv[]) {
args::ValueFlag<uint32_t> widthValue(argumentParser, "pixels", "Image width", {'w', "width"});
args::ValueFlag<uint32_t> heightValue(argumentParser, "pixels", "Image height", {'h', "height"});

args::ValueFlag<std::string> mapModeValue(
argumentParser, "MapMode", "Map mode (e.g. 'static', 'tile', 'continuous')", {'m', "mode"});

try {
argumentParser.ParseCLI(argc, argv);
} catch (const args::Help&) {
Expand Down Expand Up @@ -79,18 +82,26 @@ int main(int argc, char* argv[]) {

util::RunLoop loop;

MapMode mapMode = MapMode::Static;
if (mapModeValue) {
const auto modeStr = args::get(mapModeValue);
if (modeStr == "tile") {
mapMode = MapMode::Tile;
} else if (modeStr == "continuous") {
mapMode = MapMode::Continuous;
}
}

HeadlessFrontend frontend({width, height}, static_cast<float>(pixelRatio));
Map map(frontend,
MapObserver::nullObserver(),
MapOptions()
.withMapMode(MapMode::Static)
.withSize(frontend.getSize())
.withPixelRatio(static_cast<float>(pixelRatio)),
ResourceOptions()
.withCachePath(cache_file)
.withAssetPath(asset_root)
.withApiKey(apikey)
.withTileServerOptions(mapTilerConfiguration));
Map map(
frontend,
MapObserver::nullObserver(),
MapOptions().withMapMode(mapMode).withSize(frontend.getSize()).withPixelRatio(static_cast<float>(pixelRatio)),
ResourceOptions()
.withCachePath(cache_file)
.withAssetPath(asset_root)
.withApiKey(apikey)
.withTileServerOptions(mapTilerConfiguration));

if (style.find("://") == std::string::npos) {
style = std::string("file://") + style;
Expand Down
3 changes: 2 additions & 1 deletion include/mbgl/vulkan/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class Context final : public gfx::Context {
void enqueueDeletion(std::function<void(Context&)>&& function);
void submitOneTimeCommand(const std::function<void(const vk::UniqueCommandBuffer&)>& function) const;

void requestSurfaceUpdate() { surfaceUpdateRequested = true; }
void requestSurfaceUpdate(bool useDelay = true);

private:
struct FrameResources {
Expand Down Expand Up @@ -197,6 +197,7 @@ class Context final : public gfx::Context {
uint8_t frameResourceIndex = 0;
std::vector<FrameResources> frameResources;
bool surfaceUpdateRequested{false};
int32_t surfaceUpdateLatency{0};
int32_t currentFrameCount{0};

struct {
Expand Down
36 changes: 35 additions & 1 deletion platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
# Changelog MapLibre Native for Android

## main
## 11.7.1

> [!NOTE]
> We are now releasing OpenGL ES and Vulkan variants of MapLibre Android. See the [11.7.0 release notes](https://github.com/maplibre/maplibre-native/releases/tag/android-v11.7.0) for details.
### ✨ Features and improvements

- Batch up scheduling of deferred deletions ([#3030](https://github.com/maplibre/maplibre-native/pull/3030)).
- Specify Vulkan version needed in AndroidManifest.xml ([#3095](https://github.com/maplibre/maplibre-native/pull/3095)).

### 🐞 Bug fixes

- Remove `Pass3D` ([#3077](https://github.com/maplibre/maplibre-native/pull/3077)).
Fixes issue where filters applied to fill extrusion layers are not rendered unless a manual zoom is applied to the map ([#3039](https://github.com/maplibre/maplibre-native/issues/3039)).

## 11.7.0

This release marks the official release of MapLibre Android with Vulkan support. [Vulkan](https://www.vulkan.org) is a modern graphics API which brings advantages such as improved performance, improved observability and better stability. Specifically, starting with this version we are releasing multiple versions of MapLibre Android:

- `org.maplibre.gl:android-sdk` (still OpenGL ES for now, might default to another rendering backend or might choose depending on device support in a future major release).
- `org.maplibre.gl:android-sdk-opengl` (OpenGL ES).
- `org.maplibre.gl:android-sdk-vulkan` (Vulkan).

Stability has proven to be excellent, but there are a few [known issues with Vulkan](https://github.com/maplibre/maplibre-native/issues?q=is%3Aissue%20state%3Aopen%20label%3AVulkan%20type%3ABug) that will be addressed in a future update.

Currently it is not possible to choose a backend at runtime. If you care about supporting devices that only support OpenGL ES and you want to use Vulkan, you will need to produce and ship [multiple APKs](https://developer.android.com/google/play/publishing/multiple-apks). Please see [this issue](https://github.com/maplibre/maplibre-native/issues/3079) if you are interested in choosing a rendering backend during initialization.

Thanks to everyone who helped test the pre-releases!

### ✨ Features and improvements

- Fix the issue that the empty polyline cannot be updated ([#3046](https://github.com/maplibre/maplibre-native/pull/3046)).
- feat: add `getZoom` and `setZoom` function support for Android Auto ([#3037](https://github.com/maplibre/maplibre-native/pull/3037)).
- Use MapLibre Android as attribution string across languages ([#3080](https://github.com/maplibre/maplibre-native/pull/3080)).
- Use CMake 3.24.0+ for Android ([#3065](https://github.com/maplibre/maplibre-native/pull/3065)).

### 🐞 Bug fixes

- Fix crash on unsupported attribute type conversion ([#3066](https://github.com/maplibre/maplibre-native/pull/3066)).

## 11.6.1

### 🐞 Bug fixes
Expand Down
Loading

0 comments on commit 2e20f53

Please sign in to comment.