Skip to content

Commit

Permalink
Merge branch 'main' into ubo-consolidation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcristici authored Jan 7, 2025
2 parents fdb64c3 + c7e6b0c commit 349ee17
Show file tree
Hide file tree
Showing 48 changed files with 454 additions and 257 deletions.
26 changes: 7 additions & 19 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

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 @@ -19,8 +19,6 @@ jobs:
submodules: recursive
fetch-depth: 0

- run: echo "cmake.dir=$(dirname "$(dirname "$(command -v cmake)")")" >> local.properties

- uses: actions/setup-java@v4
with:
distribution: "temurin"
Expand All @@ -47,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 @@ -60,17 +59,6 @@ jobs:
RENDERER=vulkan make apackage
RENDERER=drawable make apackage
- 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

# create github release
- name: Prepare release
id: prepare_release
Expand All @@ -81,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 Down
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
11 changes: 2 additions & 9 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ bazel_dep(name = "rules_swift", version = "2.2.3", repo_name = "build_bazel_rule
bazel_dep(name = "rules_xcodeproj", version = "2.8.1")
bazel_dep(name = "aspect_rules_js", version = "2.1.0")
bazel_dep(name = "rules_nodejs", version = "6.3.2")
bazel_dep(name = "libuv", version = "1.48.0")

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)
node.toolchain(node_version = "20.14.0")
Expand Down Expand Up @@ -54,16 +55,8 @@ http_archive(
urls = ["https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip"],
)

new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")

new_local_repository(
name = "libuv",
build_file = "@//vendor:libuv.BUILD",
path = "/opt/homebrew/opt/libuv",
)

darwin_config = use_repo_rule("//platform/darwin:bazel/darwin_config_repository_rule.bzl", "darwin_config")

darwin_config(
name = "darwin_config",
)
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
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
6 changes: 5 additions & 1 deletion docs/mdbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

## Build Locally

