8
.github/workflows/ios-ci.yml
vendored
8
.github/workflows/ios-ci.yml
vendored
@@ -125,11 +125,11 @@ jobs:
|
||||
|
||||
- run: cp bazel/example_config.bzl bazel/config.bzl
|
||||
|
||||
- name: Check debug symbols
|
||||
run: bazel run //platform:check-public-symbols
|
||||
- name: Generate app plists
|
||||
working-directory: ./
|
||||
run: bash platform/ios/platform/ios/scripts/bazel-generate-plists.sh
|
||||
|
||||
- name: Lint plist files
|
||||
run: bazel run //platform/ios:lint-plists
|
||||
- run: make style-code
|
||||
|
||||
- name: Running iOS tests
|
||||
run: bazel test //platform/ios/test:ios_test --test_output=errors
|
||||
|
||||
81
platform/ios/scripts/bazel-generate-plists.sh
Normal file
81
platform/ios/scripts/bazel-generate-plists.sh
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
echo "Generating plist files..."
|
||||
|
||||
sem_version="0.0.0"
|
||||
hash=""
|
||||
teamid="0000000000" # Provisioning profile team ID, required for targeting physical devices
|
||||
bundleidprefix="org.maplibre.app" # bundle id prefix
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--sem-ver)
|
||||
shift
|
||||
sem_version="$1"
|
||||
shift
|
||||
;;
|
||||
--hash)
|
||||
shift
|
||||
hash="$1"
|
||||
shift
|
||||
;;
|
||||
--token)
|
||||
shift
|
||||
token="$1"
|
||||
shift
|
||||
;;
|
||||
--team-id)
|
||||
shift
|
||||
teamid="$1"
|
||||
shift
|
||||
;;
|
||||
--bundleidprefix)
|
||||
shift
|
||||
bundleidprefix="$1"
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# 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/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"
|
||||
|
||||
# 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
|
||||
echo "Updating bazel/config.bzl..."
|
||||
cat > platform/ios/bazel/config.bzl <<EOF
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID = "$teamid"
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_NAME = "iOS Team Provisioning Profile: *"
|
||||
BUNDLE_ID_PREFIX = "$bundleidprefix"
|
||||
EOF
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -eo pipefail
|
||||
|
||||
pushd ../../../../../
|
||||
|
||||
# "static" or "dynamic"
|
||||
build_type="static"
|
||||
@@ -11,8 +13,11 @@ release_type="release"
|
||||
# Renderer flavor
|
||||
flavor="legacy"
|
||||
|
||||
# Provisioning team ID
|
||||
teamid="0000000000"
|
||||
echo "------ Determining Maplibre version and hash ------"
|
||||
sem_version=$(git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//')
|
||||
hash=$(git log | head -1 | awk '{ print $2 }' | cut -c 1-10) && true
|
||||
|
||||
args=("--sem-ver" "$sem_version" "--hash" "$hash")
|
||||
|
||||
# Provisioning profile name/UUID
|
||||
uuid="iOS Team Provisioning Profile: *"
|
||||
@@ -39,6 +44,16 @@ while [[ $# -gt 0 ]]; do
|
||||
build_type="link"
|
||||
shift
|
||||
;;
|
||||
--teamid)
|
||||
shift
|
||||
args+=("--team-id" "$1")
|
||||
shift
|
||||
;;
|
||||
--bundleidprefix)
|
||||
shift
|
||||
args+=("--bundleidprefix" "$1")
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
echo "Build the maplibre xcframework using the bazel build files. You must install Baselisk to build using this method."
|
||||
echo "Usage: .bazel-package.sh --static|--dynamic --release|--debug"
|
||||
@@ -50,16 +65,6 @@ while [[ $# -gt 0 ]]; do
|
||||
flavor="$1"
|
||||
shift
|
||||
;;
|
||||
--teamid)
|
||||
shift
|
||||
teamid="$1"
|
||||
shift
|
||||
;;
|
||||
--profile-uuid)
|
||||
shift
|
||||
uuid="$1"
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
@@ -76,35 +81,14 @@ if [ "$release_type" = "debug" ]; then
|
||||
compilation_mode="dbg"
|
||||
fi;
|
||||
|
||||
echo "------ Determining Maplibre version and hash ------"
|
||||
|
||||
sem_version=$(git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//')
|
||||
hash=$(git log | head -1 | awk '{ print $2 }' | cut -c 1-10) && true
|
||||
|
||||
# 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"
|
||||
|
||||
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"
|
||||
|
||||
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"
|
||||
bash "platform/ios/platform/ios/scripts/bazel-generate-plists.sh" "${args[@]}"
|
||||
|
||||
echo "------ Building Maplibre version: $sem_version hash: $hash ------"
|
||||
|
||||
# Generate provisioning team ID
|
||||
cat > platform/ios/bazel/config.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 \
|
||||
|
||||
@@ -7,33 +7,14 @@ 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/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
|
||||
bundleidprefix="org.maplibre.app" # bundle id prefix
|
||||
|
||||
args=("--sem-ver" "$sem_version" "--hash" "$hash")
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
@@ -44,12 +25,12 @@ while [[ $# -gt 0 ]]; do
|
||||
;;
|
||||
--teamid)
|
||||
shift
|
||||
teamid="$1"
|
||||
args+=("--team-id" "$1")
|
||||
shift
|
||||
;;
|
||||
--bundleidprefix)
|
||||
shift
|
||||
bundleidprefix="$1"
|
||||
args+=("--bundleidprefix" "$1")
|
||||
shift
|
||||
;;
|
||||
--apikey)
|
||||
@@ -64,25 +45,7 @@ while [[ $# -gt 0 ]]; do
|
||||
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_NAME = "iOS Team Provisioning Profile: *"
|
||||
BUNDLE_ID_PREFIX = "$bundleidprefix"
|
||||
EOF
|
||||
bash "platform/ios/platform/ios/scripts/bazel-generate-plists.sh" "${args[@]}"
|
||||
|
||||
echo "------ Building Maplibre version: $sem_version hash: $hash ------"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user