Selectable renderer implementation (#1247)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,15 @@ build_type="static"
|
||||
# "release" or "debug"
|
||||
release_type="release"
|
||||
|
||||
# Renderer flavor
|
||||
flavor="legacy"
|
||||
|
||||
# Provisioning team ID
|
||||
teamid="0000000000"
|
||||
|
||||
# Provisioning profile name/UUID
|
||||
uuid="iOS Team Provisioning Profile: *"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--static)
|
||||
@@ -36,6 +45,21 @@ while [[ $# -gt 0 ]]; do
|
||||
echo "Defaults to \"--static --release\""
|
||||
exit 1
|
||||
;;
|
||||
--flavor)
|
||||
shift
|
||||
flavor="$1"
|
||||
shift
|
||||
;;
|
||||
--teamid)
|
||||
shift
|
||||
teamid="$1"
|
||||
shift
|
||||
;;
|
||||
--profile-uuid)
|
||||
shift
|
||||
uuid="$1"
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
@@ -75,13 +99,28 @@ plutil -replace MLNCommitHash -string "$hash" "$temp_info_plist"
|
||||
|
||||
echo "------ Building Maplibre version: $sem_version hash: $hash ------"
|
||||
|
||||
# Generate provisioning team ID
|
||||
if [ ! -d platform/ios/bazel/__generated__ ]; then
|
||||
mkdir platform/ios/bazel/__generated__
|
||||
fi
|
||||
|
||||
cat > platform/ios/bazel/__generated__/provisioning_profile.bzl <<EOF
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID = "$teamid"
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_UUID = "$uuid"
|
||||
EOF
|
||||
|
||||
# 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
|
||||
--copt=-Werror \
|
||||
--jobs "$ncpu" \
|
||||
--//:renderer=$flavor \
|
||||
--//:maplibre_platform=ios
|
||||
|
||||
echo "Done."
|
||||
echo "Package will be available in \"/bazel-bin/platform/ios/$target.xcframework.zip\""
|
||||
|
||||
@@ -1,28 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -eo pipefail
|
||||
|
||||
echo "------ Determining Maplibre version and hash ------"
|
||||
|
||||
sem_version=0.0.0
|
||||
hash=$(git log | head -1 | awk '{ print $2 }' | cut -c 1-10) && true
|
||||
|
||||
echo "------ Configuring project ------"
|
||||
# Move and configure the info plists with the semantic version and hash.
|
||||
temp_info_static_plist="platform/ios/build/Info-static.plist"
|
||||
temp_info_plist="platform/ios/build/Info.plist"
|
||||
# Move and configure the app plist
|
||||
temp_app_info_plist="platform/ios/build/Info-app.plist"
|
||||
|
||||
if [ ! -d platform/ios/build ]; then
|
||||
mkdir platform/ios/build
|
||||
fi
|
||||
|
||||
cp platform/ios/framework/Info-static.plist "$temp_info_static_plist"
|
||||
cp platform/ios/framework/Info.plist "$temp_info_plist"
|
||||
cp platform/ios/platform/ios/framework/Info-static.plist "$temp_info_static_plist"
|
||||
cp platform/ios/platform/ios/framework/Info.plist "$temp_info_plist"
|
||||
cp platform/ios/platform/ios/app/Info.plist "$temp_app_info_plist"
|
||||
|
||||
# Replace semver and hash
|
||||
plutil -replace MLNSemanticVersionString -string "$sem_version" "$temp_info_static_plist"
|
||||
plutil -replace MLNCommitHash -string "$hash" "$temp_info_static_plist"
|
||||
plutil -replace MLNSemanticVersionString -string "$sem_version" "$temp_info_plist"
|
||||
plutil -replace MLNCommitHash -string "$hash" "$temp_info_plist"
|
||||
|
||||
# Build parameters
|
||||
token_file=~/.maplibre
|
||||
token_file2=~/maplibre
|
||||
token="$(cat $token_file 2>/dev/null || cat $token_file2 2>/dev/null || echo $MLN_API_KEY)"
|
||||
flavor="legacy" # Renderer build flavor: legacy, drawable, split
|
||||
teamid="0000000000" # Provisioning profile team ID, required for targeting physical devices
|
||||
uuid="iOS Team Provisioning Profile: *" # provisioning profile name/UUID
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--flavor)
|
||||
shift
|
||||
flavor="$1"
|
||||
shift
|
||||
;;
|
||||
--teamid)
|
||||
shift
|
||||
teamid="$1"
|
||||
shift
|
||||
;;
|
||||
--profile-uuid)
|
||||
shift
|
||||
uuid="$1"
|
||||
shift
|
||||
;;
|
||||
--apikey)
|
||||
shift
|
||||
token="$1"
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Insert API Key
|
||||
echo "Inserting MapLibre API key..."
|
||||
if [ "$token" ]; then
|
||||
plutil -replace MLNApiKey -string $token "$temp_app_info_plist"
|
||||
echo "API key insertion successful"
|
||||
else
|
||||
echo "Warning: Missing API key."
|
||||
fi
|
||||
|
||||
# Generate the team ID for Xcode device provisioning
|
||||
if [ ! -d platform/ios/bazel/__generated__ ]; then
|
||||
mkdir platform/ios/bazel/__generated__
|
||||
fi
|
||||
|
||||
cat > platform/ios/bazel/__generated__/provisioning_profile.bzl <<EOF
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID = "$teamid"
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_UUID = "$uuid"
|
||||
EOF
|
||||
|
||||
echo "------ Building Maplibre version: $sem_version hash: $hash ------"
|
||||
|
||||
bazel run //platform/ios:xcodeproj
|
||||
# Generate the Xcode project
|
||||
# Example invocation: ./bazel-xcodeproj.sh flavor split teamid 1234567890
|
||||
# Find your team ID inside a .mobileprovision file or in your keychain (Apple development: your@email -> Get Info -> Organizational Unit)
|
||||
bazel run //platform/ios:xcodeproj --@rules_xcodeproj//xcodeproj:extra_common_flags="--//:renderer=$flavor --//:maplibre_platform=ios"
|
||||
|
||||
popd
|
||||
|
||||
Reference in New Issue
Block a user