Get the `mdbook` utility, see https://rust-lang.github.io/mdBook/guide/installation.html
Get the `mdbook` utility as well as [`mdbook-alerts`](https://github.com/lambdalisue/rs-mdbook-alerts), see https://rust-lang.github.io/mdBook/guide/installation.html

```
cargo install mdbook mdbook-alerts
```

Run

Expand Down
4 changes: 3 additions & 1 deletion docs/mdbook/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ authors = ["MapLibre Contributors"]
language = "en"
multilingual = false
src = "src"
title = "MapLibre Native Documentation"
title = "MapLibre Native Developer Documentation"

[output.html]
additional-css = ["diff.css"]

[preprocessor.alerts]
24 changes: 17 additions & 7 deletions docs/mdbook/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

[Introduction](./introduction.md)

- [Platforms](./platforms.md)

- [Android](./android/README.md)
- [Tests](./android/android-tests.md)
- [Documentation](./android/android-documentation.md)

- [iOS](./ios/README.md)
- [Tests](ios/ios-tests.md)
- [Documentation](ios/ios-documentation.md)

- [Design](./design/README.md)
- [Ten Thousand Foot View](design/ten-thousand-foot-view.md)
- [Coordinate System](design/coordinate-system.md)
- [Expressions](design/expressions.md)
- [Architectural Problems and Recommendations](design/archictural-problems-and-recommendations.md)
- [Android Map Rendering Data Flow](design/android-map-rendering-data-flow.md)
- [Geometry Tile Worker](design/geometry-tile-worker.md)
- [Ten Thousand Foot View](design/ten-thousand-foot-view.md)
- [Coordinate System](design/coordinate-system.md)
- [Expressions](design/expressions.md)
- [Architectural Problems and Recommendations](design/archictural-problems-and-recommendations.md)
- [Android Map Rendering Data Flow](design/android-map-rendering-data-flow.md)
- [Geometry Tile Worker](design/geometry-tile-worker.md)

- [Profiling applications that use MapLibre Native](./profiling/README.md)
- [Tracy profiling](./profiling/tracy-profiling.md)
- [Tracy profiling](./profiling/tracy-profiling.md)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Developing - MapLibre Native for Android
# MapLibre Android Developer Guide

These instructions are for developers interested in making code-level contributions to MapLibre Native for Android.

Expand Down Expand Up @@ -33,34 +33,6 @@ Run the configuration for the `MapLibreAndroidTestApp` module and select a devic
<img src="https://github.com/maplibre/maplibre-native/assets/649392/5494925e-8cbb-4d5d-8033-8a2f141ede3c" alt="Android TestApp menu" width="15%"> <img src="https://github.com/maplibre/maplibre-native/assets/649392/f169db51-615d-4fca-b297-ac6197bec674" alt="Android TestApp showing Demotiles" width="15%">
</p>

## Render Tests

To run the render tests for Android, run the configuration for the `androidRenderTest.app` module.

More information on working on the render tests can be found [in the wiki](https://github.com/maplibre/maplibre-native/wiki/Working-on-Android-Render-Tests).

## Instrumentation Tests

To run the instrumentation tests, choose the "Instrumentation Tests" run configuration.

Your device needs remain unlocked for the duration of the tests.

## C++ Unit Tests

There is a separate Gradle project that contains a test app which runs the C++ Unit Tests. It does not depend on the Android platform implementations.

You can find the project in `test/android.` You can open this project in Android Studio and run the C++ Tests on an Android device or Simulator.

To run a particular set of tests you can modify the `--gtest_filter` flag in `platform/android/src/test/test_runner.cpp`. See the [GoogleTest documentation](https://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests) for details how to use this flag.

### AWS Device Farm

The instrumentation tests and C++ unit tests are running on AWS Device Farm. To see the results and the logs, go to:

https://us-west-2.console.aws.amazon.com/devicefarm/home?region=us-east-1#/mobile/projects/20687d72-0e46-403e-8f03-0941850665bc/runs

You can log in with the `maplibre` alias, with `maplibre` as username and `maplibre` as password (this is a read-only account).

## Kotlin

All new code should be written in [Kotlin](https://kotlinlang.org/).
Expand Down Expand Up @@ -91,11 +63,4 @@ To run the benchmarks (for Android) include the following line on a PR comment:

## Profiling

[maplibre-native/docs/mdbook](https://maplibre.org/maplibre-native/docs/book/) describes how Tracy can be used for profiling.


## Documentation

We use Dokka for the API documentation.

The documentation site with examples uses MkDocs along with Material for MkDocs. For more information on how to work on the examples, see [`docs/README.md`](./docs/REAME.md`).
See [Tracy Profiling](/profiling/tracy-profiling.md) to understand how Tracy can be used for profiling.
49 changes: 49 additions & 0 deletions docs/mdbook/src/android/android-documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Documentation for MapLibre Android

## API Documentation

We use Dokka for the MapLibre Android API documentation. The live documentation site can be found [here](https://maplibre.org/maplibre-native/android/api/).

## Examples Documentation

The documentation site with examples uses MkDocs along with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/). You can check out the site [here](https://maplibre.org/maplibre-native/android/examples/).

### Building

To build the Examples Documentation you need to have Docker installed.

From `platform/android`, run:

```
make mkdocs
```

Next, visit [`http://localhost:8000/maplibre-native/android/examples/`](http://localhost:8000/maplibre-native/android/examples/).

### Snippets

We use [a Markdown extension for snippets](https://facelessuser.github.io/pymdown-extensions/extensions/snippets/#snippet-sections). This way code can be referenced instead of copy pasted into the documentation. This avoids code examples from becoming out of date or failing to compile. The syntax is as follows:

````kotlin
// --8<-- [start:fun]
fun double(x: Int): Int {
return 2 * x
}
// --8<-- [end:fun]
````

Next, you'll be able to reference that piece of code in Markdown like so:

```
--8<-- "example.kt:fun"
```

Where `example.kt` is the path to the file.

### Static Assets

Static assets are ideally uploaded to the [MapLibre Native S3 Bucket](https://maplibre-native.s3.eu-central-1.amazonaws.com/index.html#android-documentation-resources/).

Please open an issue with the ARN of your AWS account to get upload privileges.

You can use the macro `{{ s3_url("filename.example") }}` which will use a CDN instead of linking to the S3 bucket directly.
Loading

0 comments on commit 349ee17

Please sign in to comment.