diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 02fb0f71c7b..35594f091c8 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -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 @@ -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" @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/gh-pages-android-api.yml b/.github/workflows/gh-pages-android-api.yml index abe4b3fc690..5f327f21091 100644 --- a/.github/workflows/gh-pages-android-api.yml +++ b/.github/workflows/gh-pages-android-api.yml @@ -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 diff --git a/.github/workflows/gh-pages-android-examples.yml b/.github/workflows/gh-pages-android-examples.yml index 5ebde8efcd0..090401df1a6 100644 --- a/.github/workflows/gh-pages-android-examples.yml +++ b/.github/workflows/gh-pages-android-examples.yml @@ -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 diff --git a/.github/workflows/gh-pages-cpp-api.yml b/.github/workflows/gh-pages-cpp-api.yml index f2e9efa39a5..1095e1fbad3 100644 --- a/.github/workflows/gh-pages-cpp-api.yml +++ b/.github/workflows/gh-pages-cpp-api.yml @@ -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 diff --git a/.github/workflows/gh-pages-mdbook.yml b/.github/workflows/gh-pages-mdbook.yml index cb76f166427..1ebce477a66 100644 --- a/.github/workflows/gh-pages-mdbook.yml +++ b/.github/workflows/gh-pages-mdbook.yml @@ -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 diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index 7310a6f3bb8..f838c023f09 100644 --- a/.github/workflows/ios-ci.yml +++ b/.github/workflows/ios-ci.yml @@ -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 diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index d00231ebeba..4e3f479aae5 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -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/sccache-action@v0.0.6 + - uses: mozilla-actions/sccache-action@v0.0.7 - name: Initialize sccache run: | diff --git a/MODULE.bazel b/MODULE.bazel index fc8010bcf7c..3cdd4ed1335 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -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") @@ -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", -) +) \ No newline at end of file diff --git a/README.md b/README.md index 0daf7868cf4..26df2071c1f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/benchmark/android/gradle/wrapper/gradle-wrapper.properties b/benchmark/android/gradle/wrapper/gradle-wrapper.properties index c1d5e018598..e0fd02028bc 100644 --- a/benchmark/android/gradle/wrapper/gradle-wrapper.properties +++ b/benchmark/android/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/benchmark/android/gradlew b/benchmark/android/gradlew index f5feea6d6b1..f3b75f3b0d4 100755 --- a/benchmark/android/gradlew +++ b/benchmark/android/gradlew @@ -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 diff --git a/bin/render.cpp b/bin/render.cpp index 26e1fa11ba0..6520f7baff1 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -38,6 +38,9 @@ int main(int argc, char* argv[]) { args::ValueFlag widthValue(argumentParser, "pixels", "Image width", {'w', "width"}); args::ValueFlag heightValue(argumentParser, "pixels", "Image height", {'h', "height"}); + args::ValueFlag mapModeValue( + argumentParser, "MapMode", "Map mode (e.g. 'static', 'tile', 'continuous')", {'m', "mode"}); + try { argumentParser.ParseCLI(argc, argv); } catch (const args::Help&) { @@ -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(pixelRatio)); - Map map(frontend, - MapObserver::nullObserver(), - MapOptions() - .withMapMode(MapMode::Static) - .withSize(frontend.getSize()) - .withPixelRatio(static_cast(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(pixelRatio)), + ResourceOptions() + .withCachePath(cache_file) + .withAssetPath(asset_root) + .withApiKey(apikey) + .withTileServerOptions(mapTilerConfiguration)); if (style.find("://") == std::string::npos) { style = std::string("file://") + style; diff --git a/docs/mdbook/README.md b/docs/mdbook/README.md index 268e1aec7f8..9e4a483131d 100644 --- a/docs/mdbook/README.md +++ b/docs/mdbook/README.md @@ -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 diff --git a/docs/mdbook/book.toml b/docs/mdbook/book.toml index 120536f1290..f68116e87f7 100644 --- a/docs/mdbook/book.toml +++ b/docs/mdbook/book.toml @@ -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] diff --git a/docs/mdbook/src/SUMMARY.md b/docs/mdbook/src/SUMMARY.md index ce37391c1c4..d07b042abd6 100644 --- a/docs/mdbook/src/SUMMARY.md +++ b/docs/mdbook/src/SUMMARY.md @@ -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) diff --git a/platform/android/DEVELOPING.md b/docs/mdbook/src/android/README.md similarity index 53% rename from platform/android/DEVELOPING.md rename to docs/mdbook/src/android/README.md index e8e19dd3e09..192d2f9ae25 100644 --- a/platform/android/DEVELOPING.md +++ b/docs/mdbook/src/android/README.md @@ -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. @@ -33,34 +33,6 @@ Run the configuration for the `MapLibreAndroidTestApp` module and select a devic Android TestApp menu Android TestApp showing Demotiles

