From 8a08d84e220db70e5b9f3d1b84fa8620e6651c9b Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Fri, 19 Apr 2024 16:01:15 +0200 Subject: [PATCH] Remove bazel-package.sh and BAZEL.md (#2299) --- .github/workflows/ios-ci.yml | 3 +- platform/ios/BAZEL.md | 62 -------------- platform/ios/README.md | 8 +- platform/ios/scripts/bazel-package.sh | 82 ------------------- .../src/MLNUserLocationAnnotationViewStyle.m | 2 +- 5 files changed, 9 insertions(+), 148 deletions(-) delete mode 100644 platform/ios/BAZEL.md delete mode 100755 platform/ios/scripts/bazel-package.sh diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index 6b43cb8f1..aa80a1911 100644 --- a/.github/workflows/ios-ci.yml +++ b/.github/workflows/ios-ci.yml @@ -224,7 +224,8 @@ jobs: - name: Build XCFramework if: env.make_release run: | - bazel build --compilation_mode=opt --apple_generate_dsym --output_groups=+dsyms --//:renderer=metal //platform/ios:MapLibre.dynamic --embed_label=maplibre_ios_"$(cat VERSION)" + bazel build --compilation_mode=opt --features=dead_strip --objc_enable_binary_stripping \ + --apple_generate_dsym --output_groups=+dsyms --//:renderer=metal //platform/ios:MapLibre.dynamic --embed_label=maplibre_ios_"$(cat VERSION)" echo xcframework="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.dynamic)" >> "$GITHUB_ENV" - name: Create .zip with debug symbols diff --git a/platform/ios/BAZEL.md b/platform/ios/BAZEL.md deleted file mode 100644 index 0c98907c8..000000000 --- a/platform/ios/BAZEL.md +++ /dev/null @@ -1,62 +0,0 @@ -# Building using Bazel - -[Bazel](https://bazel.build) is also supported as a build option for getting a packaged release of the xcframework compiled for either static or dynamic linking. - -Firstly you will have to ensure that Bazel is installed - -`brew install bazelisk` - -From there you can use the script in platform/ios/platform/ios/scripts/package-bazel.sh - -## There are 4 options: - -`cd platform/ios/platform/ios/scripts` - -Static xcframework compiled for release (this is default if no parameters are provided): -`./bazel-package.sh --static --release` - -Static xcframework compiled for debug: -`./bazel-package.sh --static --debug` - -Dynamic xcframework compiled for release: -`./bazel-package.sh --dynamic --release` - -Dynamic xcframework compiled for debug: -`./bazel-package.sh --dynamic --debug` - -All compiled frameworks will end up in the `bazel-bin/platform/ios/` path from the root of the repo. - -Also you can use the link option to ensure that the framework is able to link. - -`./bazel-package.sh --link` - -#### Bazel build files are placed in a few places throughout the project: - -`BUILD.bazel` -- Covering the base cpp in the root `src` directory. - -`vendor/BUILD.bazel` -- Covering the submodule dependencies of Maplibre. - -`platform/default/BUILD.bazel` -- Covering the cpp dependencies in default. - -`platform/darwin/BUILD.bazel` -- Covering the cpp source in platform/default. - -`platform/ios/platform/ios/vendor/` -- Covering the iOS specific dependencies. - -`platform/ios/BUILD.bazel` -- Covering the source in `platform/ios/platform/ios/src` and `platform/ios/platform/darwin/src` as well as defining all the other BUILD.bazel files and defining the xcframework targets. - -## There are also some other areas that make bazel work: - -`WORKSPACE` -- Defines the "repo" and the different modules that are loaded in order to compile for Apple. - -`.bazelversion` -- Defines the version of bazel used, important for specific support for Apple targets. - -`bazel/flags.bzl` -- Defines some compilation flags that are used between the different build files. \ No newline at end of file diff --git a/platform/ios/README.md b/platform/ios/README.md index 14898bc96..e6c7dc654 100644 --- a/platform/ios/README.md +++ b/platform/ios/README.md @@ -77,7 +77,9 @@ cd maplibre-native ### Bazel -[Bazel](https://bazel.build/) together with [rules_xcodeproj](https://github.com/MobileNativeFoundation/rules_xcodeproj) is the preferred build system. Please [share your experiences](https://github.com/maplibre/maplibre-native/discussions/1145). +[Bazel](https://bazel.build/) can be used to build the project. + +You can generate an Xcode project thanks to [rules_xcodeproj](https://github.com/MobileNativeFoundation/rules_xcodeproj) intergration. You need to install bazelisk, which is a wrapper around Bazel which ensures that the version specified in `.bazelversion` is used. @@ -110,7 +112,7 @@ _These instructions are for XCode 14.3.1_ ``` -bazel run //platform/ios:xcodeproj +bazel run //platform/ios:xcodeproj --@rules_xcodeproj//xcodeproj:extra_common_flags="--//:renderer=metal" xed platform/ios/MapLibre.xcodeproj ``` @@ -134,6 +136,8 @@ It is also possible to build and run the test application in a simulator from th bazel run //platform/ios:App ``` +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. diff --git a/platform/ios/scripts/bazel-package.sh b/platform/ios/scripts/bazel-package.sh deleted file mode 100755 index fc8dc3736..000000000 --- a/platform/ios/scripts/bazel-package.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -set -eo pipefail - -# "static" or "dynamic" -build_type="static" - -# "release" or "debug" -release_type="release" - -# Renderer flavor -flavor="legacy" - -while [[ $# -gt 0 ]]; do - case $1 in - --static) - build_type="static" - shift - ;; - --dynamic) - build_type="dynamic" - shift - ;; - --release) - release_type="release" - shift - ;; - --debug) - release_type="debug" - shift - ;; - --link) - build_type="link" - shift - ;; - --help) - echo "Build the maplibre xcframework using the bazel build files. You must install Bazelisk to build using this method." - echo "Usage: .bazel-package.sh --static|--dynamic --release|--debug" - echo "Defaults to \"--static --release\"" - exit 1 - ;; - --flavor) - shift - flavor="$1" - shift - ;; - -*|--*) - echo "Unknown option $1" - exit 1 - ;; - esac -done - -echo "------ Build type: $build_type Release type: $release_type ------" - -target="MapLibre.$build_type" - -compilation_mode="opt" -if [ "$release_type" = "debug" ]; then - compilation_mode="dbg" -fi; - -if [ ! -d platform/ios/build ]; then - mkdir platform/ios/build -fi - -echo "------ Building Maplibre ------" - -# Build -ncpu=$(sysctl -n hw.ncpu) -bazel build //platform/ios:"$target" --apple_platform_type=ios \ - --apple_generate_dsym \ - --compilation_mode="$compilation_mode" \ - --features=dead_strip \ - --objc_enable_binary_stripping \ - --copt=-Wall --copt=-Wextra --copt=-Wpedantic \ - --copt=-Werror \ - --jobs "$ncpu" \ - --//:renderer=$flavor - -echo "Done." -echo "Package will be available in \"/bazel-bin/platform/ios/$target.xcframework.zip\"" diff --git a/platform/ios/src/MLNUserLocationAnnotationViewStyle.m b/platform/ios/src/MLNUserLocationAnnotationViewStyle.m index 487cba295..2a84eee2c 100644 --- a/platform/ios/src/MLNUserLocationAnnotationViewStyle.m +++ b/platform/ios/src/MLNUserLocationAnnotationViewStyle.m @@ -59,4 +59,4 @@ _approximateHaloOpacity = approximateHaloOpacity; } -@end \ No newline at end of file +@end