Skip to content

Commit c0d37e5

Browse files
OdNairygithub-actions[bot]
authored andcommitted
[maps-ios] Use binary Turf version in packager script (#3135)
Since we are depending on the binary form of the Turf.xcframework now, we have to update the packager to support prebuilt version. Also, this issue is enforcing the MAPSIOS-1802 crashes. See also: - https://developer.apple.com/forums/thread/687259 GitOrigin-RevId: dec4389aa17e4daf859860449e498f5ae0118858
1 parent 80b0943 commit c0d37e5

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

scripts/release/packager/package-mapbox-maps.sh

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,6 @@ MAPBOX_MAPS_DIR=$(realpath "${5:-"../../../../mapbox-maps-ios"}")
1515
LICENSE_PATH=$(realpath "${6:-"../../../LICENSE.md"}")
1616
ARCHIVE_OUTPUT_PATH=${7:-"MapboxMaps.zip"}
1717

18-
function build_from_git() {
19-
local NAME=${1}
20-
local GIT_REPO_URL=${2}
21-
local VERSION=${3}
22-
local LINK_TYPE=${4}
23-
local SCHEME=${5}
24-
local CREATE_XCFRAMEWORK_SCRIPT=${6}
25-
local ARTIFACTS_DIR=${7}
26-
27-
step "Clone $GIT_REPO_URL"
28-
git clone "$GIT_REPO_URL" "$ARTIFACTS_DIR/$NAME"
29-
30-
step "Checkout tag: $VERSION"
31-
git -C "$ARTIFACTS_DIR/$NAME" checkout "$VERSION"
32-
33-
step "Build $NAME"
34-
"$CREATE_XCFRAMEWORK_SCRIPT" "$NAME" "$LINK_TYPE" "$SCHEME" "$ARTIFACTS_DIR/$NAME/$NAME.xcodeproj" Turf "$MAPBOX_MAPS_DIR/Sources/MapboxMaps/MapboxMaps.json" "$ARTIFACTS_DIR"
35-
36-
step "Remove directory"
37-
rm -rf "$ARTIFACTS_DIR/${NAME:?}"
38-
}
39-
4018
function download_binary() {
4119
local SDK_REGISTRY_NAME=${1}
4220
local SDK_REGISTRY_ARTIFACT=${2}
@@ -60,6 +38,22 @@ function download_binary() {
6038
rm -rf .download
6139
}
6240

41+
function download_binary_url() {
42+
local url=${1}
43+
local ARTIFACTS_DIR=${2}
44+
45+
mkdir -p .download
46+
47+
step "Download dependency at $url"
48+
curl -Ln "$url" --output .download/tmp.zip
49+
50+
step "Unzipping $url ..."
51+
unzip -q .download/tmp.zip -d .download
52+
mv .download/*.xcframework "$ARTIFACTS_DIR"
53+
54+
rm -rf .download
55+
}
56+
6357
step 'Reading from versions.json'
6458
CORE_VERSION=$(jq -r '.MapboxCoreMaps' "$VERSIONS_JSON_PATH")
6559
COMMON_VERSION=$(jq -r '.MapboxCommon' "$VERSIONS_JSON_PATH")
@@ -86,9 +80,9 @@ else
8680
exit 1
8781
fi
8882

83+
download_binary_url "https://github.com/mapbox/turf-swift/releases/download/v$TURF_VERSION/Turf.xcframework.zip" "artifacts"
8984
download_binary mapbox-common "$COMMON_ARTIFACT" "$COMMON_VERSION" artifacts
9085
download_binary mobile-maps-core "$CORE_ARTIFACT" "$CORE_VERSION" artifacts
91-
build_from_git "Turf" "https://github.com/mapbox/turf-swift.git" "v$TURF_VERSION" "$LINK_TYPE" "Turf" "$CREATE_XCFRAMEWORK_SCRIPT" artifacts
9286

9387
step 'Creating MapboxMaps.xcodeproj'
9488
cp "$XCODE_PROJECT_SPEC_PATH" artifacts/.xcode/
@@ -102,8 +96,8 @@ step 'Building MapboxMaps.xcframework'
10296
rm -rf artifacts/.xcode
10397

10498
step 'Sign XCFrameworks'
105-
codesign --timestamp -v --sign "Apple Distribution: Mapbox, Inc. (GJZR2MEM28)" "artifacts/Turf.xcframework" "artifacts/MapboxMaps.xcframework"
106-
99+
codesign --timestamp -v --sign "Apple Distribution: Mapbox, Inc." "artifacts/MapboxMaps.xcframework"
100+
107101
step 'Add License and README to bundle'
108102
cp "$LICENSE_PATH" artifacts/LICENSE.md
109103
cp "$README_PATH" artifacts/README.md
@@ -112,4 +106,4 @@ step 'Zip Bundle'
112106
zip -qyr "$ARCHIVE_OUTPUT_PATH" artifacts
113107

114108
step 'Delete Artifacts Directory'
115-
rm -rf artifacts
109+
rm -rf artifacts

0 commit comments

Comments
 (0)