Skip to content

Commit

Permalink
[packager] Detect release type based on version naming (#1456)
Browse files Browse the repository at this point in the history
* [packager] Detect release type based on version naming

* Detect snapshots
  • Loading branch information
OdNairy authored Apr 3, 2023
1 parent 0a590b8 commit 0591cd2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions mapbox-maps-ios/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ let coreVersion = "11.0.0-SNAPSHOT.0322T1320Z.ae46035"
let coreChecksum = "5eee9732f78a9cec9b85cc83eeac8db440bb161a04aff879bbe52607567cc8f5"
let commonVersion = "23.5.0-SNAPSHOT.0321T1613Z.cc81dc2"
let commonChecksum = "34e96f7c3b1eeab4c9257d3fdd91a2b353defa6a7c17099c0dd848b3fcb5c468"
let releaseFolder: String = "snapshots"

func folder(_ version: String) -> String { version.contains("SNAPSHOT") ? "snapshots" : "releases" }

let package = Package(
name: "MapboxMaps",
Expand All @@ -26,12 +27,12 @@ let package = Package(
targets: [
.binaryTarget(
name: "MapboxCoreMaps",
url: "https://api.mapbox.com/downloads/v2/mobile-maps-core-internal/\(releaseFolder)/ios/packages/\(coreVersion)/MapboxCoreMaps.xcframework-dynamic.zip",
url: "https://api.mapbox.com/downloads/v2/mobile-maps-core-internal/\(folder(coreVersion))/ios/packages/\(coreVersion)/MapboxCoreMaps.xcframework-dynamic.zip",
checksum: coreChecksum
),
.binaryTarget(
name: "MapboxCommon",
url: "https://api.mapbox.com/downloads/v2/mapbox-common/\(releaseFolder)/ios/packages/\(commonVersion)/MapboxCommon.zip",
url: "https://api.mapbox.com/downloads/v2/mapbox-common/\(folder(commonVersion))/ios/packages/\(commonVersion)/MapboxCommon.zip",
checksum: commonChecksum
),
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ trap finish EXIT
SDK_REGISTRY_NAME=${1}
SDK_REGISTRY_ARTIFACT=${2}
VERSION=${3}
RELEASE_FOLDER=${4}
RELEASE_FOLDER="releases"

mkdir .download
pushd .download

if [[ ${VERSION} = *"SNAPSHOT"* ]]; then
RELEASE_FOLDER="snapshots"
fi

step "Download dependency at https://api.mapbox.com/downloads/v2/$SDK_REGISTRY_NAME/$RELEASE_FOLDER/ios/packages/$VERSION/$SDK_REGISTRY_ARTIFACT.zip"
curl -n "https://api.mapbox.com/downloads/v2/$SDK_REGISTRY_NAME/$RELEASE_FOLDER/ios/packages/$VERSION/$SDK_REGISTRY_ARTIFACT.zip" --output tmp.zip

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ else
exit 1
fi

../download-dependency.sh mapbox-common "$COMMON_ARTIFACT" "$COMMON_VERSION" snapshots
../download-dependency.sh mobile-maps-core-internal "$CORE_ARTIFACT" "$CORE_VERSION" snapshots
../download-dependency.sh mapbox-common "$COMMON_ARTIFACT" "$COMMON_VERSION"
../download-dependency.sh mobile-maps-core-internal "$CORE_ARTIFACT" "$CORE_VERSION"
../build-dependency.sh Turf 'https://github.com/mapbox/turf-swift.git' "$TURF_VERSION" "$LINK_TYPE"

step 'Creating MapboxMaps.xcodeproj'
Expand Down

0 comments on commit 0591cd2

Please sign in to comment.