Skip to content

Commit

Permalink
Merge branch 'maplibre:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolives authored Dec 13, 2023
2 parents 10ba5b8 + f8e414a commit e7163f5
Show file tree
Hide file tree
Showing 174 changed files with 3,904 additions and 3,889 deletions.
5 changes: 4 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
coverage --experimental_ui_max_stdouterr_bytes=10485760
# TODO: remove with bazel 7.x
common --enable_bzlmod

coverage --experimental_ui_max_stdouterr_bytes=10485760
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.0
6.4.0
43 changes: 33 additions & 10 deletions .github/actions/aws-device-farm-run/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ inputs:
testType:
description: 'e.g. INSTRUMENTATION, XCTEST'
required: true
testFilter:
description: 'Filter tests'
required: false
externalData:
description: 'ARN of external data package'
required: false
AWS_ACCESS_KEY_ID:
description: "AWS_ACCESS_KEY_ID"
required: true
Expand All @@ -34,6 +40,9 @@ inputs:
AWS_DEVICE_FARM_DEVICE_POOL_ARN:
description: "AWS_DEVICE_FARM_DEVICE_POOL_ARN"
required: true
testSpecArn:
description: "ARN of test spec"
required: false
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -98,13 +107,27 @@ runs:
done
- name: Schedule test run
uses: realm/aws-devicefarm/test-application@master
with:
name: MapLibre Native ${{ matrix.test.name }}
project_arn: ${{ inputs.AWS_DEVICE_FARM_PROJECT_ARN }}
device_pool_arn: ${{ inputs.AWS_DEVICE_FARM_DEVICE_POOL_ARN }}
app_arn: ${{ env.app_arn }}
app_type: ${{ inputs.appType }}
test_type: ${{ inputs.testType }}
test_package_arn: ${{ env.test_package_arn }}
timeout: 28800
shell: bash
run: |
arn="$(aws devicefarm schedule-run \
--project-arn ${{ inputs.AWS_DEVICE_FARM_PROJECT_ARN }} \
--name "MapLibre Native ${{ matrix.test.name }}" \
--app-arn ${{ env.app_arn }} \
--device-pool-arn ${{ inputs.AWS_DEVICE_FARM_DEVICE_POOL_ARN }} \
--test type=${{ inputs.testType }},testPackageArn=${{ env.test_package_arn }}${{ inputs.testFilter && ',filter=' }}${{ inputs.testFilter }}${{ inputs.testSpecArn && ',testSpecArn=' }}${{ inputs.testSpecArn }} \
${{ inputs.externalData && '--configuration extraDataPackageArn=' }}${{ inputs.externalData }} \
--output text --query "run.arn")"
# wait until result is not PENDING
# https://awscli.amazonaws.com/v2/documentation/api/latest/reference/devicefarm/get-run.html#output
while true; do
sleep 30
result="$(aws devicefarm get-run --arn "$arn" --output text --query "run.result")"
case $result in
FAILED|ERRORED|STOPPED) echo "Run $result" && exit 1 ;;
SKIPPED|PASSED) echo "Run $result" && exit 0 ;;
PENDING) continue ;;
*) echo "Unexpected run result $result" && exit 1 ;;
esac
done
26 changes: 24 additions & 2 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,28 @@ jobs:
echo "No secrets.MAPLIBRE_DEVELOPER_CONFIG_XML variable set, not copying..."
fi
- name: Build Benchmark, copy to platform/android
if: github.ref != 'refs/heads/main'
run: |
./gradlew assembleDrawableRelease assembleDrawableReleaseAndroidTest
cp MapboxGLAndroidSDKTestApp/build/outputs/apk/drawable/release/MapboxGLAndroidSDKTestApp-drawable-release.apk .
cp MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/drawable/release/MapboxGLAndroidSDKTestApp-drawable-release-androidTest.apk .
- name: Create artifact for benchmark APKs
uses: actions/upload-artifact@v3
if: github.ref != 'refs/heads/main'
with:
if-no-files-found: error
name: benchmarkAPKs
path: |
platform/android/MapboxGLAndroidSDKTestApp-drawable-release.apk
platform/android/MapboxGLAndroidSDKTestApp-drawable-release-androidTest.apk
- if: github.event_name == 'pull_request'
uses: ./.github/actions/save-pr-number

