From 9eb6197cdf8c0cd7da2d162f371d81e13e53c40b Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Mon, 4 Mar 2024 20:32:00 +0100 Subject: [PATCH] Remove unused scripts platform/ios (#2168) --- .github/workflows/gh-pages-ios-api.yml | 39 --- platform/ios/INSTALL.md | 243 ------------- platform/ios/Makefile | 331 ------------------ platform/ios/Mapbox.playground/Contents.swift | 154 -------- .../Mapbox.playground/contents.xcplayground | 4 - .../contents.xcworkspacedata | 7 - platform/ios/framework/Info-static.plist | 26 -- platform/ios/framework/Info.plist | 30 -- platform/ios/framework/Mapbox-static.h | 5 - platform/ios/framework/modulemap | 8 - platform/ios/framework/strip-frameworks.sh | 73 ---- platform/ios/jazzy.yml | 140 -------- platform/ios/scripts/deploy-packages.sh | 160 --------- platform/ios/scripts/deploy-snapshot.sh | 17 - platform/ios/scripts/deploy-to-cocoapods.sh | 44 --- platform/ios/scripts/document.sh | 53 --- platform/ios/scripts/ios-code-coverage.sh | 31 -- platform/ios/scripts/lint-plists.sh | 13 - platform/ios/scripts/lint-podspecs.js | 79 ----- platform/ios/scripts/metrics.sh | 26 -- platform/ios/scripts/package.sh | 275 --------------- platform/ios/scripts/publish.sh | 91 ----- .../ios/scripts/release-notes-github.md.ejs | 2 - .../ios/scripts/release-notes-jazzy.md.ejs | 21 -- platform/ios/scripts/release-notes.js | 103 ------ platform/ios/scripts/size-check.sh | 98 ------ platform/ios/scripts/update-swift-package.sh | 71 ---- platform/ios/scripts/update-version.sh | 32 -- .../ios/scripts/validate-framework-zip.sh | 131 ------- platform/ios/scripts/xcpackage.sh | 148 -------- platform/ios/testall.sh | 20 -- 31 files changed, 2475 deletions(-) delete mode 100644 .github/workflows/gh-pages-ios-api.yml delete mode 100644 platform/ios/INSTALL.md delete mode 100644 platform/ios/Makefile delete mode 100644 platform/ios/Mapbox.playground/Contents.swift delete mode 100644 platform/ios/Mapbox.playground/contents.xcplayground delete mode 100644 platform/ios/Mapbox.playground/playground.xcworkspace/contents.xcworkspacedata delete mode 100644 platform/ios/framework/Info-static.plist delete mode 100644 platform/ios/framework/Info.plist delete mode 100644 platform/ios/framework/Mapbox-static.h delete mode 100644 platform/ios/framework/modulemap delete mode 100644 platform/ios/framework/strip-frameworks.sh delete mode 100644 platform/ios/jazzy.yml delete mode 100644 platform/ios/scripts/deploy-packages.sh delete mode 100644 platform/ios/scripts/deploy-snapshot.sh delete mode 100644 platform/ios/scripts/deploy-to-cocoapods.sh delete mode 100644 platform/ios/scripts/document.sh delete mode 100644 platform/ios/scripts/ios-code-coverage.sh delete mode 100755 platform/ios/scripts/lint-plists.sh delete mode 100644 platform/ios/scripts/lint-podspecs.js delete mode 100644 platform/ios/scripts/metrics.sh delete mode 100644 platform/ios/scripts/package.sh delete mode 100644 platform/ios/scripts/publish.sh delete mode 100644 platform/ios/scripts/release-notes-github.md.ejs delete mode 100644 platform/ios/scripts/release-notes-jazzy.md.ejs delete mode 100644 platform/ios/scripts/release-notes.js delete mode 100755 platform/ios/scripts/size-check.sh delete mode 100644 platform/ios/scripts/update-swift-package.sh delete mode 100644 platform/ios/scripts/update-version.sh delete mode 100644 platform/ios/scripts/validate-framework-zip.sh delete mode 100644 platform/ios/scripts/xcpackage.sh delete mode 100755 platform/ios/testall.sh diff --git a/.github/workflows/gh-pages-ios-api.yml b/.github/workflows/gh-pages-ios-api.yml deleted file mode 100644 index ee7117c3d..000000000 --- a/.github/workflows/gh-pages-ios-api.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: gh-pages-ios-api - -on: - workflow_dispatch - -jobs: - build-api: - runs-on: macos-12 - env: - BUILDTYPE: Debug - HOMEBREW_NO_AUTO_UPDATE: 1 - HOMEBREW_NO_INSTALL_CLEANUP: 1 - - defaults: - run: - working-directory: platform/ios - shell: bash - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - - - name: npm install - run: npm install --ignore-scripts - - - name: Prepare ccache - run: ccache --clear - - - name: Build docs - run: make idocument - - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.5.0 - with: - branch: gh-pages - folder: platform/ios/documentation/ - target-folder: ios/api/ diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md deleted file mode 100644 index 7bca3d2f4..000000000 --- a/platform/ios/INSTALL.md +++ /dev/null @@ -1,243 +0,0 @@ -# Building & Developing from Source - -**Just trying to use one of the Mapbox Maps SDKs? You don't need to read this stuff! We -provide [easy-to-install, prebuilt versions of the SDK for iOS -that you can download instantly and get started with fast](https://github.com/maplibre/maplibre-gl-native-distribution).** - -# Integrating custom builds of the Mapbox Maps SDK for iOS into your application - -This document explains how to build a development version of Mapbox Maps SDK for iOS for use in your own Cocoa Touch application. To use a production-ready version of the SDK, see the [Mapbox Maps SDK for iOS installation page](https://www.mapbox.com/install/ios/). - -### Requirements - -The Mapbox Maps SDK for iOS is intended to run on iOS 9.0 and above on the following devices: - -* iPhone 4s and above (5, 5c, 5s, 6, 6 Plus, 7, 7 Plus, 8, 8 Plus, X) -* iPad 2 and above (3, 4, Mini, Air, Mini 2, Air 2, Pro) -* iPod touch 5th generation and above - - -Note that debugging in 32-bit simulators (such as the iPhone 5 or iPad 2) is only partially supported. - -The Mapbox Maps SDK for iOS requires: - -* Xcode 9.1 or higher to compile from source -* Xcode 8.0 or higher to integrate the compiled framework into an application - -Before building, follow these steps to install prerequisites: - -1. Install [Xcode](https://developer.apple.com/xcode/) -1. Launch Xcode and install any updates -1. Install [Homebrew](http://brew.sh) -1. Install additional dependencies. - ```bash - brew install node cmake ccache pkg-config glfw cmake-docs - ``` - -1. Install [xcpretty](https://github.com/supermarin/xcpretty) for prettifying command line builds. (optional): - ``` - sudo gem install xcpretty - ``` -1. Install [jazzy](https://github.com/realm/jazzy) for generating API documentation (optional): - ``` - sudo gem install jazzy - ``` - -### Build the iOS Demo App - -``` -git clone --recurse-submodules git@github.com:maplibre/maplibre-native.git -cd maplibre-native/platform/ios -make iproj -``` - -Xcode should automatically open, and you can then build the Demo App (iosapp). - -![iosapp](https://user-images.githubusercontent.com/556367/214957991-7ddb56b1-937e-4a15-a03c-36f355677cf6.png) - -If you wish to deploy on attached hardware, you need to setup your Apple Developer account and select it in the *Signing and Capabilities* menu. - -![Team](https://user-images.githubusercontent.com/556367/214957613-2d565b1a-6590-495e-8979-2022096e02f1.png) - -### Building the SDK - -1. Clone the git repository: - ```bash - git clone --recurse-submodules https://github.com/maplibre/maplibre-native.git - cd maplibre-native - ``` - Note that you must check out the project's git submodules to build. If you did not include `--recurse-submodules` in the clone, you can later run `git submodule update --init`. -1. Run `make iframework BUILDTYPE=Release`. The packaging script will produce a `build/ios/pkg/` folder containing: - - a `dynamic` folder containing a dynamically-linked fat framework with debug symbols for devices and the iOS Simulator - - a `documentation` folder with HTML API documentation - - an example `Settings.bundle` containing an optional Mapbox Telemetry opt-out setting - -See the [packaging documentation](DEVELOPING.md#packaging-builds) for other build options. - -### Installation - -There are several ways to install custom builds of the Mapbox Maps SDK for iOS: - -#### Dynamic framework - -This is the recommended workflow for manually integrating custom builds of the SDK into an application: - -1. Build from source manually, per above. - -1. Open the project editor, select your application target, then go to the General tab. Drag Mapbox.framework from the `build/ios/pkg/dynamic/` directory into the “Embedded Binaries” section. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. - -1. In the Build Phases tab, click the + button at the top and select “New Run Script Phase”. Enter the following code into the script text field: - -```bash -bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mapbox.framework/strip-frameworks.sh" -``` - -(The last step, courtesy of [Realm](https://github.com/realm/realm-cocoa/), is required for working around an [iOS App Store bug](http://www.openradar.me/radar?id=6409498411401216) when archiving universal binaries.) - -##### Snapshot builds - -A snapshot build of the dynamic framework, based on the latest commit to the master branch, is available for download [here](https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/mapbox-ios-sdk-snapshot-dynamic.zip). - -#### Static framework - -You can alternatively install the SDK as a static framework: - -1. Build from source using the `make iframework FORMAT=static BUILDTYPE=Release` command. - -1. Drag the Mapbox.bundle and Mapbox.framework from the `build/ios/pkg/static/` directory into the Project navigator. In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. Open the project editor and select your application target to verify that the following changes occurred automatically: - - - In the General tab, Mapbox.framework is listed in the “Linked Frameworks and Libraries” section. - - In the Build Settings tab, the “Framework Search Paths” (`FRAMEWORK_SEARCH_PATHS`) build setting includes the directory that contains Mapbox.framework. For most projects, the default value of `$(inherited) $(PROJECT_DIR)` should be sufficient. - - In the Build Phases tab, Mapbox.bundle is listed in the “Copy Bundle Resources” build phase. - -1. Back in the General tab, add the following Cocoa Touch frameworks and libraries to the “Linked Frameworks and Libraries” section: - - - GLKit.framework - - ImageIO.framework - - MobileCoreServices.framework - - QuartzCore.framework - - SystemConfiguration.framework - - libc++.tbd - - libsqlite3.tbd - - libz.tbd - -1. In the Build Settings tab, find the Other Linker Flags setting and add `-ObjC`. - -#### CocoaPods - -For instructions on installing stable release versions of the Mapbox Maps SDK for iOS with CocoaPods, see [our website](https://www.mapbox.com/install/ios/cocoapods/). - -As of v5.6.0, you must specify `use_frameworks!` in your Podfile. - -##### Testing pre-releases with CocoaPods - -To test pre-releases of the dynamic framework, directly specify the version in your `Podfile`: - -```rb -pod 'Mapbox-iOS-SDK', '~> x.x.x-alpha.1' -``` - -##### Testing snapshot releases with CocoaPods - -To test a snapshot dynamic framework build, update your app’s `Podfile` to point to: - -```rb -pod 'Mapbox-iOS-SDK-snapshot-dynamic', podspec: 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native-ios/master/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec' -``` - -##### Using your own build with CocoaPods - -1. Build from source manually, per above. - -1. Edit [`Mapbox-iOS-SDK.podspec`](./Mapbox-iOS-SDK.podspec) to point to the local build output: - - ```diff - m.source = { - - :http => "https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/mapbox-ios-sdk-#{m.version.to_s}-dynamic.zip", - + :path => "../../build/ios/pkg/dynamic/", - :flatten => true - } - ``` - -1. Update your app’s `Podfile` to point to the edited `Mapbox-iOS-SDK.podspec`. - - ```rb - pod 'Mapbox-iOS-SDK', :path => '{...}/platform/ios/Mapbox-iOS-SDK.podspec' - ``` - -1. Run `pod update` to grab the newly-built library. - -If using the static framework, add `$(inherited)` to your target’s Other Linker Flags in the Build Settings tab. - -##### Using pre-stripped releases with CocoaPods - -If you choose to commit the contents of your `Pods` directory to source control and are encountering file size limitations, you may wish to use builds that have been pre-stripped of debug symbols. We publish these to [our public podspecs repository](https://github.com/mapbox/pod-specs/), which should be added as an additional `source` in your app’s `Podfile`. - -```rb -source 'https://github.com/mapbox/pod-specs.git' - -pod 'Mapbox-iOS-SDK-stripped', '~> x.x.x' -``` - -Note that these builds lack some debugging information, which could make development more difficult and result in less useful crash reports. Though initially smaller on disk, using these builds has no effect on the ultimate size of your application — see our [Understanding iOS Framework Size guide](https://www.mapbox.com/help/ios-framework-size/) for more information. - -#### Carthage - -For instructions on installing stable release versions of the Mapbox Maps SDK for iOS with Carthage, see [our website](https://www.mapbox.com/install/ios/carthage/). - -Please note that as of ios-v5.6.0-alpha.2, `--no-use-binaries` has no affect on projects built with the Mapbox framework. - -##### Testing pre-releases with Carthage - -To test pre-releases of the dynamic framework, directly specify the version in your Cartfile: - -```json -binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> x.x.x-alpha.1 -github "mapbox/mapbox-events-ios" == x.x.x -``` - -Where `x.x.x` is the latest version of the [Mapbox Mobile Events](https://github.com/mapbox/mapbox-events-ios) library. - -##### Testing snapshot releases with Carthage - -This project does not currently support using snapshot releases via Carthage. - -##### Using your own build with Carthage - -This project does not support being compiled as a local repository by Carthage. - -##### Using pre-stripped releases with Carthage - -If you require a build with debug symbols pre-stripped, use [this feed URL](https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK-stripped.json) with Carthage. - -### Configuration - -1. Some vector tiles servers require a API key. In the project editor, select the application target, then go to the Info tab. Under the “Custom iOS Target Properties” section, set `MLNApiKey` to your api key.. - -### Usage - -In a storyboard or XIB, add a view to your view controller. (Drag View from the Object library to the View Controller scene on the Interface Builder canvas.) In the Identity inspector, set the view’s custom class to `MLNMapView`. If you need to manipulate the map view programmatically: - -1. Switch to the Assistant Editor. -1. Import the `Mapbox` module. -1. Connect the map view to a new outlet in your view controller class. (Control-drag from the map view in Interface Builder to a valid location in your view controller implementation.) The resulting outlet declaration should look something like this: - -```objc -// ViewController.m -@import Mapbox; - -@interface ViewController : UIViewController - -@property (strong) IBOutlet MLNMapView *mapView; - -@end -``` - -```swift -// ViewController.swift -import Mapbox - -class ViewController: UIViewController { - @IBOutlet var mapView: MLNMapView! -} -``` \ No newline at end of file diff --git a/platform/ios/Makefile b/platform/ios/Makefile deleted file mode 100644 index 37f657604..000000000 --- a/platform/ios/Makefile +++ /dev/null @@ -1,331 +0,0 @@ -export BUILDTYPE ?= Debug -export IS_LOCAL_DEVELOPMENT ?= true -export TARGET_BRANCH ?= main -export CI ?= 0 -export DEV_TEAM ?= "" - -# When only the dependencies in the package.json are installed -# Node.js will error when running a script from the root scripts directory -# Getting rid of the duplicate package.json file is an open issue -# https://github.com/maplibre/maplibre-native/issues/657 - -export NODE_PATH = ../../node_modules - -CMAKE ?= cmake - - -ifeq ($(BUILDTYPE), Release) -else ifeq ($(BUILDTYPE), RelWithDebInfo) -else ifeq ($(BUILDTYPE), Sanitize) -else ifeq ($(BUILDTYPE), Debug) -else - $(error BUILDTYPE must be Debug, Sanitize, Release or RelWithDebInfo) -endif - -buildtype := $(shell echo "$(BUILDTYPE)" | tr "[A-Z]" "[a-z]") - -ifeq ($(shell uname -s), Darwin) - HOST_PLATFORM = macos - HOST_PLATFORM_VERSION = $(shell uname -m) - export NINJA = platform/macos/ninja - export NCPU := $(shell sysctl -n hw.ncpu) - export JOBS ?= $(shell expr $(NCPU) - 1) -else ifeq ($(shell uname -s), Linux) - HOST_PLATFORM = linux - HOST_PLATFORM_VERSION = $(shell uname -m) - export NINJA = platform/linux/ninja - export JOBS ?= $(shell grep --count processor /proc/cpuinfo) -else - $(error Cannot determine host platform) -endif - -ifeq ($(MASON_PLATFORM),) - BUILD_PLATFORM = $(HOST_PLATFORM) -else - BUILD_PLATFORM = $(MASON_PLATFORM) -endif - -ifeq ($(MASON_PLATFORM_VERSION),) - BUILD_PLATFORM_VERSION = $(HOST_PLATFORM_VERSION) -else - BUILD_PLATFORM_VERSION = $(MASON_PLATFORM_VERSION) -endif - -ifeq ($(MASON_PLATFORM),macos) - MASON_PLATFORM=osx -endif - -ifeq ($(V), 1) - export XCPRETTY - NINJA_ARGS ?= -v -else - export XCPRETTY ?= | tee '$(shell pwd)/build/xcodebuild-$(shell date +"%Y-%m-%d_%H%M%S").log' | xcpretty - NINJA_ARGS ?= -endif - -.PHONY: default -default: test - -BUILD_DEPS += ../../CMakeLists.txt - -BUILD_DOCS ?= true - -#### iOS targets ############################################################## - -ifeq ($(HOST_PLATFORM), macos) - -IOS_OUTPUT_PATH = build/ios -IOS_PROJ_PATH = $(IOS_OUTPUT_PATH)/Mapbox\ GL\ Native.xcodeproj -IOS_WORK_PATH = platform/ios/ios.xcworkspace -IOS_USER_DATA_PATH = $(IOS_WORK_PATH)/xcuserdata/$(USER).xcuserdatad - -IOS_XCODEBUILD_SIM = xcodebuild \ - ARCHS=arm64 ONLY_ACTIVE_ARCH=YES \ - -derivedDataPath $(IOS_OUTPUT_PATH) \ - -configuration $(BUILDTYPE) -sdk iphonesimulator \ - -workspace $(IOS_WORK_PATH) \ - -jobs $(JOBS) - -ifneq ($(MORE_SIMULATORS),) - IOS_LATEST = true -endif - -ifdef IOS_LATEST - IOS_XCODEBUILD_SIM += \ - -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14 Pro' \ - -destination 'platform=iOS Simulator,OS=latest,name=iPad (10th generation)' -endif - -# If IOS_XCODEBUILD_SIM does not contain a simulator destination, add the default. -ifeq (, $(findstring destination, $(IOS_XCODEBUILD_SIM))) - IOS_XCODEBUILD_SIM += \ - -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14 Pro' -else - IOS_XCODEBUILD_SIM += -parallel-testing-enabled YES -endif - -ifneq ($(ONLY_TESTING),) - IOS_XCODEBUILD_SIM += -only-testing:$(ONLY_TESTING) -endif - -ifneq ($(SKIP_TESTING),) - IOS_XCODEBUILD_SIM += -skip-testing:$(SKIP_TESTING) -endif - -ifneq ($(CI),) - IOS_XCODEBUILD_SIM += -xcconfig platform/darwin/ci.xcconfig -endif - -$(IOS_PROJ_PATH): $(IOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings $(BUILD_DEPS) - mkdir -p $(IOS_OUTPUT_PATH) - (cd $(IOS_OUTPUT_PATH) && $(CMAKE) -G Xcode ../../../../ \ - -DCMAKE_SYSTEM_NAME=iOS ) - -$(IOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings: platform/ios/WorkspaceSettings.xcsettings - mkdir -p "$(IOS_USER_DATA_PATH)" - cp platform/ios/WorkspaceSettings.xcsettings "$@" - -.PHONY: ios -ios: $(IOS_PROJ_PATH) - set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'CI' build $(XCPRETTY) - -# make iproj -.PHONY: iproj -iproj: $(IOS_PROJ_PATH) style-code - @# Check if Xcode should run in headless mode - @# If CI=1, then just perform `make iproj` - @# else, use `xed` to open the XCworkspace - @if [ $(CI) == 1 ]; then echo "make iproj CI=1. Running in headless mode, skip opening .xcworkspace in Xcode. To open Xcode use 'xed $(IOS_WORK_PATH)'"; else echo "make iproj. Opening MapLibre in Xcode using: 'xed $(IOS_WORK_PATH)'. To skip opening Xcode, use 'make iproj CI=1'"; xed $(IOS_WORK_PATH); fi; - @echo "## Xcode dependencies" - @xcodebuild -version - @uname -a - @sw_vers - @arch - @brew list --versions cmake ccache pkg-config glfw - -.PHONY: ios-lint-plist -ios-lint-plist: - find platform/ios/framework -type f -name '*.plist' | xargs plutil -lint - find platform/ios/app -type f -name '*.plist' | xargs plutil -lint - -.PHONY: ios-lint -ios-lint: ios-pod-lint - find platform/ios/framework -type f -name '*.plist' | xargs plutil -lint - find platform/ios/app -type f -name '*.plist' | xargs plutil -lint - -.PHONY: ios-pod-lint -ios-pod-lint: - ./platform/ios/scripts/lint-podspecs.js - -# make ios-sizetest -.PHONY: ios-sizetest -ios-sizetest: - ./scripts/size-check.sh ${DEV_TEAM} - -# make ios-uitest -.PHONY: ios-uitest -ios-uitest: $(IOS_PROJ_PATH) - set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'iosapp' test $(XCPRETTY) - echo "You can review uitest results: open $(IOS_OUTPUT_PATH)/Logs/Test" - -.PHONY: ios-test -ios-test: style-code $(IOS_PROJ_PATH) - set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'CI' test $(XCPRETTY) - -.PHONY: ios-integration-test -ios-integration-test: $(IOS_PROJ_PATH) - set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'Integration Test Harness' test $(XCPRETTY) - -.PHONY: ios-sanitize -ios-sanitize: $(IOS_PROJ_PATH) - set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'CI' -enableThreadSanitizer YES -enableUndefinedBehaviorSanitizer YES test $(XCPRETTY) - -.PHONY: ios-sanitize-address -ios-sanitize-address: $(IOS_PROJ_PATH) - set -o pipefail && $(IOS_XCODEBUILD_SIM) -scheme 'CI' -enableAddressSanitizer YES test $(XCPRETTY) - -.PHONY: ios-static-analyzer -ios-static-analyzer: $(IOS_PROJ_PATH) - set -o pipefail && $(IOS_XCODEBUILD_SIM) analyze -scheme 'CI' test $(XCPRETTY) - -.PHONY: ios-install-simulators -ios-install-simulators: - xcversion simulators --install="iOS 11.4" || true - xcversion simulators --install="iOS 10.3.1" || true - xcversion simulators --install="iOS 9.3" || true - -.PHONY: ipackage -ipackage: ipackage* -ipackage%: - @echo make ipackage is deprecated — use make iframework. - -.PHONY: iframework -iframework: $(IOS_PROJ_PATH) style-code - FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) BUILD_DOCS=$(BUILD_DOCS) \ - ./platform/ios/scripts/package.sh - -# make xcframework -.PHONY: xcframework -xcframework: $(IOS_PROJ_PATH) style-code - FORMAT=$(FORMAT) SYMBOLS=$(SYMBOLS) BUILD_DOCS=$(BUILD_DOCS) \ - ./platform/ios/scripts/xcpackage.sh - -.PHONY: ideploy -ideploy: - caffeinate -i ./platform/ios/scripts/deploy-packages.sh - -# make idocument -# open documentation/ -.PHONY: idocument -idocument: style-code - OUTPUT=$(OUTPUT) ./platform/ios/scripts/document.sh - -.PHONY: darwin-check-public-symbols -darwin-check-public-symbols: - node platform/darwin/scripts/check-public-symbols.js macOS iOS - -endif - -ios-docs: $(IOS_PROJ_PATH) style-code - npm ci --prefix ../.. --ignore-scripts - $(IOS_XCODEBUILD_SIM) docbuild -scheme CI - -ios-docs-static: ios-docs - $(xcrun --find docc) process-archive transform-for-static-hosting \ - $(IOS_OUTPUT_PATH)/Debug-iphonesimulator/Mapbox.doccarchive \ - --output-path $(IOS_OUTPUT_PATH)/static-docs - -#### macOS targets ############################################################ - -ifeq ($(HOST_PLATFORM), macos) - -MACOS_OUTPUT_PATH = build/macos -MACOS_PROJ_PATH = $(MACOS_OUTPUT_PATH)/Mapbox\ GL\ Native.xcodeproj -MACOS_WORK_PATH = platform/macos/macos.xcworkspace -MACOS_USER_DATA_PATH = $(MACOS_WORK_PATH)/xcuserdata/$(USER).xcuserdatad - -MACOS_XCODEBUILD = xcodebuild \ - -derivedDataPath $(MACOS_OUTPUT_PATH) \ - -configuration $(BUILDTYPE) \ - -workspace $(MACOS_WORK_PATH) \ - -jobs $(JOBS) - -ifneq ($(CI),) - MACOS_XCODEBUILD += -xcconfig platform/darwin/ci.xcconfig -endif - -$(MACOS_PROJ_PATH): $(MACOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings $(BUILD_DEPS) - mkdir -p $(MACOS_OUTPUT_PATH) - (cd $(MACOS_OUTPUT_PATH) && $(CMAKE) -G Xcode ../../../../ \ - -DCMAKE_SYSTEM_NAME=Darwin ) - -$(MACOS_USER_DATA_PATH)/WorkspaceSettings.xcsettings: platform/macos/WorkspaceSettings.xcsettings - mkdir -p "$(MACOS_USER_DATA_PATH)" - cp platform/macos/WorkspaceSettings.xcsettings "$@" - -.PHONY: macos -macos: $(MACOS_PROJ_PATH) - set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'CI' build $(XCPRETTY) - -.PHONY: xproj -xproj: $(MACOS_PROJ_PATH) style-code - xed $(MACOS_WORK_PATH) - -# make macos-test -.PHONY: macos-test -macos-test: style-code $(MACOS_PROJ_PATH) - set -o pipefail && $(MACOS_XCODEBUILD) -scheme 'CI' test $(XCPRETTY) - -.PHONY: macos-lint -macos-lint: - find platform/macos -type f -name '*.plist' | xargs plutil -lint - -.PHONY: xpackage -xpackage: $(MACOS_PROJ_PATH) - SYMBOLS=$(SYMBOLS) ./platform/macos/scripts/package.sh - -.PHONY: xdeploy -xdeploy: - caffeinate -i ./platform/macos/scripts/deploy-packages.sh - -.PHONY: xdocument -xdocument: - OUTPUT=$(OUTPUT) ./platform/macos/scripts/document.sh - -.PHONY: genstrings -genstrings: - genstrings -u -o platform/macos/sdk/Base.lproj platform/darwin/src/*.{m,mm} - genstrings -u -o platform/macos/sdk/Base.lproj platform/macos/src/*.{m,mm} - genstrings -u -o platform/ios/resources/Base.lproj platform/ios/src/*.{m,mm} - -find platform/ios/resources platform/macos/sdk -path '*/Base.lproj/*.strings' -exec \ - textutil -convert txt -extension strings -inputencoding UTF-16 -encoding UTF-8 {} \; - mv platform/macos/sdk/Base.lproj/Foundation.strings platform/darwin/resources/Base.lproj/ - -endif - -#### Miscellaneous targets ##################################################### - -.PHONY: node-modules -node-modules: - npm ci --prefix ../.. --ignore-scripts - -.PHONY: style-code -style-code: node-modules - node ../../scripts/generate-style-code.js - node platform/darwin/scripts/generate-style-code.js - node platform/darwin/scripts/update-examples.js - -.PHONY: codestyle -codestyle: - scripts/codestyle.sh - -# make clean -.PHONY: clean -clean: - -rm -rf ./build \ - ./lib/*.node - -.PHONY: distclean -distclean: clean - -rm -rf ./mason_packages - -rm -rf ./node_modules diff --git a/platform/ios/Mapbox.playground/Contents.swift b/platform/ios/Mapbox.playground/Contents.swift deleted file mode 100644 index e3694576e..000000000 --- a/platform/ios/Mapbox.playground/Contents.swift +++ /dev/null @@ -1,154 +0,0 @@ -import UIKit -import PlaygroundSupport -import Mapbox - -let width: CGFloat = 700 -let height: CGFloat = 800 - -class Responder: NSObject { - var mapView: MLNMapView? - @objc func togglePitch(sender: UISwitch) { - let camera = mapView!.camera - camera.pitch = sender.isOn ? 60 : 0 - mapView!.setCamera(camera, animated: false) - } -} - -//: A control panel -let panelWidth: CGFloat = 200 -let panel = UIView(frame: CGRect(x: width - panelWidth, y: 0, width: 200, height: 100)) -panel.alpha = 0.8 -panel.backgroundColor = .white - -// Delete markers -let deleteSwitchLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 30)) -deleteSwitchLabel.adjustsFontSizeToFitWidth = true -deleteSwitchLabel.text = "Delete Markers" -let deleteMarkerSwitchView = UISwitch(frame: CGRect(x: panelWidth - panelWidth / 2.0, y:0, width: 100, height: 50)) -panel.addSubview(deleteSwitchLabel) -panel.addSubview(deleteMarkerSwitchView) - -// Hide markers -let hideSwitchLabel = UILabel(frame: CGRect(x: 0, y: 30, width: 100, height: 30)) -hideSwitchLabel.adjustsFontSizeToFitWidth = true -hideSwitchLabel.text = "Hide Markers" -let hideMarkerSwitchView = UISwitch(frame: CGRect(x: panelWidth - panelWidth / 2.0, y: 30, width: 100, height: 50)) -panel.addSubview(hideSwitchLabel) -panel.addSubview(hideMarkerSwitchView) - -// Pitch map -let pitchLabel = UILabel(frame: CGRect(x: 0, y: 60, width: 100, height: 30)) -pitchLabel.text = "Pitch" -let pitchSwitch = UISwitch(frame: CGRect(x: panelWidth-panelWidth / 2.0, y: 60, width: 100, height: 50)) -let responder = Responder() -pitchSwitch.addTarget(responder, action: #selector(responder.togglePitch(sender:)), for: .valueChanged) -panel.addSubview(pitchLabel) -panel.addSubview(pitchSwitch) - -//: # Mapbox Maps - -/*: - Put your access token into a plain text file called `token`. Then select the “token” placeholder below, go to Editor ‣ Insert File Literal, and select the `token` file. - */ -var apiKey = try String(contentsOfURL: <#token#>) -MLNSettings.apiKey = apiKey - -class PlaygroundAnnotationView: MLNAnnotationView { - - override func prepareForReuse() { - isHidden = hideMarkerSwitchView.isOn - } - -} - -//: Define a map delegate - -class MapDelegate: NSObject, MLNMapViewDelegate { - - var annotationViewByAnnotation = [MLNPointAnnotation: PlaygroundAnnotationView]() - - func mapView(_ mapView: MLNMapView, viewFor annotation: MLNAnnotation) -> MLNAnnotationView? { - - var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "annotation") as? PlaygroundAnnotationView - - if (annotationView == nil) { - let av = PlaygroundAnnotationView(reuseIdentifier: "annotation") - av.frame = CGRect(x: 0, y: 0, width: 30, height: 30) - av.centerOffset = CGVector(dx: -15, dy: -15) - let centerView = UIView(frame: av.bounds.insetBy(dx: 3, dy: 3)) - centerView.backgroundColor = .white - av.addSubview(centerView) - av.backgroundColor = .purple - annotationView = av - } else { - annotationView!.subviews.first?.backgroundColor = .green - } - - annotationViewByAnnotation[annotation as! MLNPointAnnotation] = annotationView - - return annotationView - } - - func mapView(_ mapView: MLNMapView, didSelect annotation: MLNAnnotation) { - let pointAnnotation = annotation as! MLNPointAnnotation - let annotationView: PlaygroundAnnotationView = annotationViewByAnnotation[pointAnnotation]! - - for view in annotationViewByAnnotation.values { - view.layer.zPosition = -1 - } - - annotationView.layer.zPosition = 1 - - UIView.animate(withDuration: 1.25, delay: 0, usingSpringWithDamping: 0.4, initialSpringVelocity: 0.6, options: .curveEaseOut, animations: { - annotationView.transform = CGAffineTransform(scaleX: 1.8, y: 1.8) - }) { _ in - annotationView.transform = CGAffineTransform(scaleX: 1, y: 1) - - if deleteMarkerSwitchView.isOn { - mapView.removeAnnotation(pointAnnotation) - return - } - - if hideMarkerSwitchView.isOn { - annotationView.isHidden = true - } - } - } - - @objc func handleTap(press: UILongPressGestureRecognizer) { - let mapView: MLNMapView = press.view as! MLNMapView - - let isRecognized = press.state == .recognized - - if (isRecognized) { - let annotation = MLNPointAnnotation() - annotation.title = "Dropped Marker" - annotation.coordinate = mapView.convert(press.location(in: mapView), toCoordinateFrom: mapView) - mapView.addAnnotation(annotation) - mapView.showAnnotations([annotation], animated: true) - } - } - -} - -//: Create a map and its delegate - -let mapView = MLNMapView(frame: CGRect(x: 0, y: 0, width: width, height: height)) -mapView.frame = CGRect(x: 0, y: 0, width: width, height: height) - -PlaygroundPage.current.liveView = mapView - -let mapDelegate = MapDelegate() -mapView.delegate = mapDelegate -responder.mapView = mapView - -let tapGesture = UILongPressGestureRecognizer(target: mapDelegate, action: #selector(mapDelegate.handleTap)) -mapView.addGestureRecognizer(tapGesture) - -//: Zoom in to a location - -mapView.setCenter(CLLocationCoordinate2D(latitude: 37.174057, longitude: -104.490984), zoomLevel: 12, animated: false) - -//: Add control panel - -mapView.addSubview(panel) diff --git a/platform/ios/Mapbox.playground/contents.xcplayground b/platform/ios/Mapbox.playground/contents.xcplayground deleted file mode 100644 index c8659f26e..000000000 --- a/platform/ios/Mapbox.playground/contents.xcplayground +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/platform/ios/Mapbox.playground/playground.xcworkspace/contents.xcworkspacedata b/platform/ios/Mapbox.playground/playground.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a62..000000000 --- a/platform/ios/Mapbox.playground/playground.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/platform/ios/framework/Info-static.plist b/platform/ios/framework/Info-static.plist deleted file mode 100644 index 67e207823..000000000 --- a/platform/ios/framework/Info-static.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundleShortVersionString - 5.9.0 - CFBundleSignature - ???? - CFBundleVersion - 15256 - MLNCommitHash - $(CURRENT_COMMIT_HASH) - MLNSemanticVersionString - $(CURRENT_SEMANTIC_VERSION) - NSPrincipalClass - - - diff --git a/platform/ios/framework/Info.plist b/platform/ios/framework/Info.plist deleted file mode 100644 index 9f1b753a7..000000000 --- a/platform/ios/framework/Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 5.9.0 - CFBundleSignature - ???? - CFBundleVersion - 15256 - MLNCommitHash - $(CURRENT_COMMIT_HASH) - MLNSemanticVersionString - $(CURRENT_SEMANTIC_VERSION) - NSPrincipalClass - - - diff --git a/platform/ios/framework/Mapbox-static.h b/platform/ios/framework/Mapbox-static.h deleted file mode 100644 index 864a3fd5b..000000000 --- a/platform/ios/framework/Mapbox-static.h +++ /dev/null @@ -1,5 +0,0 @@ -#import -#import -#import -#import -#import diff --git a/platform/ios/framework/modulemap b/platform/ios/framework/modulemap deleted file mode 100644 index 450db0dd6..000000000 --- a/platform/ios/framework/modulemap +++ /dev/null @@ -1,8 +0,0 @@ -framework module Mapbox { - umbrella header "Mapbox.h" - export * - module * { export * } - link "c++" - link "sqlite3" - link "z" -} \ No newline at end of file diff --git a/platform/ios/framework/strip-frameworks.sh b/platform/ios/framework/strip-frameworks.sh deleted file mode 100644 index 686541566..000000000 --- a/platform/ios/framework/strip-frameworks.sh +++ /dev/null @@ -1,73 +0,0 @@ -################################################################################ -# -# Copyright 2015 Realm Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -################################################################################ - -# This script strips all non-valid architectures from dynamic libraries in -# the application's `Frameworks` directory. -# -# The following environment variables are required: -# -# BUILT_PRODUCTS_DIR -# FRAMEWORKS_FOLDER_PATH -# VALID_ARCHS -# EXPANDED_CODE_SIGN_IDENTITY - - -# Signs a framework with the provided identity -code_sign() { - # Use the current code_sign_identitiy - echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements $1" - /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" -} - -# Set working directory to product’s embedded frameworks -cd "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}" - -if [ "$ACTION" = "install" ]; then - echo "Copy .bcsymbolmap files to .xcarchive" - find . -name '*.bcsymbolmap' -type f -exec mv {} "${CONFIGURATION_BUILD_DIR}" \; -else - # Delete *.bcsymbolmap files from framework bundle unless archiving - find . -name '*.bcsymbolmap' -type f -exec rm -rf "{}" +\; -fi - -echo "Stripping frameworks" - -for file in $(find . -type f -perm +111); do - # Skip non-dynamic libraries - if ! [[ "$(file "$file")" == *"dynamically linked shared library"* ]]; then - continue - fi - # Get architectures for current file - archs="$(lipo -info "${file}" | rev | cut -d ':' -f1 | rev)" - stripped="" - for arch in $archs; do - if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then - # Strip non-valid architectures in-place - lipo -remove "$arch" -output "$file" "$file" || exit 1 - stripped="$stripped $arch" - fi - done - if [[ "$stripped" != "" ]]; then - echo "Stripped $file of architectures:$stripped" - if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then - code_sign "${file}" - fi - fi -done - diff --git a/platform/ios/jazzy.yml b/platform/ios/jazzy.yml deleted file mode 100644 index 516862701..000000000 --- a/platform/ios/jazzy.yml +++ /dev/null @@ -1,140 +0,0 @@ -module: MapLibre -author: MapLibre Contributors -author_url: https://maplibre.org/ -github_url: https://github.com/maplibre/maplibre-native -copyright: '[License](https://github.com/maplibre/maplibre-native/blob/main/platform/ios/LICENSE.md)' - -head: | - - -objc: Yes -skip_undocumented: Yes -hide_documentation_coverage: Yes -umbrella_header: src/Mapbox.h -framework_root: ../darwin/src - -custom_categories: - - name: Appendices - children: - - Working with GeoJSON Data - - Predicates and Expressions - - Migrating to Expressions - - For Style Authors - - Tile URL Templates - - Customizing Fonts - - Info.plist Keys - - Gesture Recognizers - - name: Maps - children: - - MLNSettings - - MLNMapCamera - - MLNMapView - - MLNMapViewDelegate - - MLNMapSnapshot - - MLNMapSnapshotOptions - - MLNMapSnapshotter - - MLNUserTrackingMode - - name: Primitive Shapes - children: - - MLNAnnotation - - MLNOverlay - - MLNShape - - MLNMultiPoint - - MLNPointAnnotation - - MLNPointCollection - - MLNPolygon - - MLNPolyline - - MLNMultiPolygon - - MLNMultiPolyline - - MLNShapeCollection - - name: Annotations - children: - - MLNAnnotationImage - - MLNAnnotationView - - MLNUserLocation - - MLNUserLocationAnnotationView - - name: User Interaction - children: - - MLNCalloutView - - MLNCalloutViewDelegate - - MLNCompassButton - - name: Location Updates - children: - - MLNLocationManager - - MLNLocationManagerDelegate - - name: Styling the Map - children: - - MLNStyle - - MLNLight - - name: Style Primitives - children: - - MLNFeature - - MLNPointFeature - - MLNPointFeatureCluster - - MLNPolygonFeature - - MLNPolylineFeature - - MLNMultiPolygonFeature - - MLNMultiPolylineFeature - - MLNPointCollectionFeature - - MLNShapeCollectionFeature - - MLNEmptyFeature - - name: Style Content - children: - - MLNSource - - MLNShapeSource - - MLNComputedShapeSource - - MLNTileSource - - MLNRasterTileSource - - MLNRasterDEMSource - - MLNVectorTileSource - - MLNImageSource - - name: Style Layers - children: - - MLNStyleLayer - - MLNForegroundStyleLayer - - MLNBackgroundStyleLayer - - MLNRasterStyleLayer - - MLNVectorStyleLayer - - MLNCircleStyleLayer - - MLNFillStyleLayer - - MLNFillExtrusionStyleLayer - - MLNHeatmapStyleLayer - - MLNHillshadeStyleLayer - - MLNLineStyleLayer - - MLNSymbolStyleLayer - - name: Offline Maps - children: - - MLNOfflineRegion - - MLNOfflineStorage - - MLNOfflinePack - - MLNOfflinePackProgress - - MLNOfflinePackState - - MLNTilePyramidOfflineRegion - - MLNShapeOfflineRegion - - name: Geometry - children: - - MLNCoordinateBounds - - MLNCoordinateBoundsEqualToCoordinateBounds - - MLNCoordinateBoundsGetCoordinateSpan - - MLNCoordinateBoundsIntersectsCoordinateBounds - - MLNCoordinateBoundsIsEmpty - - MLNCoordinateBoundsMake - - MLNCoordinateBoundsOffset - - MLNCoordinateInCoordinateBounds - - MLNCoordinateQuad - - MLNCoordinateQuadMake - - MLNCoordinateQuadFromCoordinateBounds - - MLNCoordinateSpan - - MLNCoordinateSpanEqualToCoordinateSpan - - MLNCoordinateSpanMake - - MLNCoordinateSpanZero - - MLNDegreesFromRadians - - MLNRadiansFromDegrees - - MLNStringFromCoordinateBounds - - MLNStringFromCoordinateQuad - - name: Formatters - children: - - MLNClockDirectionFormatter - - MLNCompassDirectionFormatter - - MLNCoordinateFormatter - - MLNDistanceFormatter diff --git a/platform/ios/scripts/deploy-packages.sh b/platform/ios/scripts/deploy-packages.sh deleted file mode 100644 index f318058b8..000000000 --- a/platform/ios/scripts/deploy-packages.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -# dynamic environment variables: -# VERSION_TAG={determined automatically}: Version tag in format ios-vX.X.X-pre.X -# GITHUB_RELEASE=true: Upload to github - -# environment variables and dependencies: -# - You must run "mbx auth ..." before running -# - Set GITHUB_TOKEN to a GitHub API access token in your environment to use GITHUB_RELEASE -# - The "github-release" command is required to use GITHUB_RELEASE - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -buildPackageStyle() { - local package=$1 style="" - if [[ ${#} -eq 2 ]]; then - style="$2" - fi - step "Building: make ${package} ${style}" - FORMAT=${style} make ${package} - step "Publishing ${package} with ${style}" - local file_name="" - if [ -z ${style} ] - then - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" - file_name=mapbox-ios-sdk-${PUBLISH_VERSION}.zip - else - ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" ${style} - file_name=mapbox-ios-sdk-${PUBLISH_VERSION}-${style}.zip - fi - if [[ "${GITHUB_RELEASE}" == true ]]; then - step "Uploading ${file_name} to GitHub" - github-release upload \ - --tag "ios-v${PUBLISH_VERSION}" \ - --name ${file_name} \ - --file "${BINARY_DIRECTORY}/${file_name}" > /dev/null - else - step "CREATED ${file_name} - skipping upload to Github" - fi -} - -export GITHUB_USER=maplibre -export GITHUB_REPO=maplibre-native -export BUILDTYPE=Release -export PACKAGE_FORMAT=xcframework - -VERSION_TAG=${VERSION_TAG:-''} -PUBLISH_VERSION= -BINARY_DIRECTORY='build/ios' -GITHUB_RELEASE=${GITHUB_RELEASE:-false} -BUILD_FOR_COCOAPODS=${BUILD_FOR_COCOAPODS:-false} -PUBLISH_PRE_FLAG='' - -if [[ -z `which github-release` ]]; then - step "Installing github-release…" - brew install github-release - if [ -z `which github-release` ]; then - echo "Unable to install github-release. See: https://github.com/aktau/github-release" - exit 1 - fi -fi - -if [[ ${GITHUB_RELEASE} = "true" ]]; then - GITHUB_RELEASE=true # Assign bool, not just a string -fi - -if [[ ${GITHUB_RELEASE} = "false" ]]; then - GITHUB_RELEASE=false # Assign bool, not just a string -fi - -if [[ ${BUILD_FOR_COCOAPODS} = "false" ]]; then - BUILD_FOR_COCOAPODS=false # Assign bool, not just a string -fi - -if [[ ${BUILD_FOR_COCOAPODS} = "true" ]]; then - BUILD_FOR_COCOAPODS=true # Assign bool, not just a string -fi - -if [[ -z ${VERSION_TAG} ]]; then - step "Determining version number from most recent relevant git tag…" - VERSION_TAG=$( git describe --tags --match=ios-v*.*.* --abbrev=0 ) - echo "Found tag: ${VERSION_TAG}" -fi - -if [[ $( echo ${VERSION_TAG} | grep --invert-match ios-v ) ]]; then - echo "Error: ${VERSION_TAG} is not a valid iOS version tag" - echo "VERSION_TAG should be in format: ios-vX.X.X-pre.X" - if [[ "${GITHUB_RELEASE}" == true ]]; then - exit 1 - fi -fi - -if github-release info --tag ${VERSION_TAG} | grep --quiet "draft: ✗"; then - echo "Error: ${VERSION_TAG} has already been published on GitHub" - echo "See: https://github.com/${GITHUB_USER}/${GITHUB_REPO}/releases/tag/${VERSION_TAG}" - if [[ "${GITHUB_RELEASE}" == true ]]; then - exit 1 - fi -fi - -if [[ "${GITHUB_RELEASE}" == true ]]; then - PUBLISH_VERSION=$( echo ${VERSION_TAG} | sed 's/^ios-v//' ) - git checkout ${VERSION_TAG} - step "Deploying version ${PUBLISH_VERSION}…" -else - PUBLISH_VERSION=${VERSION_TAG} - step "Building packages for version ${PUBLISH_VERSION} (Not deploying to Github)" -fi - -npm install --ignore-scripts -mkdir -p ${BINARY_DIRECTORY} - -if [[ "${GITHUB_RELEASE}" == true ]]; then - step "Create GitHub release…" - if [[ $( echo ${PUBLISH_VERSION} | awk '/[0-9]-/' ) ]]; then - PUBLISH_PRE_FLAG='--pre-release' - fi - RELEASE_NOTES=$( ./platform/ios/scripts/release-notes.js github ) - github-release release \ - --tag "ios-v${PUBLISH_VERSION}" \ - --name "ios-v${PUBLISH_VERSION}" \ - --draft ${PUBLISH_PRE_FLAG} \ - --description "${RELEASE_NOTES}" -fi - -# Used for binary release on Github - includes events SDK -buildPackageStyle "${PACKAGE_FORMAT}" "dynamic" - -echo "Binary artifact zip file: ${BINARY_ARTIFACT_ZIP_FILE}" -echo "Binary artifact url: ${BINARY_ARTIFACT_URL}" - -if [[ !-z "${BINARY_ARTIFACT_URL}" ]]; then - step "Creating Swift package…" - - rm -f Package.swift - cp swift_package_template.swift Package.swift - sed -i "s/__PACKAGE_URL__/${BINARY_ARTIFACT_URL}/g" Package.swift - CHECKSUM=$(swift package compute-checksum ${BINARY_ARTIFACT_ZIP_FILE}) - echo "Checksum: ${CHECKSUM}" - sed -i "s/__PACKAGE_CHECKSUM__/${CHECKSUM}/g" Package.swift - cat Package.swift -fi - - -if [[ ${BUILD_FOR_COCOAPODS} == true ]]; then - # Used for Cocoapods/Carthage - buildPackageStyle "${PACKAGE_FORMAT}" "dynamic" - buildPackageStyle "${PACKAGE_FORMAT} SYMBOLS=NO" "stripped-dynamic" -fi - - - - -step "Finished deploying ${PUBLISH_VERSION} in $(($SECONDS / 60)) minutes and $(($SECONDS % 60)) seconds" diff --git a/platform/ios/scripts/deploy-snapshot.sh b/platform/ios/scripts/deploy-snapshot.sh deleted file mode 100644 index d0d5d59d2..000000000 --- a/platform/ios/scripts/deploy-snapshot.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -DATE=`date +%Y-%m-%d` -PROJ_VERSION=$(git rev-list --count HEAD) -SNAPSHOT_TYPE="snapshot-dynamic" - -step "Uploading ${SNAPSHOT_TYPE} build for ${DATE}-${PROJ_VERSION} to s3…" - -./platform/ios/scripts/publish.sh "${SNAPSHOT_TYPE}" "${DATE}-${PROJ_VERSION}" - -step "Finished deploying ${SNAPSHOT_TYPE} build in $(($SECONDS / 60)) minutes and $(($SECONDS % 60)) seconds" diff --git a/platform/ios/scripts/deploy-to-cocoapods.sh b/platform/ios/scripts/deploy-to-cocoapods.sh deleted file mode 100644 index 27eb1fbab..000000000 --- a/platform/ios/scripts/deploy-to-cocoapods.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -# This relies on either: -# 1. You being authenticated locally with CocoaPods trunk. -# 2. The `COCOAPODS_TRUNK_TOKEN` environment variable being set. - -set -euo pipefail - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -CIRCLE_TAG=${CIRCLE_TAG:-""} - -step "Pushing release to CocoaPods trunk…" - -if [[ $CIRCLE_TAG ]]; then - pod trunk push platform/ios/Mapbox-iOS-SDK.podspec --allow-warnings -else - echo "Skipping push to CocoaPods trunk for untagged build" -fi - -step "Pushing release/builds to Mapbox podspecs repo…" - -if [[ -z $(pod repo list | grep -i mapbox-public) ]]; then - pod repo add mapbox-public https://github.com/mapbox/pod-specs -else - echo "Found existing mapbox-public podspecs repo" -fi - -if [[ -z $(git config --global user.email) && $CI ]]; then - echo "Setting machine user as git committer" - git config --global user.email "MapboxCI@users.noreply.github.com" -fi - -if [[ $CIRCLE_TAG ]]; then - pod repo push mapbox-public platform/ios/Mapbox-iOS-SDK.podspec --allow-warnings - pod repo push mapbox-public platform/ios/Mapbox-iOS-SDK-stripped.podspec --allow-warnings -else - echo "Skipping push of release podspecs to mapbox-public for untagged build" - - # pod repo push mapbox-public platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec --allow-warnings - echo "Skipping push of snapshot to mapbox-public until we have a way to update the versions in the snapshot podspec" -fi diff --git a/platform/ios/scripts/document.sh b/platform/ios/scripts/document.sh deleted file mode 100644 index 726f7f06f..000000000 --- a/platform/ios/scripts/document.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -source ~/.bashrc - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -if [ -z `which jazzy` ]; then - echo "jazzy not installed" >&2 - exit 1 -fi - -DEFAULT_THEME="platform/darwin/docs/theme" -THEME=${JAZZY_THEME:-$DEFAULT_THEME} -CUSTOM_HEAD=${JAZZY_CUSTOM_HEAD:-''} -OUTPUT=${OUTPUT:-documentation} - -BRANCH=$( git describe --tags --match=ios-v*.*.* --abbrev=0 ) -SHORT_VERSION=$( echo ${BRANCH} | sed 's/^ios-v//' ) -RELEASE_VERSION=$( echo ${SHORT_VERSION} | sed -e 's/^ios-v//' -e 's/-.*//' ) - -rm -rf /tmp/mbgl -mkdir -p /tmp/mbgl/ - -step "Generating readme and release notes" -README=/tmp/mbgl/README.md -npm install --ignore-scripts -node platform/ios/scripts/release-notes.js jazzy >> "${README}" - -rm -rf ${OUTPUT} -mkdir -p ${OUTPUT} - -cp -r platform/darwin/docs/img "${OUTPUT}" -cp -r platform/ios/docs/img "${OUTPUT}" - -step "Generating jazzy docs for ${SHORT_VERSION}…" - -jazzy \ - --config platform/ios/jazzy.yml \ - --sdk iphonesimulator \ - --github-file-prefix https://github.com/mapbox/mapbox-gl-native-ios/tree/${BRANCH} \ - --module-version ${SHORT_VERSION} \ - --readme ${README} \ - --documentation="platform/{darwin,ios}/docs/guides/*.md" \ - --root-url https://maplibre.org/maplibre-native/ios/api/ \ - --theme ${THEME} \ - --head "${CUSTOM_HEAD}" \ - --output ${OUTPUT} \ - --title "MapLibre Native for iOS" \ - --module-version ${SHORT_VERSION} diff --git a/platform/ios/scripts/ios-code-coverage.sh b/platform/ios/scripts/ios-code-coverage.sh deleted file mode 100644 index 8b8adb423..000000000 --- a/platform/ios/scripts/ios-code-coverage.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -# -# Get code coverage report, then convert it to JSON. -# The coverage reports end up in different locations based on whether coverage -# is generated via CI or locally. -# -cov_result=""; -if [ -f build/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport ]; then - cov_result=build/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport -elif [ -f build/ios/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport ]; then - cov_result=build/ios/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport -else - echo "Coverage file does not exist. Please run tests before executing" - exit 1 -fi - -xcrun xccov view $cov_result --json > output.json - -# -# Convert the line coverage for the dynamic target to a percentage. Currently, -# only CI tests are included when calculated code coverage. -# -percentage=`node -e "console.log(require('./output.json').lineCoverage)"` -cov=$(printf "%.2f" $(echo "$percentage*100" | bc -l)) - -# Generate a formatted JSON file and upload it to S3. -./././scripts/code-coverage.sh $cov "iOS" "$1" diff --git a/platform/ios/scripts/lint-plists.sh b/platform/ios/scripts/lint-plists.sh deleted file mode 100755 index b438e4de2..000000000 --- a/platform/ios/scripts/lint-plists.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -echo Linting... - -plutil -lint platform/ios/app/Info.plist -plutil -lint platform/ios/bench_UITests/Info.plist -plutil -lint platform/ios/benchmark/Info.plist -plutil -lint platform/ios/framework/Info.plist -plutil -lint platform/ios/framework/Info-static.plist -plutil -lint platform/ios/Integration_Test_Harness/Info.plist -plutil -lint platform/ios/Integration_Tests/Info.plist -plutil -lint platform/ios/iosapp-UITests/Info.plist -plutil -lint platform/ios/test/Info.plist diff --git a/platform/ios/scripts/lint-podspecs.js b/platform/ios/scripts/lint-podspecs.js deleted file mode 100644 index 1381acacf..000000000 --- a/platform/ios/scripts/lint-podspecs.js +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs'); -const execSync = require('child_process').execSync; -const _ = require('lodash'); -const semver = require('semver'); - -console.step = _.partial(console.log, '\n\033[1m\033[36m*', _, '\033[0m'); -process.exitCode = 0; - -const podspecsPath = 'platform/ios'; - -/* - Step 1. Run the official CocoaPods linter against all of our podspecs. -*/ -console.step(`Running CocoaPods linter against podspecs in '${podspecsPath}'`) -execSync(`pod spec lint ${podspecsPath}/*.podspec --quick`, {stdio: 'inherit'}); - -/* - Step 2. Check that our podspecs contain properly formatted version strings. -*/ -console.step('Checking Mapbox SDK version strings in podspecs') -const podspecs = fs.readdirSync(podspecsPath).filter(fn => fn.endsWith('.podspec')); - -let matchedVersions = []; - -for (const podspecFilename of podspecs) { - console.log(podspecFilename); - const podspecContents = fs.readFileSync(`${podspecsPath}/${podspecFilename}`, 'utf8'); - - /* - This regular expression: - - Matches single lines in the format: version = '9.9.9' - - Groups the version number inside the single quotes. - - Ignores whitespace at the start of the line and between parts of the definition using: \s*? - */ - const regex = /^\s*?version\s*?=\s*?'(.*)'$/gmi; - - const match = regex.exec(podspecContents); - if (!match) { - console.error(' ❌ No version string found'); - process.exitCode = 1; - continue; - } - - const matchedVersion = match[1]; - matchedVersions.push(matchedVersion); - - if (!semver.valid(matchedVersion)) { - console.error(` ❌ ${matchedVersion} is not a valid semantic version`); - process.exitCode = 1; - continue; - } - - console.log(` ✅ ${matchedVersion} is a valid semantic version`); -} - -/* - Step 3. Check that versions are consistent across our podspecs. -*/ -console.step('Checking version consistency') -const uniqueVersions = _.uniq(matchedVersions); -if (uniqueVersions.length != 1) { - console.error('❌ Versions in podspecs do not match:', uniqueVersions); - process.exitCode = 1; -} else { - console.log(`✅ ${uniqueVersions[0]} is set in all podspecs`); -} - -/* - Step 4. Finish up and summarize the results. -*/ -process.on('exit', (code) => { - if (code == 0) { - console.log('\nPodspec linting completed successfully! 🕵️‍♀️'); - } else { - console.log('\nPodspec linting failed. 💥'); - } -}); diff --git a/platform/ios/scripts/metrics.sh b/platform/ios/scripts/metrics.sh deleted file mode 100644 index 38a4d7c5d..000000000 --- a/platform/ios/scripts/metrics.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -# Generate stripped versions for every architecture -xcrun bitcode_strip build/ios/pkg/dynamic/Mapbox.framework/Mapbox -r -o build/ios/pkg/dynamic/Mapbox-stripped -strip -Sx build/ios/pkg/dynamic/Mapbox-stripped -lipo build/ios/pkg/dynamic/Mapbox-stripped -extract armv7 -output build/ios/pkg/dynamic/Mapbox-stripped-armv7 -lipo build/ios/pkg/dynamic/Mapbox-stripped -extract arm64 -output build/ios/pkg/dynamic/Mapbox-stripped-arm64 -lipo build/ios/pkg/dynamic/Mapbox-stripped -extract x86_64 -output build/ios/pkg/dynamic/Mapbox-stripped-x86_64 - -# Track individual architectures -scripts/check_binary_size.js "build/ios/pkg/dynamic/Mapbox-stripped-armv7" "iOS armv7" -scripts/check_binary_size.js "build/ios/pkg/dynamic/Mapbox-stripped-arm64" "iOS arm64" -scripts/check_binary_size.js "build/ios/pkg/dynamic/Mapbox-stripped-x86_64" "iOS x86_64" - -# Track overall library size -scripts/check_binary_size.js "build/ios/pkg/dynamic/Mapbox-stripped" "iOS Dynamic" - -if [[ $CIRCLE_BRANCH == main ]]; then - # Build source data for http://mapbox.github.io/mapbox-gl-native/metrics/binary-size/ - # and log binary sizes to metrics warehouse - scripts/publish_binary_size.js -fi - diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh deleted file mode 100644 index fed5ea0b7..000000000 --- a/platform/ios/scripts/package.sh +++ /dev/null @@ -1,275 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -NAME=Mapbox -OUTPUT=build/ios/pkg -DERIVED_DATA=build/ios -PRODUCTS=${DERIVED_DATA} -LOG_PATH=build/xcodebuild-$(date +"%Y-%m-%d_%H%M%S").log - -BUILD_FOR_DEVICE=${BUILD_DEVICE:-true} -BUILD_DOCS=${BUILD_DOCS:-true} -SYMBOLS=${SYMBOLS:-YES} - -BUILDTYPE=${BUILDTYPE:-Debug} -if [[ ${SYMBOLS} == YES && ${BUILDTYPE} == Release ]]; then - BUILDTYPE='RelWithDebInfo' -fi - -FORMAT=${FORMAT:-dynamic} -BUILD_DYNAMIC=true -BUILD_STATIC=false -INCLUDE_EVENTS_IN_PACKAGE=false -if [[ ${FORMAT} == "static" ]]; then - BUILD_STATIC=true - BUILD_DYNAMIC=false -elif [[ ${FORMAT} == "dynamic-with-events" ]]; then - INCLUDE_EVENTS_IN_PACKAGE=true -elif [[ ${FORMAT} == "stripped-dynamic" ]]; then - echo "Packaging for stripped-dynamic" -elif [[ ${FORMAT} != "dynamic" ]]; then - echo "Error: FORMAT must be dynamic or static." - exit 1 -fi - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -SDK=iphonesimulator -if [[ ${BUILD_FOR_DEVICE} == true ]]; then - SDK=iphoneos -fi -IOS_SDK_VERSION=`xcrun --sdk ${SDK} --show-sdk-version` - -step "Configuring ${FORMAT} framework for ${SDK} ${IOS_SDK_VERSION} (symbols: ${SYMBOLS}, buildtype: ${BUILDTYPE}, include events:${INCLUDE_EVENTS_IN_PACKAGE})" - -xcodebuild -version - -rm -rf ${OUTPUT} -if [[ ${BUILD_STATIC} == true ]]; then - mkdir -p "${OUTPUT}"/static -fi -if [[ ${BUILD_DYNAMIC} == true ]]; then - mkdir -p "${OUTPUT}"/dynamic -fi - -step "Recording library version…" -VERSION="${OUTPUT}"/version.txt -echo -n "https://github.com/maplibre/maplibre-native/commit/" > ${VERSION} -HASH=`git log | head -1 | awk '{ print $2 }' | cut -c 1-10` && true -echo -n "maplibre-gl-native-ios " -echo ${HASH} -echo ${HASH} >> ${VERSION} - -PROJ_VERSION=$(git rev-list --count HEAD) -SEM_VERSION=$( git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//' ) -SHORT_VERSION=${SEM_VERSION%-*} - -step "Building targets (build ${PROJ_VERSION}, version ${SEM_VERSION})" - -SCHEME='dynamic' -if [[ ${BUILD_STATIC} == true ]]; then - SCHEME='static' -fi - -CI_XCCONFIG='' -if [[ ! -z "${CI:=}" ]]; then - xcconfig='platform/darwin/ci.xcconfig' - echo "CI environment, using ${xcconfig}" - CI_XCCONFIG="-xcconfig ./${xcconfig}" -fi - -step "Building ${FORMAT} framework for iOS Simulator using ${SCHEME} scheme" -xcodebuild \ - CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \ - CURRENT_COMMIT_HASH=${HASH} \ - ONLY_ACTIVE_ARCH=NO \ - ${CI_XCCONFIG} \ - -derivedDataPath ${DERIVED_DATA} \ - -workspace ./platform/ios/ios.xcworkspace \ - -scheme ${SCHEME} \ - -configuration ${BUILDTYPE} \ - -sdk iphonesimulator \ - -jobs ${JOBS} | tee ${LOG_PATH} | xcpretty - -if [[ ${BUILD_FOR_DEVICE} == true ]]; then - step "Building ${FORMAT} framework for iOS devices using ${SCHEME} scheme" - xcodebuild \ - CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \ - CURRENT_COMMIT_HASH=${HASH} \ - ONLY_ACTIVE_ARCH=NO \ - ${CI_XCCONFIG} \ - -derivedDataPath ${DERIVED_DATA} \ - -workspace ./platform/ios/ios.xcworkspace \ - -scheme ${SCHEME} \ - -configuration ${BUILDTYPE} \ - -sdk iphoneos \ - -jobs ${JOBS} | tee ${LOG_PATH} | xcpretty -fi - -LIBS=(Mapbox.a) - - -function copyAndMakeFatFramework { - local NAME=$1 - - step "Copying ${NAME} dynamic framework into place for iOS devices" - cp -r \ - ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework \ - ${OUTPUT}/dynamic/ - - if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM ]]; then - step "Copying ${NAME} dSYM" - cp -r ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM \ - ${OUTPUT}/dynamic/ - if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM ]]; then - step "Merging device and simulator dSYMs…" - lipo \ - ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} \ - ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} \ - -create -output ${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} - lipo -info ${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} - fi - fi - - step "Merging ${NAME} simulator dynamic library into device dynamic library…" - lipo \ - ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework/${NAME} \ - ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework/${NAME} \ - -create -output ${OUTPUT}/dynamic/${NAME}.framework/${NAME} | echo -} - - -# https://medium.com/@syshen/create-an-ios-universal-framework-148eb130a46c -if [[ ${BUILD_FOR_DEVICE} == true ]]; then - if [[ ${BUILD_STATIC} == true ]]; then - step "Assembling static framework for iOS Simulator and devices…" - mkdir -p ${OUTPUT}/static/${NAME}.framework - libtool -static -no_warning_for_no_symbols \ - -o ${OUTPUT}/static/${NAME}.framework/${NAME} \ - ${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphoneos/lib} \ - ${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \ - `cmake -LA -N ${DERIVED_DATA} | grep MASON_PACKAGE_icu_LIBRARIES | cut -d= -f2` - - cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.bundle ${OUTPUT}/static - fi - - if [[ ${BUILD_DYNAMIC} == true ]]; then - copyAndMakeFatFramework "${NAME}" - - if [[ ${INCLUDE_EVENTS_IN_PACKAGE} == true ]]; then - copyAndMakeFatFramework "MapboxMobileEvents" - fi - - # Bundling mapbox-events-ios - fi - - cp -rv platform/ios/app/Settings.bundle ${OUTPUT} -else - if [[ ${BUILD_STATIC} == true ]]; then - step "Assembling static library for iOS Simulator…" - mkdir -p ${OUTPUT}/static/${NAME}.framework - libtool -static -no_warning_for_no_symbols \ - -o ${OUTPUT}/static/${NAME}.framework/${NAME} \ - ${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \ - `cmake -LA -N ${DERIVED_DATA} | grep MASON_PACKAGE_icu_LIBRARIES | cut -d= -f2` - - cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.bundle ${OUTPUT}/static - fi - - if [[ ${BUILD_DYNAMIC} == true ]]; then - step "Copying dynamic framework into place for iOS Simulator…" - cp -r \ - ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework \ - ${OUTPUT}/dynamic/${NAME}.framework - if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM ]]; then - step "Copying dSYM" - cp -r ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM \ - ${OUTPUT}/dynamic/ - fi - fi - - cp -rv platform/ios/app/Settings.bundle ${OUTPUT} -fi - -function get_comparable_uuid { - echo $(dwarfdump --uuid ${1} | sed -n 's/.*UUID:\([^\"]*\) .*/\1/p' | sort) -} - -function validate_dsym { - step "Validating dSYM and framework UUIDs…" - DSYM_UUID=$(get_comparable_uuid "${1}") - FRAMEWORK_UUID=$(get_comparable_uuid "${2}") - echo -e "${1}\n ${DSYM_UUID}\n${2}\n ${FRAMEWORK_UUID}" - if [[ ${DSYM_UUID} != ${FRAMEWORK_UUID} ]]; then - echo "Error: dSYM and framework UUIDs do not match." - exit 1 - fi -} - -function removeSimulatorSlice { - local NAME=$1 - - validate_dsym \ - "${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}" \ - "${OUTPUT}/dynamic/${NAME}.framework/${NAME}" - - step "Removing i386 slice from ${NAME} dSYM" - lipo -remove i386 "${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}" -o "${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}" - lipo -info "${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}" -} - - -if [[ ${BUILD_DYNAMIC} == true && ${BUILDTYPE} == Release ]]; then - removeSimulatorSlice "${NAME}" - - if [[ ${INCLUDE_EVENTS_IN_PACKAGE} == true ]]; then - removeSimulatorSlice MapboxMobileEvents - fi -fi - -if [[ ${BUILD_STATIC} == true ]]; then - step "Copying static library headers…" - cp -rv "${PRODUCTS}/${BUILDTYPE}-${SDK}/Headers" "${OUTPUT}/static/${NAME}.framework/Headers" - cat platform/ios/framework/Mapbox-static.h > "${OUTPUT}/static/${NAME}.framework/Headers/Mapbox.h" - cat "${PRODUCTS}/${BUILDTYPE}-${SDK}/Headers/Mapbox.h" >> "${OUTPUT}/static/${NAME}.framework/Headers/Mapbox.h" -fi - -step "Copying library resources…" -cp -pv LICENSE.md ${OUTPUT} -if [[ ${BUILD_STATIC} == true ]]; then - cp -pv "${OUTPUT}/static/${NAME}.bundle/Info.plist" "${OUTPUT}/static/${NAME}.framework/Info.plist" - plutil -replace CFBundlePackageType -string FMWK "${OUTPUT}/static/${NAME}.framework/Info.plist" - mkdir "${OUTPUT}/static/${NAME}.framework/Modules" - cp -pv platform/ios/framework/modulemap "${OUTPUT}/static/${NAME}.framework/Modules/module.modulemap" -fi -if [[ ${BUILD_DYNAMIC} == true && ${BUILD_FOR_DEVICE} == true ]]; then - step "Copying bitcode symbol maps…" - find "${PRODUCTS}/${BUILDTYPE}-iphoneos" -name '*.bcsymbolmap' -type f -exec cp -pv {} "${OUTPUT}/dynamic/" \; -fi -sed -n -e '/^## /,$p' platform/ios/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md" - -rm -rf /tmp/mbgl -mkdir -p /tmp/mbgl/ -README=/tmp/mbgl/README.md -cp platform/ios/docs/pod-README.md "${README}" -if [[ ${BUILD_DYNAMIC} == false ]]; then - sed -i '' -e '/{{DYNAMIC}}/,/{{\/DYNAMIC}}/d' "${README}" -fi -if [[ ${BUILD_STATIC} == false ]]; then - sed -i '' -e '/{{STATIC}}/,/{{\/STATIC}}/d' "${README}" -fi -sed -i '' \ - -e '/{{DYNAMIC}}/d' -e '/{{\/DYNAMIC}}/d' \ - -e '/{{STATIC}}/d' -e '/{{\/STATIC}}/d' \ - "${README}" -cp ${README} "${OUTPUT}" - -if [ ${BUILD_DOCS} == true ]; then - step "Generating API documentation for ${BUILDTYPE} Build…" - make idocument OUTPUT="${OUTPUT}/documentation" -fi diff --git a/platform/ios/scripts/publish.sh b/platform/ios/scripts/publish.sh deleted file mode 100644 index d8b5840dc..000000000 --- a/platform/ios/scripts/publish.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -# -# iOS release tag format is `vX.Y.Z`; `X.Y.Z` gets passed in -# In the case of stripped builds, we also append the `-stripped`. -# -PUBLISH_VERSION="$1" - -if [[ ${#} -eq 2 ]]; then - PUBLISH_STYLE="-$2" -else - PUBLISH_STYLE="" -fi - -GITHUB_REPO=${GITHUB_REPO:-'maplibre-native'} - -# -# zip -# -cd build/ios/pkg -BINARY_ARTIFACT_ZIP_FILE="mapbox-ios-sdk-${PUBLISH_VERSION}${PUBLISH_STYLE}.zip" -step "Compressing ${BINARY_ARTIFACT_ZIP_FILE}…" -rm -f ../${BINARY_ARTIFACT_ZIP_FILE} -zip -yr ../${BINARY_ARTIFACT_ZIP_FILE} * -cd .. - -# -# report file sizes -# -step "Echoing file sizes…" -du -sh ${BINARY_ARTIFACT_ZIP_FILE} -du -sch pkg/* -du -sch pkg/dynamic/* - -# -# upload -# -DRYRUN="" -if [[ ${SKIP_S3-} ]]; then - DRYRUN="--dryrun" -fi - -PROGRESS="" -if [ -n "${CI:-}" ]; then - PROGRESS="--no-progress" -fi - -step "Uploading ${BINARY_ARTIFACT_ZIP_FILE} to s3… ${DRYRUN}" - -aws s3 cp ${BINARY_ARTIFACT_ZIP_FILE} s3://mapbox-gl-native/ios/builds --acl public-read ${PROGRESS} ${DRYRUN} -BINARY_ARTIFACT_URL=https://mapbox-gl-native.s3.us-east-2.amazonaws.com/ios/builds/${BINARY_ARTIFACT_ZIP_FILE} -export BINARY_ARTIFACT_URL -export BINARY_ARTIFACT_ZIP_FILE -echo "URL: ${BINARY_ARTIFACT_URL}" -echo "mapbox-gl-native is currently hardcoded" - -# -# upload & update snapshot -# -if [[ ${PUBLISH_VERSION} =~ "snapshot" ]]; then - step "Updating ${PUBLISH_VERSION} to ${PUBLISH_STYLE}…" - GENERIC_BINARY_ARTIFACT_ZIP_FILE="mapbox-ios-sdk-${PUBLISH_VERSION}.zip" - aws s3 cp \ - s3://mapbox-gl-native/ios/builds/${BINARY_ARTIFACT_ZIP_FILE} \ - s3://mapbox-gl-native/ios/builds/${GENERIC_BINARY_ARTIFACT_ZIP_FILE} --acl public-read ${PROGRESS} ${DRYRUN} -fi - -# -# verify upload integrity -# - -step "Validating local and remote checksums…" - -if [[ ! ${SKIP_S3-} ]]; then - curl --output remote-${BINARY_ARTIFACT_ZIP_FILE} ${BINARY_ARTIFACT_URL} - LOCAL_CHECKSUM=$( shasum -a 256 -b ${BINARY_ARTIFACT_ZIP_FILE} | cut -d ' ' -f 1 ) - REMOTE_CHECKSUM=$( shasum -a 256 -b remote-${BINARY_ARTIFACT_ZIP_FILE} | cut -d ' ' -f 1 ) - - if [ "${LOCAL_CHECKSUM}" == "${REMOTE_CHECKSUM}" ]; then - echo "Checksums match: ${LOCAL_CHECKSUM}" - else - echo "Checksums did not match: ${LOCAL_CHECKSUM} != ${REMOTE_CHECKSUM}" - exit 1 - fi -fi diff --git a/platform/ios/scripts/release-notes-github.md.ejs b/platform/ios/scripts/release-notes-github.md.ejs deleted file mode 100644 index d0affd8d5..000000000 --- a/platform/ios/scripts/release-notes-github.md.ejs +++ /dev/null @@ -1,2 +0,0 @@ -<%-CHANGELOG-%> - diff --git a/platform/ios/scripts/release-notes-jazzy.md.ejs b/platform/ios/scripts/release-notes-jazzy.md.ejs deleted file mode 100644 index ca647b8dc..000000000 --- a/platform/ios/scripts/release-notes-jazzy.md.ejs +++ /dev/null @@ -1,21 +0,0 @@ -# MapLibre Native for iOS - -MapLibre Native for iOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 9.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [MapLibre Style Specification](https://maplibre.org/maplibre-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://docs.mapbox.com/data/tilesets/guides/vector-tiles-standards/), and renders them using OpenGL. - -![MapLibre Native for iOS screenshots](img/screenshot.png) - -We welcome your [bug reports, feature requests, and contributions](https://github.com/maplibre/maplibre-native/issues). - -## Changes in version <%-CURRENTVERSION%> - -<%-CURRENTCHANGELOG%> - -## Recent changes - -<% OTHERRELEASES.forEach(function(release) { %> -### <%-release.version%> - -<%-release.changelog%> -<% }) -%> - -See the [full changelog](https://github.com/maplibre/maplibre-native/blob/main/platform/ios/platform/ios/CHANGELOG.md) for previous releases. diff --git a/platform/ios/scripts/release-notes.js b/platform/ios/scripts/release-notes.js deleted file mode 100644 index 69ba4dcfa..000000000 --- a/platform/ios/scripts/release-notes.js +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs'); -const execSync = require('child_process').execSync; -const ejs = require('ejs'); -const _ = require('lodash'); -const semver = require('semver'); - -const changelogPath = 'platform/ios/CHANGELOG.md'; -const changelog = fs.readFileSync(changelogPath, 'utf8'); - -let outputMode = {}; -switch(process.argv[2]) { - case "jazzy": - outputMode.isJazzy = true; break; - case "github": - default: - outputMode.isGitHub = true; -} - -/* - Find current and immediately previous releases by parsing git tags. -*/ -let currentVersion = execSync('git describe --tags --match=ios-v*.*.* --abbrev=0') - .toString() - .trim() - .replace('ios-v', ''); - -let gitTags = execSync('git tag --list ios-v*.*.*') - .toString() - .split('\n') - .map(function (tag) { - tag = tag.replace('ios-v', '').trim(); - return semver.clean(tag); - }); -let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion); - -/* - Parse the raw changelog text and split it into individual releases. - - This regular expression: - - Matches lines starting with "## x.x.x". - - Groups the version number. - - Skips the (optional) release date. - - Groups the changelog content. - - Ends when another "## x.x.x" is found. -*/ -const regex = /^## (\d+\.\d+\.\d+).*?\n(.+?)(?=\n^## \d+\.\d+\.\d+.*?\n)/gms; - -let releaseNotes = []; -while (match = regex.exec(changelog)) { - releaseNotes.push({ - 'version': match[1], - 'changelog': match[2].trim(), - }); -} - -/* - Match the current tag with the most appropriate release notes. -*/ -const versionsInReleaseNotes = _.map(releaseNotes, 'version'); -const bestReleaseNotesForCurrentVersion = semver.minSatisfying(versionsInReleaseNotes, ">=" + currentVersion); -const currentReleaseNotes = _.find(releaseNotes, { version: bestReleaseNotesForCurrentVersion }); - -if (!currentReleaseNotes) { - console.error('Could not find a release section satisfying %s in %s — did you forget to rename the "main" section to %s?', currentVersion, changelogPath, currentVersion.split("-")[0]); - process.exit(1); -} - -/* - Fill and print the release notes template. -*/ -let templatedReleaseNotes; - -if (outputMode.isGitHub) { - templatedReleaseNotes = ejs.render(fs.readFileSync('platform/ios/scripts/release-notes-github.md.ejs', 'utf8'), { - 'CURRENTVERSION': currentVersion, - 'PREVIOUSVERSION': previousVersion, - 'CHANGELOG': currentReleaseNotes.changelog, - 'isPrerelease': semver.prerelease(currentVersion) - }); -} - -if (outputMode.isJazzy) { - const minorReleaseSeries = semver.major(currentVersion) + "." + semver.minor(currentVersion) + ".0"; - const range = ">=" + minorReleaseSeries + " <" + currentVersion; - const otherReleasesInSeries = _.filter(releaseNotes, function(release) { - return semver.satisfies(release.version, range); - }); - - otherReleasesInSeries.forEach(function(release) { - // Bump section headings from h3 to h4. - release.changelog = release.changelog.replace(/^### /gm, '#### '); - }); - - templatedReleaseNotes = ejs.render(fs.readFileSync('platform/ios/scripts/release-notes-jazzy.md.ejs', 'utf8'), { - 'CURRENTVERSION': currentVersion, - 'CURRENTCHANGELOG': currentReleaseNotes.changelog, - 'OTHERRELEASES': otherReleasesInSeries - }); -} - -process.stdout.write(templatedReleaseNotes); diff --git a/platform/ios/scripts/size-check.sh b/platform/ios/scripts/size-check.sh deleted file mode 100755 index 13e4cbf33..000000000 --- a/platform/ios/scripts/size-check.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash - -if [ $# -eq 0 ]; then - echo "Give development team as argument, eg. '484D8S5C7M'" - exit 1 -fi - -RED=$'\033[1;31m' -GREEN=$'\033[1;32m' -BOLD=$'\033[1m' -NORMAL=$'\033[0m' - -# The development team for signing the archive is taken as argument -DEVELOPMENT_TEAM=$1 - -# The configuration for the build -BUILD_CONFIGURATIONS=("Release" "MinSizeRel") - -# Initial lib size in bytes -INITIAL_LIB_SIZES=(5504352 4249952) - -# The path to the Xcode workspace -XCODE_WORKSPACE_PATH=platform/ios/ios.xcworkspace - -# The scheme name for the build -SCHEME_NAME="iosapp" - -# The archive filename -ARCHIVE_NAME="${SCHEME_NAME}.xcarchive" - -if [[ ! -d $XCODE_WORKSPACE_PATH ]]; then - echo "${RED}iOS workspace not found: $XCODE_WORKSPACE_PATH${NORMAL}" - exit 2 -fi - -# Clean up any old builds -make clean -if [ ! $? -eq 0 ]; then - echo "${RED}Failed cleaning up the build folder${NORMAL}" - exit 3 -fi - -# Set up the Xcode workspace -make iproj CI=1 -if [ ! $? -eq 0 ]; then - echo "${RED}Failed setting up the Xcode workspace${NORMAL}" - exit 4 -fi - -TOTAL_TESTS=${#BUILD_CONFIGURATIONS[@]} -PASSED_TESTS=0 -FAILED_TESTS=0 - -for ((i=0; i<${TOTAL_TESTS}; i++)); do - BUILD_CONFIGURATION=${BUILD_CONFIGURATIONS[i]} - INITIAL_LIB_SIZE=${INITIAL_LIB_SIZES[i]} - - echo -e "\n** ${BOLD}Building size test $((i+1)) on configuration: ${BUILD_CONFIGURATION}, initial size was ${INITIAL_LIB_SIZE} bytes${NORMAL} **\n" - - # The output directory for the archive - OUTPUT_DIR="build/ios/archive/${BUILD_CONFIGURATION}" - - # Build the app - xcodebuild archive -quiet -workspace "${XCODE_WORKSPACE_PATH}" -scheme "${SCHEME_NAME}" -configuration "${BUILD_CONFIGURATION}" -archivePath "${OUTPUT_DIR}/${ARCHIVE_NAME}" DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}" - if [ ! $? -eq 0 ]; then - echo "${RED}Failed to compile the scheme: ${SCHEME_NAME}${NORMAL}" - exit 5 - fi - - # The path to the maplibre dynamic lib - LIB_PATH="${OUTPUT_DIR}/${ARCHIVE_NAME}/Products/Applications/MapLibre Native.app/Frameworks/Mapbox.framework/Mapbox" - if [[ ! -f "$LIB_PATH" ]]; then - echo "${RED}MapLibre dynamic lib not found: $LIB_PATH${NORMAL}" - exit 6 - fi - - # Current lib size in bytes - CURRENT_LIB_SIZE=$(wc -c "${LIB_PATH}" | awk '{print $1}') - if [ -z $CURRENT_LIB_SIZE ]; then - echo "${RED}Failed to compute the size of MapLibre: ${LIB_PATH}${NORMAL}" - exit 7 - fi - - if (($CURRENT_LIB_SIZE > $INITIAL_LIB_SIZE)); then - FAILED_TESTS=$((FAILED_TESTS+1)) - echo -e "${RED}\n[FAILED] MapLibre size is ${CURRENT_LIB_SIZE} bytes. This is larger than the initial size of ${INITIAL_LIB_SIZE} bytes.\n${NORMAL}" - else - PASSED_TESTS=$((PASSED_TESTS+1)) - if (($CURRENT_LIB_SIZE == $INITIAL_LIB_SIZE)); then - echo -e "${GREEN}\n[PASSED] MapLibre size is ${CURRENT_LIB_SIZE} bytes. This is equal with the initial size of ${INITIAL_LIB_SIZE} bytes.\n${NORMAL}" - else - echo -e "${GREEN}\n[PASSED] MapLibre size is ${CURRENT_LIB_SIZE} bytes. This is smaller than the initial size of ${INITIAL_LIB_SIZE} bytes.\n${NORMAL}" - fi - fi -done - -echo -e "${GREEN}PASSED TESTS: ${PASSED_TESTS} of ${TOTAL_TESTS}${NORMAL}" -echo -e "${RED}FAILED TESTS: ${FAILED_TESTS} of ${TOTAL_TESTS}${NORMAL}" \ No newline at end of file diff --git a/platform/ios/scripts/update-swift-package.sh b/platform/ios/scripts/update-swift-package.sh deleted file mode 100644 index 840c77af8..000000000 --- a/platform/ios/scripts/update-swift-package.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -# USE THIS SCRIPT ONLY FOR MANUAL UPDATE -# IN CASE AUTOPMATED DEPLOY FAILS - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -step "Creating Swift package…" - -rm -f Package.swift -cp platform/ios/scripts/swift_package_template.swift Package.swift - -export GITHUB_USER=maplibre -export GITHUB_REPO=maplibre-native -export BUILDTYPE=Release -export DISTRIBUTION_GITHUB_REPO=https://api.github.com/repos/maplibre/maplibre-gl-native-distribution - -VERSION_TAG="ios-v5.11.0" -PUBLISH_VERSION="5.11.0" -BINARY_DIRECTORY='/Volumes/Data/Temp/maplibre' -PUBLISH_PRE_FLAG='' -S3_DISTRIBUTION=false -MAPBOX_ZIP_FILE_URL="https://github.com/maplibre/maplibre-native/releases/download/ios-v5.11.0/Mapbox-5.11.0.zip" -MAPBOX_ZIP_FILE="Mapbox-5.11.0.zip" -DIST_GITHUB_TOKEN="PUT YOUR TOKEN HERE:" - -setTarget() { - local token=$1 - local targetBinaryPath=$2 - local targetUrl=$3 - local checksum=$(swift package compute-checksum ${targetBinaryPath}) - - echo "token=[${token}]" - echo "url=[$targetUrl]" - echo "cheksum=[$checksum]" - - sed -i '' -e 's|'"${token}_PACKAGE_URL"'|'"${targetUrl}"'|g' Package.swift - sed -i '' -e 's|'"${token}_PACKAGE_CHECKSUM"'|'"${checksum}"'|g' Package.swift -} - -setTarget "MAPBOX" "${BINARY_DIRECTORY}/${MAPBOX_ZIP_FILE}" "${MAPBOX_ZIP_FILE_URL}" - -step "Publishing Swift package…" - -if [[ -z "${DIST_GITHUB_TOKEN}" ]]; then - echo "DIST_GITHUB_TOKEN is not set" - exit 1 -fi - -UPDATED_PACKAGE_CONTENT=$(cat Package.swift | base64) -ORIGINAL_FILE_SHA="$(curl -H "Authorization: token ${DIST_GITHUB_TOKEN}" ${DISTRIBUTION_GITHUB_REPO}/contents/Package.swift | jq -r -c '.sha')" -PAYLOAD="{\"message\": \"New release: ${PUBLISH_VERSION}\",\"content\": \"$UPDATED_PACKAGE_CONTENT\", \"sha\": \"$ORIGINAL_FILE_SHA\"}" - -# package definition update -curl -v -X PUT \ - -H "Authorization: token ${DIST_GITHUB_TOKEN}" \ - "${DISTRIBUTION_GITHUB_REPO}"/contents/Package.swift \ - -d "${PAYLOAD}" - -# setting up new tag -curl -v -X POST \ - -H "Authorization: token ${DIST_GITHUB_TOKEN}" \ - -H "Accept: application/vnd.github.v3+json" \ - "${DISTRIBUTION_GITHUB_REPO}"/releases \ - -d "{\"tag_name\":\"${PUBLISH_VERSION}\"}" \ No newline at end of file diff --git a/platform/ios/scripts/update-version.sh b/platform/ios/scripts/update-version.sh deleted file mode 100644 index 8927d23cf..000000000 --- a/platform/ios/scripts/update-version.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -if [ $# -eq 0 ]; then - echo "Usage: v" - exit 1 -fi - -SEM_VERSION=$1 -SEM_VERSION=${SEM_VERSION/#macos-} -SEM_VERSION=${SEM_VERSION/#v} -SHORT_VERSION=${SEM_VERSION%-*} - -step "Version ${SEM_VERSION}" - -cd platform/ios/ - -step "Updating Xcode targets to version ${SHORT_VERSION}…" - -xcrun agvtool bump -all -xcrun agvtool new-marketing-version "${SHORT_VERSION}" - -step "Updating CocoaPods podspecs to version ${SEM_VERSION}…" - -find . -type f -name '*.podspec' -exec sed -i '' "s/^ *version *=.*$/ version = '${SEM_VERSION}'/" {} + diff --git a/platform/ios/scripts/validate-framework-zip.sh b/platform/ios/scripts/validate-framework-zip.sh deleted file mode 100644 index 0bcd094b6..000000000 --- a/platform/ios/scripts/validate-framework-zip.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env bash -# Created by Cory Dolphin on 03/21/16. -# Copyright (c) 2016 Twitter. All rights reserved. - -# Verifies a zip archive submission of SDKs passes basic static checks for format and contents. -# This test is likely to generate false positives, e.g. even if your SDK passes this, you still must -# test integration of your code fully. - -# Usage: $ ./validate_zip.sh - -set -e - -if [ ! -f "$1" ]; then - printf "No file found at ${1}\n" - printf "Usage: $ ./validate_zip.sh \n"; exit 1; -fi - -function verifyFramework() { - # set -x - local FRAMEWORK_PATH=$1 - local FRAMEWORK_NAME=$(basename $FRAMEWORK_PATH) - local PRODUCT="${FRAMEWORK_NAME%.*}" - local BINARY_PATH="${FRAMEWORK_PATH}/${PRODUCT}" - local HEADER_PATH="${FRAMEWORK_PATH}/Headers" - printf "Found $FRAMEWORK_NAME. Verifying...\n" - - local MODULE_MAP=( $(find $FRAMEWORK_PATH -name "*.modulemap") ) - if [[ -z "$MODULE_MAP" ]]; then - printf "ERROR: No modulemap found in $FRAMEWORK_NAME\n"; - exit 3; - fi - printf "$FRAMEWORK_NAME contains modulemap: ✓\n" - - # Verify there is a modulemap so Swift can use the framework - if grep -q "link" "$MODULE_MAP"; then - printf "$FRAMEWORK_NAME modulemap contains dependent system frameworks ✓\n" - else - printf "Warning: ${FRAMEWORK_NAME} does not list any system library dependencies. Double check all dependent frameworks and libraries are listed. \n"; - fi - - # Verify there is at least one header listed in the module map - if grep -q ".*.h" "$MODULE_MAP"; then - printf "$FRAMEWORK_NAME modulemap contains headers ✓\n"; - else - printf "Error: ${FRAMEWORK_NAME} does not list any headers in the modulemap\n"; - exit 4; - fi - - # Verify there is at least a headers folder - if [[ ! -d "$HEADER_PATH" ]]; then - printf "ERROR: Headers not not found in ${FRAMEWORK_NAME}\n"; - exit 5; - fi - - # Verify the static lib at least has simulator and the two common ARM architectures - local PRESENT_ARCHITECTURES=$( xcrun lipo -info "${BINARY_PATH}" ) - for arch in "armv7" "arm64" "x86_64"; do - if [[ ! $PRESENT_ARCHITECTURES == *$arch* ]]; then - printf "ERROR: Architecture ${arch} not found in ${FRAMEWORK_NAME}\n"; - exit 6; - fi - done - printf "$FRAMEWORK_NAME contains simulator and device architectures: ✓\n" - - # Verify there are at least some bitcode segments in the rmv7 and arm64 slices - # Note, this is not conclusive, it is possible some symbols are missing the segment - for arch in "armv7" "arm64"; do - local SYMBOLS=$(otool -l -arch "${arch}" "${BINARY_PATH}") - if [[ ! $SYMBOLS == *"LLVM"* ]]; then - printf "ERROR: Bitcode segments not found in ${FRAMEWORK_NAME}. Users will fail to archive their builds \n"; - exit 7; - fi - done - printf "$FRAMEWORK_NAME contains bitcode: ✓\n" - - # Verify there is a plist file - local PLIST_PATH=( $(find $FRAMEWORK_PATH -name Info.plist) ) - if [[ -z "$PLIST_PATH" ]]; then - printf "ERROR: No Info.plist found in $FRAMEWORK_NAME\n" - exit 8; - fi - printf "$FRAMEWORK_NAME contains Info.plist: ✓\n" - - # Verify there is a bundle identifier in Info.plist - # And verify it does not contain any vestigial string templating - local BUNDLE_NAME=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "${PLIST_PATH}") - if [[ -z "$BUNDLE_NAME" ]]; then - printf "ERROR: Info.plist not found in $FRAMEWORK_NAME or CFBundleIdentifier not set\n"; - exit 9; - elif [[ "$BUNDLE_NAME" == *"$"* ]]; then - printf "ERROR: CFBundleIdentifier is invalid: $BUNDLE_NAME\n"; - exit 10; - else - printf "$FRAMEWORK_NAME has bundle: $BUNDLE_NAME ✓\n" - fi - - # Verify there is a bundle version in the Info.plist - local BUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "${PLIST_PATH}") - if [[ -z "$BUNDLE_VERSION" ]]; then - printf "ERROR: No CFBundleShortVersionString found in $FRAMEWORK_NAME\n"; - exit 11; - else - printf "$FRAMEWORK_NAME has version: $BUNDLE_VERSION ✓\n" - fi - - printf "===========================================\n" - printf "Analyzed $PRODUCT version $BUNDLE_VERSION. \n" - printf "Basic static verifications passed. 🚀🚀🚀 \n" - printf "Please perform final verification testing \n\n" -} - -# Extract the zip archive to a temporary location -TEMP_DIR=$(mktemp -d /tmp/fabric_framework_validation.XXXXX) -printf "Unzipping $(basename "$1") to $TEMP_DIR\n" -unzip "$1" -d "$TEMP_DIR" &> /dev/null - -# Find frameworks and ensure they are at the top level, e.g. NOT nested within a sub directory -printf "Scanning for frameworks...\n" -FRAMEWORKS=( $(find "$TEMP_DIR" -name "*.framework" -maxdepth 1) ) -if [ -z "$FRAMEWORKS" ]; then - printf "ERROR: No frameworks found at the top level within the zip archive."; - exit 2; -fi - -# Verify each framework found individually -for framework in "${FRAMEWORKS[@]}"; do - verifyFramework "$framework" - printf "" -done - -rm -r "$TEMP_DIR" diff --git a/platform/ios/scripts/xcpackage.sh b/platform/ios/scripts/xcpackage.sh deleted file mode 100644 index 3740ea316..000000000 --- a/platform/ios/scripts/xcpackage.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail -set -u - -NAME=Mapbox -OUTPUT=build/ios/pkg -DERIVED_DATA=build/ios -PRODUCTS=${DERIVED_DATA} -LOG_PATH=build/xcodebuild-$(date +"%Y-%m-%d_%H%M%S").log - -BUILD_DOCS=${BUILD_DOCS:-true} -SYMBOLS=${SYMBOLS:-YES} - -BUILDTYPE=${BUILDTYPE:-Debug} -if [[ ${SYMBOLS} == YES && ${BUILDTYPE} == Release ]]; then - BUILDTYPE='RelWithDebInfo' -fi - -FORMAT=${FORMAT:-dynamic} -if [[ ${FORMAT} != "dynamic" ]]; then - echo "Error: only dynamic FORMAT is supported in xcpackage build." - exit 1 -fi - -function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } -function finish { >&2 echo -en "\033[0m"; } -trap finish EXIT - -IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version` -IOS_SIM_SDK_VERSION=`xcrun --sdk iphonesimulator --show-sdk-version` - -step "Configuring ${FORMAT} framework for iphoneos ${IOS_SDK_VERSION} and iphonesimulator ${IOS_SIM_SDK_VERSION} (symbols: ${SYMBOLS}, buildtype: ${BUILDTYPE})" - -xcodebuild -version - -rm -rf ${OUTPUT} -BINOUT="${OUTPUT}"/dynamic -mkdir -p ${BINOUT} - -step "Recording library version…" -VERSION="${OUTPUT}"/version.txt -echo -n "https://github.com/maplibre/maplibre-native/commit/" > ${VERSION} -HASH=`git log | head -1 | awk '{ print $2 }' | cut -c 1-10` && true -echo -n "maplibre-gl-native-ios " -echo ${HASH} -echo ${HASH} >> ${VERSION} - -PROJ_VERSION=$(git rev-list --count HEAD) -SEM_VERSION=$( git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//' ) -SHORT_VERSION=${SEM_VERSION%-*} - -step "Building targets (build ${PROJ_VERSION}, version ${SEM_VERSION})" - -SCHEME='dynamic' - -CI_XCCONFIG='' -if [[ ! -z "${CI:=}" ]]; then - xcconfig='platform/darwin/ci.xcconfig' - echo "CI environment, using ${xcconfig}" - CI_XCCONFIG="-xcconfig ./${xcconfig}" -fi - -step "Building ${FORMAT} archive for iOS Simulator using ${SCHEME} scheme -> ${BINOUT}/${NAME}-iphonesimulator.xcarchive" -xcodebuild \ - archive \ - CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \ - CURRENT_COMMIT_HASH=${HASH} \ - SKIP_INSTALL=NO \ - BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ - -workspace ./platform/ios/ios.xcworkspace \ - -archivePath ${BINOUT}/${NAME}-iphonesimulator.xcarchive \ - -scheme ${SCHEME} \ - -configuration ${BUILDTYPE} \ - -sdk iphonesimulator \ - -jobs ${JOBS} | tee ${LOG_PATH} | xcpretty - -step "Building ${FORMAT} archive for iOS devices using ${SCHEME} scheme -> ${BINOUT}/${NAME}-iphoneos.xcarchive" -xcodebuild \ - archive \ - CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \ - CURRENT_COMMIT_HASH=${HASH} \ - SKIP_INSTALL=NO \ - BUILD_LIBRARY_FOR_DISTRIBUTION=YES \ - -workspace ./platform/ios/ios.xcworkspace \ - -archivePath ${BINOUT}/${NAME}-iphoneos.xcarchive \ - -scheme ${SCHEME} \ - -configuration ${BUILDTYPE} \ - -sdk iphoneos \ - -jobs ${JOBS} | tee ${LOG_PATH} | xcpretty - -LIBS=(Mapbox.a) - -function realpath { - [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" -} - -function addFramework { - local archive=$1 - local frameworkName=$2 - local includeDebugSymbols=$3 - - local frameworkPath="${archive}/Products/Library/Frameworks/${frameworkName}.framework" - BUILD_ARGS="$BUILD_ARGS -framework $frameworkPath" - - if [[ $includeDebugSymbols == true ]]; then - SYMBOL_PATH=$(realpath "${archive}/dSYMs/${frameworkName}.framework.dSYM") - BUILD_ARGS="$BUILD_ARGS -debug-symbols ${SYMBOL_PATH}" - fi -} - -step "Creating ${NAME} xcframework" - -INCLUDE_DEBUG_SYMBOLS=false -if [[ $BUILDTYPE='RelWithDebInfo' || $BUILDTYPE='Debug' ]]; then - INCLUDE_DEBUG_SYMBOLS=true -fi - - -# Mapbox mobile -BUILD_ARGS="" -addFramework "${BINOUT}/${NAME}-iphoneos.xcarchive" ${NAME} ${INCLUDE_DEBUG_SYMBOLS} -addFramework "${BINOUT}/${NAME}-iphonesimulator.xcarchive" ${NAME} ${INCLUDE_DEBUG_SYMBOLS} -BUILD_ARGS="$BUILD_ARGS -output ${BINOUT}/${NAME}.xcframework" -echo "Creating ${NAME}.xcframework with args: $BUILD_ARGS" -xcodebuild -create-xcframework $BUILD_ARGS -echo "${NAME}.xcframework created" - -step "Copying library resources…" -cp -pv LICENSE.md ${OUTPUT} -sed -n -e '/^## /,$p' platform/ios/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md" - -rm -rf /tmp/mbgl -mkdir -p /tmp/mbgl/ -README=/tmp/mbgl/README.md -cp platform/ios/docs/pod-README.md "${README}" -sed -i '' -e '/{{STATIC}}/,/{{\/STATIC}}/d' "${README}" -sed -i '' \ - -e '/{{DYNAMIC}}/d' -e '/{{\/DYNAMIC}}/d' \ - -e '/{{STATIC}}/d' -e '/{{\/STATIC}}/d' \ - "${README}" -cp ${README} "${OUTPUT}" - -if [ ${BUILD_DOCS} == true ]; then - step "Generating API documentation for ${BUILDTYPE} Build…" - make idocument OUTPUT="${OUTPUT}/documentation" -fi diff --git a/platform/ios/testall.sh b/platform/ios/testall.sh deleted file mode 100755 index c4093996b..000000000 --- a/platform/ios/testall.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -export BUILDTYPE=Release - -make darwin-check-public-symbols -echo "================================ ios-lint-plist" -make ios-lint-plist -echo "================================ ios-test" -make ios-test -echo "================================ ios-uitest" -make ios-uitest -echo "================================ ios-sanitize" -make ios-sanitize -echo "================================ ios-sanitize-address" -make ios-sanitize-address -echo "================================ ios-static-analyzer" -make ios-static-analyzer \ No newline at end of file