diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index 63bc89612..58836d12c 100644 --- a/.github/workflows/ios-ci.yml +++ b/.github/workflows/ios-ci.yml @@ -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 diff --git a/platform/ios/scripts/bazel-generate-plists.sh b/platform/ios/scripts/bazel-generate-plists.sh new file mode 100644 index 000000000..f4daba7b8 --- /dev/null +++ b/platform/ios/scripts/bazel-generate-plists.sh @@ -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 < platform/ios/bazel/config.bzl < platform/ios/bazel/__generated__/provisioning_profile.bzl <