- name: Build UI tests
if: github.ref == 'refs/heads/main'
run: make android-ui-test-arm-v8

- name: Configure AWS Credentials
Expand Down Expand Up @@ -153,8 +174,8 @@ jobs:
- name: Upload Android UI test
if: github.ref == 'refs/heads/main'
run: |
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/legacy/debug/MapboxGLAndroidSDKTestApp-legacy-debug.apk '${{ steps.upload-android-app.outputs.url }}'
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/legacy/debug/MapboxGLAndroidSDKTestApp-legacy-debug-androidTest.apk '${{ steps.upload-android-test.outputs.url }}'
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/legacy/release/MapboxGLAndroidSDKTestApp-legacy-debug.apk '${{ steps.upload-android-app.outputs.url }}'
curl -T MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/legacy/release/MapboxGLAndroidSDKTestApp-legacy-debug-androidTest.apk '${{ steps.upload-android-test.outputs.url }}'
- name: Write uploads.env
if: github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -230,6 +251,7 @@ jobs:
project_arn: ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}
device_pool_arn: ${{ vars.AWS_DEVICE_FARM_DEVICE_POOL_ARN }}
app_arn: ${{ env.ANDROID_APP_ARN }}
test_spec_arn: ${{ vars.AWS_DEVICE_FARM_TEST_SPEC_ARN_ANDROID_UI_TESTS }}
app_type: ANDROID_APP
test_type: INSTRUMENTATION
test_package_arn: ${{ env.ANDROID_TEST_ARN }}
Expand Down
52 changes: 48 additions & 4 deletions .github/workflows/android-device-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,35 @@ on:
jobs:
create-check:
strategy:
max-parallel: 2
matrix:
test: [
{artifactName: android-render-tests, testFile: RenderTests.apk, appFile: RenderTestsApp.apk, name: "Android Render Tests"},
{
artifactName: android-render-tests,
testFile: RenderTests.apk,
appFile: RenderTestsApp.apk,
name: "Android Render Tests",
# Google Pixel 7 Pro
devicePool: "arn:aws:devicefarm:us-west-2:373521797162:devicepool:20687d72-0e46-403e-8f03-0941850665bc/9692fe7f-86a9-4ecc-908f-175600968564"
},
{
artifactName: benchmarkAPKs,
testFile: "MapboxGLAndroidSDKTestApp-drawable-release-androidTest.apk",
appFile: "MapboxGLAndroidSDKTestApp-drawable-release.apk",
name: "Android Benchmark",
testFilter: "org.maplibre.android.benchmark.Benchmark",
# echo '{"styleNames": [...], "styleURLs": [...], "resultsAPI: "..." }' > benchmark-input.json
# zip benchmark-input.zip benchmark-input.json
# aws devicefarm create-upload --project-arn <project_arn> --type EXTERNAL_DATA --name benchmark-input.zip
# curl -T benchmark-input.zip <upload_url>
# aws devicefarm get-upload <arn>
externalData: "arn:aws:devicefarm:us-west-2:373521797162:upload:20687d72-0e46-403e-8f03-0941850665bc/c27174c2-63f4-4cdb-9af9-68957d75ebed",
# top devices, query with `aws list-device-pools --arn <project_arn>`
devicePool: "arn:aws:devicefarm:us-west-2::devicepool:082d10e5-d7d7-48a5-ba5c-b33d66efa1f5",
# benchmark-android.yaml
# see https://github.com/maplibre/ci-runners/tree/main/aws-device-farm/custom-test-envs
testSpecArn: "arn:aws:devicefarm:us-west-2:373521797162:upload:20687d72-0e46-403e-8f03-0941850665bc/14862afb-cf88-44aa-9f1e-5131cbb22f01"
}
]
runs-on: ubuntu-latest
steps:
Expand All @@ -24,7 +50,20 @@ jobs:
app_id: ${{ secrets.MAPLIBRE_NATIVE_BOT_APP_ID }}
private_key: ${{ secrets.MAPLIBRE_NATIVE_BOT_PRIVATE_KEY }}

