Remove bazel-package.sh and BAZEL.md (#2299)

This commit is contained in:
Bart Louwers
2024-04-19 16:01:15 +02:00
committed by GitHub
parent 4aef284073
commit 8a08d84e22
5 changed files with 9 additions and 148 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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\""

View File

@@ -59,4 +59,4 @@
_approximateHaloOpacity = approximateHaloOpacity;
}
@end
@end