-## 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/). @@ -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`). \ No newline at end of file +See [Tracy Profiling](/profiling/tracy-profiling.md) to understand how Tracy can be used for profiling. \ No newline at end of file diff --git a/docs/mdbook/src/android/android-documentation.md b/docs/mdbook/src/android/android-documentation.md new file mode 100644 index 00000000000..26c0932b2e1 --- /dev/null +++ b/docs/mdbook/src/android/android-documentation.md @@ -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. \ No newline at end of file diff --git a/docs/mdbook/src/android/android-tests.md b/docs/mdbook/src/android/android-tests.md new file mode 100644 index 00000000000..6e7e971195a --- /dev/null +++ b/docs/mdbook/src/android/android-tests.md @@ -0,0 +1,91 @@ +# MapLibre Android Tests + +## Render Tests + +To run the render tests for Android, run the configuration for the `androidRenderTest.app` module. + +### Filtering Render Tests + +You can filter the tests to run by passing a flag to the file `platform/android/src/test/render_test_runner.cpp`: + +```cpp +std::vector arguments = {..., "-f", "background-color/literal"}; +``` + +### Viewing the Results + +Once the application quits, use the Device Explorer to navigate to `/data/data/org.maplibre.render_test_runner/files`. + +image + +Double click `android-render-test-runner-style.html`. Right click on the opened tab and select _Open In > Browser_. You should see that a single render test passed. + +image + +Alternatively to download (and open) the results from the command line, use: + +``` +adb shell "run-as org.maplibre.render_test_runner cat files/metrics/android-render-test-runner-style.html" > android-render-test-runner-style.html +open android-render-test-runner-style.html +``` + +### Updating the Render Tests + +Now let's edit `metrics/integration/render-tests/background-color/literal/style.json`, change this line: + +``` + "background-color": "red" +``` + +to + +``` + "background-color": "yellow" +``` + +We need to make sure that the new `data.zip` with the data for the render tests is installed on the device. You can use the following commands: + +``` +tar chf render-test/android/app/src/main/assets/data.zip --format=zip --files-from=render-test/android/app/src/main/assets/to_zip.txt +adb push render-test/android/app/src/main/assets/data.zip /data/local/tmp/data.zip +adb shell chmod 777 /data/local/tmp/data.zip +adb shell "run-as org.maplibre.render_test_runner unzip -o /data/local/tmp/data.zip -d files" +``` + +Rerun the render test app and reload the Device Explorer. When you re-open the HTML file with the results you should now see a failing test: + +image + +Now download the `actual.png` in `metrics/integration/render-tests/background-color/literal` with the Device Explorer. Replace the corresponding `expected.png` on your local file system. Upload the new render test data again and run the test app once more. + +image + +Of we don't want to commit this change. But know you can add and debug (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](https://us-west-2.console.aws.amazon.com/devicefarm/home?region=us-east-1#/mobile/projects/20687d72-0e46-403e-8f03-0941850665bc/runs). + +Use the following login details (this is a read-only account): + +| | | +|------------|------------| +| Alias | `maplibre` | +| Username | `maplibre` | +| Password | `maplibre` | diff --git a/docs/mdbook/src/design/README.md b/docs/mdbook/src/design/README.md index f4af5367d00..02dec693c00 100644 --- a/docs/mdbook/src/design/README.md +++ b/docs/mdbook/src/design/README.md @@ -1,3 +1,6 @@ +> [!NOTE] +> These notes are partially outdated since the [renderer modularization](https://github.com/maplibre/maplibre-native/blob/main/design-proposals/2022-10-27-rendering-modularization.md). + # Design -This section is dedicated to documenting current state of MapLibre Native. [Architectural Problems and Recommendations](./archictural-problems-and-recommendations.md) section notes recommendations for future improvements from an architectural perspective. +This section is dedicated to documenting current state of MapLibre Native as of end 2022. [Architectural Problems and Recommendations](./archictural-problems-and-recommendations.md) section notes recommendations for future improvements from an architectural perspective. diff --git a/docs/mdbook/src/introduction.md b/docs/mdbook/src/introduction.md index b7c27c66915..43db78c31c5 100644 --- a/docs/mdbook/src/introduction.md +++ b/docs/mdbook/src/introduction.md @@ -3,3 +3,5 @@ *[MapLibre Native](https://github.com/maplibre/maplibre-native)* is a community led fork of *Mapbox GL Native*. It's a C++ library that powers vector maps in native applications on multiple platforms by taking stylesheets that conform to the *[MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/)*, a fork of the Mapbox Style Spec. Since it is derived from Mapbox's original work it also uses *Mapbox Vector Tile Specification* as its choice of vector tile format. + +This documentation is intended for developers of MapLibre Native. If you are interested in *using* MapLibre Native, check out the [main `README.md`](https://github.com/maplibre/maplibre-native?tab=readme-ov-file#maplibre-native) on GitHub. diff --git a/platform/ios/CONTRIBUTING.md b/docs/mdbook/src/ios/README.md similarity index 55% rename from platform/ios/CONTRIBUTING.md rename to docs/mdbook/src/ios/README.md index b17b955329c..208f34d3de3 100644 --- a/platform/ios/CONTRIBUTING.md +++ b/docs/mdbook/src/ios/README.md @@ -1,13 +1,4 @@ -# Contributing - -## Downloading Source - -Download the source and install all submodules if you have not already, by running the following from the root of the repository. - -``` -git clone --recurse-submodules git@github.com:maplibre/maplibre-native.git -cd maplibre-native -``` +# MapLibre iOS Developer Guide ## Bazel @@ -56,91 +47,32 @@ Try to run the example App in the simulator and on a device to confirm your setu > [!IMPORTANT] > The Bazel configuration files are the source of truth of the build configuration. All changes to the build settings need to be done through Bazel, not in Xcode. -### Troubleshooting Provisioning Profiles +### Troubleshooting + +#### Provisioning Profiles If you get a Python `KeyError` when processing provisioning profiles, you probably have some _really_ old or corrupted profiles. Have a look through `~/Library/MobileDevice/Provisioning\ Profiles` and remove any expired profiles. Removing all profiles here can also resolve some issues. -## Using Bazel from the Command Line +#### Cleaning Bazel environments -It is also possible to build and run the test application in a simulator from the command line without opening Xcode. +You should almost never have to do this, but sometimes problems can be solved with: ``` -bazel run //platform/ios:App --//:renderer=metal +bazel clean --expunge ``` -You can also build targets from the command line. For example, if you want to build your own XCFramework, see the 'Build XCFramework' step in the [iOS CI workflow](../../.github/workflows/ios-ci.yml). - -## Render Tests - -To run the render tests, run the `RenderTest` target from iOS. +## Using Bazel from the Command Line -When running in a simulator, use +It is also possible to build and run the test application in a simulator from the command line without opening Xcode. ``` -# check for 'DataContainer' of the app with `*.maplibre.RenderTestApp` id -xcrun simctl listapps booted +bazel run //platform/ios:App --//:renderer=metal ``` -to get the data directory of the render test app. This allows you to inspect test results. When adding new tests, the generated expectations and `actual.png` file can be copied into the source directory from here. - -## C++ Unit Tests - -Run the tests from the `CppUnitTests` target in Xcode to run the C++ Unit Tests on iOS. +You can also build targets from the command line. For example, if you want to build your own XCFramework, see the 'Build XCFramework' step in the [iOS CI workflow](../../.github/workflows/ios-ci.yml). ## Swift App -There is also an example app built with Swift instead of Objective-C. The target is called `MapLibreApp` and the source code lives in `platform/ios/app-swift`. - -## Documentation - -We use [DocC](https://www.swift.org/documentation/docc) for documentation. You need to have [aws-cli](https://github.com/aws/aws-cli) installed to download the resources from S3 (see below). Run the following command: - -``` -aws s3 sync --no-sign-request "s3://maplibre-native/ios-documentation-resources" "platform/ios/MapLibre.docc/Resources" -``` - -Then, to build the documentation locally, run the following command: - -``` -platform/ios/scripts/docc.sh preview -``` - -### Resources - -Resources like images should not be checked in but should be uploaded to the [S3 Bucket](https://s3.eu-central-1.amazonaws.com/maplibre-native/index.html#ios-documentation-resources/). You can share a `.zip` with all files that should be added in the PR. - -If you want to get direct access you need an AWS account to get permissions to upload files. Create an account and authenticate with aws-cli. Share the account ARN that you can get with - -``` -aws sts get-caller-identity -``` - -### Examples - -The code samples in the documentation should ideally be compiled on CI so they do not go out of date. - -Fence your example code with - -```swift -// #-example-code(LineTapMap) -... -// #-end-example-code -``` - -Prefix your documentation code block with - -````md - - -```swift -... -``` -```` - -Then the code block will be updated when you run: - -```sh -node scripts/update-ios-examples.mjs -``` +There is also an example app built with Swift instead of Objective-C. The target is called `MapLibreApp` and the source code lives in `platform/ios/app-swift`. \ No newline at end of file diff --git a/docs/mdbook/src/ios/ios-documentation.md b/docs/mdbook/src/ios/ios-documentation.md new file mode 100644 index 00000000000..bba85d1aa96 --- /dev/null +++ b/docs/mdbook/src/ios/ios-documentation.md @@ -0,0 +1,53 @@ +# iOS Documentation + +We use [DocC](https://www.swift.org/documentation/docc) for the MapLibre iOS documentation. The live documentation site can be found [here](https://maplibre.org/maplibre-native/ios/latest/documentation/maplibre/). + +## Resources + +You need to have [aws-cli](https://github.com/aws/aws-cli) installed to download the resources from S3 (see below). Run the following command: + +``` +aws s3 sync --no-sign-request "s3://maplibre-native/ios-documentation-resources" "platform/ios/MapLibre.docc/Resources" +``` + +Then, to build the documentation locally, run the following command: + +``` +platform/ios/scripts/docc.sh preview +``` + +Resources like images should not be checked in but should be uploaded to the [S3 Bucket](https://s3.eu-central-1.amazonaws.com/maplibre-native/index.html#ios-documentation-resources/). You can share a `.zip` with all files that should be added in the PR. + +If you want to get direct access you need an AWS account to get permissions to upload files. Create an account and authenticate with aws-cli. Share the account ARN that you can get with + +``` +aws sts get-caller-identity +``` + +## Examples + +The code samples in the documentation should ideally be compiled on CI so they do not go out of date. + +Fence your example code with + +```swift +// #-example-code(LineTapMap) +... +// #-end-example-code +``` + +Prefix your documentation code block with + +````md + + +```swift +... +``` +```` + +Then the code block will be updated when you run: + +```sh +node scripts/update-ios-examples.mjs +``` \ No newline at end of file diff --git a/docs/mdbook/src/ios/ios-tests.md b/docs/mdbook/src/ios/ios-tests.md new file mode 100644 index 00000000000..570f789ce7a --- /dev/null +++ b/docs/mdbook/src/ios/ios-tests.md @@ -0,0 +1,18 @@ +# iOS Tests + +## Render Tests + +To run the render tests, run the `RenderTest` target from iOS. + +When running in a simulator, use + +``` +# check for 'DataContainer' of the app with `*.maplibre.RenderTestApp` id +xcrun simctl listapps booted +``` + +to get the data directory of the render test app. This allows you to inspect test results. When adding new tests, the generated expectations and `actual.png` file can be copied into the source directory from here. + +## C++ Unit Tests + +Run the tests from the `CppUnitTests` target in Xcode to run the C++ Unit Tests on iOS. \ No newline at end of file diff --git a/docs/mdbook/src/platforms.md b/docs/mdbook/src/platforms.md new file mode 100644 index 00000000000..01b70ae8f8b --- /dev/null +++ b/docs/mdbook/src/platforms.md @@ -0,0 +1,56 @@ + +# Platforms + +This page describes the platforms that MapLibre Native is available on. + +## Overview + +MapLibre Native uses a monorepo. Source code for all platforms lives in [`maplibre/maplibre-native`](https://github.com/maplibre/maplibre-native) on GitHub. + +| Platform | Source | Notes | +|---|---|---| +| Android | [`platform/android`](https://github.com/maplibre/maplibre-native/tree/main/platform/android) | Integrates with the C++ core via JNI. | +| iOS | [`platform/ios`](https://github.com/maplibre/maplibre-native/tree/main/platform/ios), [`platform/darwin`](https://github.com/maplibre/maplibre-native/tree/main/platform/darwin) | Integrates with the C++ core via Objective-C++. | +| Linux | [`platform/linux`](https://github.com/maplibre/maplibre-native/tree/main/platform/linux) | Used for development. Also widely used in production for raster tile generation. | +| Windows | [`platform/windows`](https://github.com/maplibre/maplibre-native/tree/main/platform/windows) | | +| macOS | [`platform/macos`](https://github.com/maplibre/maplibre-native/tree/main/platform/macos), [`platform/darwin`](https://github.com/maplibre/maplibre-native/tree/main/platform/darwin) | Mainly used for development. There is some legacy AppKit code. | +| Node.js | [`platform/node`](https://github.com/maplibre/maplibre-native/tree/main/platform/node) | Uses [NAN](https://github.com/nodejs/nan). Available as [@maplibre/maplibre-gl-native](https://www.npmjs.com/package/@maplibre/maplibre-gl-native) on npm. | +| Qt | [maplibre/maplibre-qt](https://github.com/maplibre/maplibre-native/tree/main/platform/qt), [`platform/qt`](https://github.com/maplibre/maplibre-native) | Only platform that partially split to another repository. | + +Of these, **Android** and **iOS** are considered [core projects](https://github.com/maplibre/maplibre/blob/main/PROJECT_TIERS.md) of the MapLibre Organization. +### GLFW + +You can find an app that uses GLFW in [`platform/glfw`](https://github.com/maplibre/maplibre-native/tree/main/platform/glfw). It works on macOS, Linux and Windows. The app shows an interactive map that can be interacted with. Since GLFW adds relatively little complexity this app is used a lot for development. You can also learn about the C++ API by studying the source code of the GLFW app. + +## Rendering Backends + +Originally the project only supported OpenGL 2.0. In 2023, the [renderer was modularized](https://github.com/maplibre/maplibre-native/blob/main/design-proposals/2022-10-27-rendering-modularization.md) allowing for the implementation of alternate rendering backends. The first alternate rendering backend that was implemented was [Metal](https://maplibre.org/news/2024-01-19-metal-support-for-maplibre-native-ios-is-here/), followed by [Vulkan](https://maplibre.org/news/2024-12-12-maplibre-android-vulkan/). In the future other rendering backends could be implemented such as WebGPU. + +What platfroms support which rendering backend can be found below. + +| Platform | OpenGL ES 3.0 | Vulkan 1.0 | Metal | +|---|---|---|---| +| Android | βœ… | βœ… | ❌ | +| iOS | ❌ | ❌ | βœ… | +| Linux | βœ… | βœ… | ❌ | +| Windows | βœ… | ❌ | ❌ | +| macOS | ❌ | βœ… | βœ…[^1] | +| Node.js | βœ… | ❌ | βœ… [^2] | +| Qt | βœ… | ❌ | ❌ | + +[^1]: Requires MoltenVK. Only available when built via CMake. +[^2]: Issue reported, see [#2928](https://github.com/maplibre/maplibre-native/issues/2928). + +## Build Tooling + +In 2023 we co-opted Bazel as a build tool (generator), mostly due to it having better support for iOS compared to CMake. Some platforms can use CMake as well as Bazel. + +| Platform | CMake | Bazel | +|---|---|---| +| Android | βœ… (via Gradle) | ❌ | +| iOS | ❌ | βœ… | +| Linux | βœ… | βœ… | +| Windows | βœ… | ❌ | +| macOS | βœ… | βœ… | +| Node.js | βœ… | ❌ | +| Qt | βœ… | ❌ | diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 2884391bf55..2bedb5be327 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog MapLibre Native for Android +## 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: diff --git a/platform/android/MapLibreAndroid/gradle.properties b/platform/android/MapLibreAndroid/gradle.properties index 081f5a9742c..93fed717d85 100644 --- a/platform/android/MapLibreAndroid/gradle.properties +++ b/platform/android/MapLibreAndroid/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=11.7.0 +VERSION_NAME=11.7.1 # Only build native dependencies for the current ABI # See https://code.google.com/p/android/issues/detail?id=221098#c20 diff --git a/platform/android/MapLibreAndroid/src/drawable/AndroidManifest.xml b/platform/android/MapLibreAndroid/src/drawable/AndroidManifest.xml new file mode 100644 index 00000000000..6ea1b76300b --- /dev/null +++ b/platform/android/MapLibreAndroid/src/drawable/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/platform/android/MapLibreAndroid/src/main/AndroidManifest.xml b/platform/android/MapLibreAndroid/src/main/AndroidManifest.xml index d5e48eb75d0..e33d8ddcd70 100644 --- a/platform/android/MapLibreAndroid/src/main/AndroidManifest.xml +++ b/platform/android/MapLibreAndroid/src/main/AndroidManifest.xml @@ -1,8 +1,4 @@ - - diff --git a/platform/android/MapLibreAndroid/src/vulkan/AndroidManifest.xml b/platform/android/MapLibreAndroid/src/vulkan/AndroidManifest.xml new file mode 100644 index 00000000000..eb13ac34e2d --- /dev/null +++ b/platform/android/MapLibreAndroid/src/vulkan/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/platform/android/MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/style/HeatmapLayerActivity.kt b/platform/android/MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/style/HeatmapLayerActivity.kt index 117346e5694..cabaaabcd22 100644 --- a/platform/android/MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/style/HeatmapLayerActivity.kt +++ b/platform/android/MapLibreAndroidTestApp/src/main/java/org/maplibre/android/testapp/activity/style/HeatmapLayerActivity.kt @@ -192,7 +192,7 @@ class HeatmapLayerActivity : AppCompatActivity() { // # --8<-- [start:constants] companion object { private const val EARTHQUAKE_SOURCE_URL = - "https://maplibre.org/maplibre-gl-js-docs/assets/earthquakes.geojson" + "https://maplibre.org/maplibre-gl-js/docs/assets/earthquakes.geojson" private const val EARTHQUAKE_SOURCE_ID = "earthquakes" private const val HEATMAP_LAYER_ID = "earthquakes-heat" private const val HEATMAP_LAYER_SOURCE = "earthquakes" diff --git a/platform/android/MapLibrePlugin/gradle/wrapper/gradle-wrapper.properties b/platform/android/MapLibrePlugin/gradle/wrapper/gradle-wrapper.properties index e2847c82004..cea7a793a84 100644 --- a/platform/android/MapLibrePlugin/gradle/wrapper/gradle-wrapper.properties +++ b/platform/android/MapLibrePlugin/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/platform/android/MapLibrePlugin/gradlew b/platform/android/MapLibrePlugin/gradlew index f5feea6d6b1..f3b75f3b0d4 100755 --- a/platform/android/MapLibrePlugin/gradlew +++ b/platform/android/MapLibrePlugin/gradlew @@ -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 diff --git a/platform/android/README.md b/platform/android/README.md index a68bd7ced96..029a598eee0 100644 --- a/platform/android/README.md +++ b/platform/android/README.md @@ -8,10 +8,14 @@ MapLibre Native for Android is a library for embedding interactive map views wit Visit [https://maplibre.org/maplibre-native/android/examples/getting-started/](https://maplibre.org/maplibre-native/android/examples/getting-started/) to view the Getting Started Guide for MapLibre Native for Android. -## Documentation +### Examples Documentation -Visit [https://maplibre.org/maplibre-native/android/api/](https://maplibre.org/maplibre-native/android/api/) to view the current API reference Javadoc files for MapLibre Native for Android. +Visit [MapLibre Android Example](https://maplibre.org/maplibre-native/android/examples/) to learn how to use MapLibre Android. + +## API Documentation + +Visit [MapLibre Android Dokka Docs](https://maplibre.org/maplibre-native/android/api/) to view the current API reference for MapLibre Android. ## Contributing -See [`DEVELOPING.md`](./DEVELOPING.md) for instructions on how to get started working on the codebase. +See the [MapLibre Android Developer Guide](https://maplibre.org/maplibre-native/docs/book/android) for instructions on how to build the project or how to work on the documentation. diff --git a/platform/android/gradle/wrapper/gradle-wrapper.properties b/platform/android/gradle/wrapper/gradle-wrapper.properties index e2847c82004..cea7a793a84 100644 --- a/platform/android/gradle/wrapper/gradle-wrapper.properties +++ b/platform/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/platform/darwin/src/local_glyph_rasterizer.mm b/platform/darwin/src/local_glyph_rasterizer.mm index 889b1daaadf..4aa09548804 100644 --- a/platform/darwin/src/local_glyph_rasterizer.mm +++ b/platform/darwin/src/local_glyph_rasterizer.mm @@ -1,8 +1,11 @@ #include #include +#include #include #include +#include + #include #import @@ -191,16 +194,28 @@ CFDictionaryRefHandle attributes( @param font The font to apply to the codepoint. @param metrics Upon return, the metrics match the font’s metrics for the glyph representing the codepoint. + @param isBold use kCTFontBoldTrait if it is true. @returns An image containing the glyph. */ -PremultipliedImage drawGlyphBitmap(GlyphID glyphID, CTFontRef font, GlyphMetrics& metrics) { +PremultipliedImage drawGlyphBitmap(GlyphID glyphID, CTFontRef font, GlyphMetrics& metrics, BOOL isBold) { CFStringRefHandle string(CFStringCreateWithCharacters(NULL, reinterpret_cast(&glyphID), 1)); if (!string) { throw std::runtime_error("Unable to create string from codepoint"); } + // Create a bold variant of the font + CTFontRefHandle boldFont(CTFontCreateCopyWithSymbolicTraits(font, 0.0, NULL, kCTFontBoldTrait, kCTFontBoldTrait)); + if (!boldFont) { + CFStringRefHandle familyNameHandle(CTFontCopyFamilyName(font)); + NSString* familyName = (__bridge NSString *)(*familyNameHandle); + std::string stdFamilyName(familyName.UTF8String); + Log::Error(Event::General, "Unable to create bold font for " + stdFamilyName); + } + + CTFontRef drawFont = isBold && boldFont ? *boldFont : font; + CFStringRef keys[] = { kCTFontAttributeName }; - CFTypeRef values[] = { font }; + CFTypeRef values[] = { drawFont }; CFDictionaryRefHandle attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**)&keys, @@ -257,7 +272,7 @@ CGContextHandle context(CGBitmapContextCreate( // Mimic glyph PBF metrics. metrics.left = Glyph::borderSize; - metrics.top = 4; + metrics.top = -Glyph::borderSize; // Move the text upward to avoid clipping off descenders. CGFloat descent; @@ -265,7 +280,7 @@ CGContextHandle context(CGBitmapContextCreate( CGContextSetTextPosition(*context, 0.0, descent); CTLineDraw(*line, *context); - + return rgbaBitmap; } @@ -288,8 +303,16 @@ CGContextHandle context(CGBitmapContextCreate( } manufacturedGlyph.id = glyphID; + BOOL isBold = NO; + // Only check the first font name to detect if the user prefers using bold + if (!fontStack.empty()) { + std::string lowercaseFont = platform::lowercase(fontStack.front()); + if (lowercaseFont.find("bold") != std::string::npos && lowercaseFont.find("semibold") == std::string::npos) { + isBold = YES; + } + } - PremultipliedImage rgbaBitmap = drawGlyphBitmap(glyphID, *font, manufacturedGlyph.metrics); + PremultipliedImage rgbaBitmap = drawGlyphBitmap(glyphID, *font, manufacturedGlyph.metrics, isBold); Size size(manufacturedGlyph.metrics.width, manufacturedGlyph.metrics.height); // Copy alpha values from RGBA bitmap into the AlphaImage output diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index b49b5c50003..65ce874aee7 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -4,6 +4,12 @@ MapLibre welcomes participation and contributions from everyone. Please read [`C ## main +## 6.9.0 + +- Batch up scheduling of deferred deletions ([#3030](https://github.com/maplibre/maplibre-native/pull/3030)). +- Remove `Pass3D` ([#3077](https://github.com/maplibre/maplibre-native/pull/3077)). +- Add bold support for CJK characters ([#3069](https://github.com/maplibre/maplibre-native/pull/3069)). + ## 6.8.1 - Update Bazel dependencies ([#3000](https://github.com/maplibre/maplibre-native/pull/3000)). diff --git a/platform/ios/README.md b/platform/ios/README.md index 412ae58d2f2..51d906cc208 100644 --- a/platform/ios/README.md +++ b/platform/ios/README.md @@ -11,4 +11,4 @@ Embed interactive maps with scalable, customizable vector maps into iOS Applicat # Contributing -See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for instructions on how to build the project or how to work on the documentation. +See the [MapLibre iOS Developer Guide](https://maplibre.org/maplibre-native/docs/book/ios) for instructions on how to build the project or how to work on the documentation. diff --git a/platform/ios/VERSION b/platform/ios/VERSION index 23863d3def7..6a1fccf9303 100644 --- a/platform/ios/VERSION +++ b/platform/ios/VERSION @@ -1 +1 @@ -6.8.1 \ No newline at end of file +6.9.0 \ No newline at end of file diff --git a/render-test/android/gradle/wrapper/gradle-wrapper.properties b/render-test/android/gradle/wrapper/gradle-wrapper.properties index c1d5e018598..e0fd02028bc 100644 --- a/render-test/android/gradle/wrapper/gradle-wrapper.properties +++ b/render-test/android/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/render-test/android/gradlew b/render-test/android/gradlew index f5feea6d6b1..f3b75f3b0d4 100755 --- a/render-test/android/gradlew +++ b/render-test/android/gradlew @@ -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 diff --git a/scripts/generate-changelog.mjs b/scripts/generate-changelog.mjs index a704b8dcd3f..c18ed107318 100755 --- a/scripts/generate-changelog.mjs +++ b/scripts/generate-changelog.mjs @@ -18,7 +18,7 @@ function getTagLastVersion() { const lastVersion = fs .readFileSync(`platform/${platform}/CHANGELOG.md`, "utf-8") .split("\n") - .filter((line) => line.startsWith("## "))[1] + .filter((line) => line.startsWith("## "))[0] .slice(3); return `${platform}-v${lastVersion}`; } diff --git a/test/android/gradle/wrapper/gradle-wrapper.properties b/test/android/gradle/wrapper/gradle-wrapper.properties index c1d5e018598..e0fd02028bc 100644 --- a/test/android/gradle/wrapper/gradle-wrapper.properties +++ b/test/android/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/test/android/gradlew b/test/android/gradlew index f5feea6d6b1..f3b75f3b0d4 100755 --- a/test/android/gradlew +++ b/test/android/gradlew @@ -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 diff --git a/test/fixtures/local_glyphs/ping_fang/expected.png b/test/fixtures/local_glyphs/ping_fang/expected.png index 02848361304..9bb78c9f756 100644 Binary files a/test/fixtures/local_glyphs/ping_fang/expected.png and b/test/fixtures/local_glyphs/ping_fang/expected.png differ diff --git a/test/fixtures/local_glyphs/ping_fang_semibold/expected.png b/test/fixtures/local_glyphs/ping_fang_semibold/expected.png index 9723cc2826f..25ceda68168 100644 Binary files a/test/fixtures/local_glyphs/ping_fang_semibold/expected.png and b/test/fixtures/local_glyphs/ping_fang_semibold/expected.png differ diff --git a/test/fixtures/local_glyphs/ping_fang_with_bold_in_style/expected.png b/test/fixtures/local_glyphs/ping_fang_with_bold_in_style/expected.png new file mode 100644 index 00000000000..8665da2ea6e Binary files /dev/null and b/test/fixtures/local_glyphs/ping_fang_with_bold_in_style/expected.png differ diff --git a/test/text/local_glyph_rasterizer.test.cpp b/test/text/local_glyph_rasterizer.test.cpp index 8e3235791c5..1922aacd97c 100644 --- a/test/text/local_glyph_rasterizer.test.cpp +++ b/test/text/local_glyph_rasterizer.test.cpp @@ -10,6 +10,8 @@ #include #include +#include + /* LoadLocalCJKGlyph in glyph_manager.test.cpp exercises the platform-independent part of LocalGlyphRasterizer. This test actually @@ -17,13 +19,8 @@ on. Different platforms have different default fonts, so adding a new platform requires new "expected" fixtures. - At the time of writing, we don't run `mbgl-test` on iOS or Android, so the - only supported test platform is macOS. Supporting Android would require - adding a new test case (probably using the "Droid" font family). iOS should - theoretically work -- the "PingFang" font family used below is expected to be - available on all iOS devices, and we use a relatively high image diff - tolerance (0.05) to account for small changes between the many possible - variants of the PingFang family. + At the time of writing, we don't run this test on Android, that would require + adding a new test case (probably using the "Droid" font family). */ using namespace mbgl; @@ -33,7 +30,14 @@ namespace { class LocalGlyphRasterizerTest { public: LocalGlyphRasterizerTest(const std::optional fontFamily) - : frontend(1, gfx::HeadlessBackend::SwapBehaviour::NoFlush, gfx::ContextMode::Unique, fontFamily) {} + : frontend(1, gfx::HeadlessBackend::SwapBehaviour::NoFlush, gfx::ContextMode::Unique, fontFamily) { + this->fileSource->glyphsResponse = [&](const Resource& resource) { + EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); + Response response; + response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); + return response; + }; + } util::RunLoop loop; std::shared_ptr fileSource = std::make_shared(); @@ -59,12 +63,6 @@ class LocalGlyphRasterizerTest { TEST(LocalGlyphRasterizer, PingFang) { LocalGlyphRasterizerTest test(std::string("PingFang TC")); - test.fileSource->glyphsResponse = [&](const Resource& resource) { - EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); - Response response; - response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); - return response; - }; test.map.getStyle().loadJSON(util::read_file("test/fixtures/local_glyphs/mixed.json")); #if defined(__APPLE__) && !defined(__QT__) test.checkRendering("ping_fang", 0.0161); @@ -73,16 +71,19 @@ TEST(LocalGlyphRasterizer, PingFang) { #endif // defined(__APPLE__) } +TEST(LocalGlyphRasterizer, PingFangWithBoldInStyle) { + LocalGlyphRasterizerTest test(std::string("PingFang TC")); + std::stringstream ss; + ss << std::regex_replace( + util::read_file("test/fixtures/local_glyphs/mixed.json"), std::regex("NotoCJK"), "NotoCJK Bold"); + test.map.getStyle().loadJSON(ss.str()); + test.checkRendering("ping_fang_with_bold_in_style"); +} + #if !defined(__QT__) TEST(LocalGlyphRasterizer, PingFangSemibold) { LocalGlyphRasterizerTest test(std::string("PingFang TC Semibold")); - test.fileSource->glyphsResponse = [&](const Resource& resource) { - EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); - Response response; - response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); - return response; - }; test.map.getStyle().loadJSON(util::read_file("test/fixtures/local_glyphs/mixed.json")); test.checkRendering("ping_fang_semibold", 0.0161); } @@ -94,13 +95,6 @@ TEST(LocalGlyphRasterizer, PingFangSemibold) { TEST(LocalGlyphRasterizer, NotoSansCJK) { LocalGlyphRasterizerTest test(std::string("Noto Sans CJK KR Regular")); - test.fileSource->glyphsResponse = [&](const Resource& resource) { - EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); - Response response; - response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); - return response; - }; - test.map.getStyle().loadJSON(util::read_file("test/fixtures/local_glyphs/mixed.json")); test.checkRendering("noto_sans_cjk_kr_regular_qt"); } @@ -110,13 +104,6 @@ TEST(LocalGlyphRasterizer, NoLocal) { // Expectation: without any local fonts set, and without any CJK glyphs // provided, the output should just contain basic latin characters. LocalGlyphRasterizerTest test({}); - - test.fileSource->glyphsResponse = [&](const Resource& resource) { - EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); - Response response; - response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); - return response; - }; test.map.getStyle().loadJSON(util::read_file("test/fixtures/local_glyphs/mixed.json")); test.checkRendering("no_local", 0.001, 0.1); } @@ -126,13 +113,6 @@ TEST(LocalGlyphRasterizer, NoLocalWithContentInsets) { // center. Rendered text should be on the same offset and keep the same size // as with no offset. LocalGlyphRasterizerTest test({}); - - test.fileSource->glyphsResponse = [&](const Resource& resource) { - EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); - Response response; - response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); - return response; - }; auto viewSize = test.frontend.getSize(); test.map.getStyle().loadJSON(util::read_file("test/fixtures/local_glyphs/mixed.json")); @@ -149,13 +129,6 @@ TEST(LocalGlyphRasterizer, NoLocalWithContentInsetsAndPitch) { // center. Rendered text should be on the same offset and keep the same size // as with no offset. LocalGlyphRasterizerTest test({}); - - test.fileSource->glyphsResponse = [&](const Resource& resource) { - EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); - Response response; - response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); - return response; - }; auto viewSize = test.frontend.getSize(); test.map.getStyle().loadJSON(util::read_file("test/fixtures/local_glyphs/mixed.json")); diff --git a/vendor/libuv.BUILD b/vendor/libuv.BUILD deleted file mode 100644 index f37a18d41ae..00000000000 --- a/vendor/libuv.BUILD +++ /dev/null @@ -1,6 +0,0 @@ -cc_library( - name = "libuv", - hdrs = glob(["include/**/*.h"]), - includes = ["include"], - visibility = ["//visibility:public"], -)