- run: echo "${{ toJSON(github.event.workflow_run) }}"

- uses: ./.github/actions/get-pr-number
id: get-pr-number

- name: Check if comment on PR contains '!benchmark android'
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ steps.get-pr-number.outputs.pr-number }}
body-regex: '^!benchmark.*android.*$'

- uses: LouisBrunner/[email protected]
if: matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id
id: create_check
with:
token: ${{ steps.generate_token.outputs.token }}
Expand All @@ -34,32 +73,37 @@ jobs:
sha: ${{ github.event.workflow_run.head_sha }}

- uses: ./.github/actions/download-workflow-run-artifact
if: matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id
with:
artifact-name: ${{ matrix.test.artifactName }}

- name: Check if test files exist (otherwise the parent workflow was skipped)
if: matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id
id: check_files
uses: andstor/[email protected]
with:
files: "${{ matrix.test.testFile }}, ${{ matrix.test.appFile }}"

- uses: ./.github/actions/aws-device-farm-run
if: steps.check_files.outputs.files_exists == 'true'
if: steps.check_files.outputs.files_exists == 'true' && (matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id)
with:
name: ${{ matrix.test.name }}
appType: ANDROID_APP
appFile: ${{ matrix.test.appFile }}
testFile: ${{ matrix.test.testFile }}
testPackageType: INSTRUMENTATION_TEST_PACKAGE
testType: INSTRUMENTATION
testFilter: ${{ matrix.test.testFilter }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ROLE_TO_ASSUME: ${{ vars.AWS_ROLE_TO_ASSUME }}
AWS_DEVICE_FARM_PROJECT_ARN: ${{ vars.AWS_DEVICE_FARM_PROJECT_ARN }}
AWS_DEVICE_FARM_DEVICE_POOL_ARN: ${{ vars.AWS_DEVICE_FARM_DEVICE_POOL_ARN }}
AWS_DEVICE_FARM_DEVICE_POOL_ARN: ${{ matrix.test.devicePool }}
externalData: ${{ matrix.test.externalData }}
testSpecArn: ${{ matrix.test.testSpecArn }}

- uses: LouisBrunner/[email protected]
if: always()
if: always() && (matrix.test.name != 'Android Benchmark' || steps.fc.outputs.comment-id)
with:
token: ${{ steps.generate_token.outputs.token }}
check_id: ${{ steps.create_check.outputs.check_id }}
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ if(MLN_DRAWABLE_RENDERER)
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/shader_program_base.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/util/identity.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/util/suppress_copies.hpp

${PROJECT_SOURCE_DIR}/include/mbgl/shaders/gl/shader_program_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/buffer_allocator.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/drawable_gl.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/drawable_gl_builder.hpp
${PROJECT_SOURCE_DIR}/include/mbgl/gl/layer_group_gl.hpp
Expand Down Expand Up @@ -216,6 +216,7 @@ if(MLN_DRAWABLE_RENDERER)
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/shader_program_base.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/util/identity.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/shaders/gl/shader_program_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/buffer_allocator.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl_builder.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/drawable_gl_impl.hpp
Expand Down Expand Up @@ -1067,6 +1068,8 @@ if(MLN_WITH_OPENGL)
${PROJECT_SOURCE_DIR}/src/mbgl/gl/command_encoder.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/context.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/context.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/fence.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/gl/fence.hpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/layermanager/custom_layer_factory.cpp
${PROJECT_SOURCE_DIR}/src/mbgl/style/layers/custom_layer_impl.cpp
Expand Down
25 changes: 9 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@
git clone --recurse-submodules https://github.com/maplibre/maplibre-native.git
```

## Building

MapLibre Native shares a single C++ core library with all platforms. To build it, we utilize CMake.

To build, run the following from the root directory
```bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DMLN_WITH_CORE_ONLY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DMLN_WITH_COVERAGE=ON
```

`CMAKE_BUILD_TYPE=Debug` will build debug artifacts. You can opt to omit it if that is not necessary.
`MLN_WITH_CORE_ONLY=ON` will build only the core libraries.
Built artifacts should be available on `build` folder.


## Guidelines

Expand All @@ -33,12 +20,18 @@ If you want to contribute code:

1. Ensure that existing [pull requests](https://github.com/maplibre/maplibre-native/pulls) and [issues](https://github.com/maplibre/maplibre-native/issues) don’t already cover your contribution or question.

1. Pull requests are gladly accepted. If there are any changes that developers using one of the GL SDKs should be aware of, please update the **main** section of the relevant `CHANGELOG.md`.

4. Prefix your commit messages with the platform(s) your changes affect, e.g. `[ios]`.
1. Pull requests are gladly accepted. If there are any changes that developers using one of the platforms should be aware of, please update the **main** section of the relevant `CHANGELOG.md`.

Please note the special instructions for contributing new source code files, asset files, or user-facing strings to MapLibre Native for [iOS](platform/ios/CONTRIBUTING.md), [Android](platform/android/DEVELOPING.md) or [macOS](platform/macos/DEVELOPING.md).

## Pull Requests

To run the benchmarks (for Android) include the following line on a PR comment:

```
!benchmark android
```

## Design Proposals

If you would like to change MapLibre Native in a substantial way, we recommend that you write a Design Proposal. Examples for substantial changes could be if you would like to split the mono-repo or if you would like to introduce shaders written in Metal.
Expand Down
9 changes: 9 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module(name = "maplibre")

bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_apple", version = "3.1.1", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "rules_xcodeproj", version = "1.13.0")

provisioning_profile_repository = use_extension("@build_bazel_rules_apple//apple:apple.bzl", "provisioning_profile_repository_extension")
provisioning_profile_repository.setup()
63 changes: 0 additions & 63 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,63 +0,0 @@
workspace(name = "Maplibre")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_apple",
sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7",
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz",
)

http_archive(
name = "rules_xcodeproj",
sha256 = "f5c1f4bea9f00732ef9d54d333d9819d574de7020dbd9d081074232b93c10b2c",
url = "https://github.com/MobileNativeFoundation/rules_xcodeproj/releases/download/1.13.0/release.tar.gz",
)

load(
"@rules_xcodeproj//xcodeproj:repositories.bzl",
"xcodeproj_rules_dependencies",
)

xcodeproj_rules_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)

apple_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)

apple_support_dependencies()

load(
"@build_bazel_rules_apple//apple:apple.bzl",
"provisioning_profile_repository"
)

provisioning_profile_repository(
name = "local_provisioning_profiles"
)
4 changes: 4 additions & 0 deletions bazel/core.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,8 @@ MLN_OPENGL_SOURCE = [
"src/mbgl/gl/command_encoder.hpp",
"src/mbgl/gl/context.cpp",
"src/mbgl/gl/context.hpp",
"src/mbgl/gl/fence.cpp",
"src/mbgl/gl/fence.hpp",
"src/mbgl/gl/debugging_extension.cpp",
"src/mbgl/gl/debugging_extension.hpp",
"src/mbgl/gl/defines.hpp",
Expand Down Expand Up @@ -995,6 +997,7 @@ MLN_DRAWABLES_HEADERS = [
]

MLN_DRAWABLES_GL_SOURCE = [
"src/mbgl/gl/buffer_allocator.cpp",
"src/mbgl/gl/drawable_gl.cpp",
"src/mbgl/gl/drawable_gl_builder.cpp",
"src/mbgl/gl/drawable_gl_impl.hpp",
Expand All @@ -1007,6 +1010,7 @@ MLN_DRAWABLES_GL_SOURCE = [
]

MLN_DRAWABLES_GL_HEADERS = [
"include/mbgl/gl/buffer_allocator.hpp",
"include/mbgl/gl/drawable_gl.hpp",
"include/mbgl/gl/drawable_gl_builder.hpp",
"include/mbgl/gl/layer_group_gl.hpp",
Expand Down
Loading

0 comments on commit e7163f5

Please sign in to comment.