Integrate Telemetry SDK as framework dependency (#60)

This commit is contained in:
Julian Rex
2019-11-25 17:44:36 -05:00
committed by GitHub
parent 971cee8c48
commit 5e31b8fc36
29 changed files with 295 additions and 647 deletions

9
.gitmodules vendored
View File

@@ -1,15 +1,6 @@
[submodule "platform/ios/vendor/mapbox-events-ios"]
path = platform/ios/vendor/mapbox-events-ios
url = https://github.com/mapbox/mapbox-events-ios.git
[submodule "vendor/nunicode"]
path = vendor/nunicode
url = https://bitbucket.org/alekseyt/nunicode.git
[submodule "vendor/expected-lite"]
path = vendor/expected
url = https://github.com/martinmoene/expected-lite.git
[submodule "vendor/icu"]
path = vendor/icu
url = https://github.com/unicode-org/icu.git
[submodule "platform/darwin/docs/theme"]
path = platform/darwin/docs/theme
url = https://github.com/mapbox/jazzy-theme.git

View File

@@ -185,10 +185,6 @@ ios-install-simulators:
xcversion simulators --install="iOS 10.3.1" || true
xcversion simulators --install="iOS 9.3" || true
.PHONY: ios-check-events-symbols
ios-check-events-symbols:
./platform/ios/scripts/check-events-symbols.sh
.PHONY: ipackage
ipackage: ipackage*
ipackage%:

View File

@@ -168,7 +168,7 @@ commands:
- run:
name: Build ios-test
command: make ios-test
no_output_timeout: 5m
no_output_timeout: 20m
build-ios-integration-test:
steps:
- run:
@@ -270,9 +270,6 @@ jobs:
command: make ios-lint
- check-if-this-job-can-be-skipped
- build-ios-test
- run:
name: Check symbol namespacing for mapbox-events-ios
command: make ios-check-events-symbols
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
@@ -294,9 +291,6 @@ jobs:
command: make ios-lint
- check-if-this-job-can-be-skipped
- build-ios-test
- run:
name: Check symbol namespacing for mapbox-events-ios
command: make ios-check-events-symbols
- save-dependencies
- collect-xcode-build-logs
- upload-xcode-build-logs
@@ -406,7 +400,7 @@ jobs:
- run:
name: Build dynamic framework for device and simulator
command: make iframework
no_output_timeout: 5m
no_output_timeout: 20m
- deploy:
name: Upload snapshot build to s3
command: |

View File

@@ -13,7 +13,7 @@
#import "MGLLoggingConfiguration_Private.h"
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import "MMEConstants.h"
#import <MapboxMobileEvents/MapboxMobileEvents.h>
#import "MGLMapboxEvents.h"
#endif

View File

@@ -6,7 +6,7 @@
#import "MGLTypes.h"
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import "MMEEventsManager.h"
#import <MapboxMobileEvents/MapboxMobileEvents.h>
#endif
#import <mbgl/util/geo.hpp>

View File

@@ -14,7 +14,7 @@
#import "MGLLoggingConfiguration_Private.h"
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import "MMEConstants.h"
#import <MapboxMobileEvents/MMEConstants.h>
#endif
@interface MGLShapeOfflineRegion () <MGLOfflineRegion_Private, MGLShapeOfflineRegion_Private>

View File

@@ -4,7 +4,7 @@
#import "NSBundle+MGLAdditions.h"
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import "MMEEventsManager.h"
#import <MapboxMobileEvents/MapboxMobileEvents.h>
#endif
#include <mbgl/style/style.hpp>

View File

@@ -11,7 +11,7 @@
#import "MGLLoggingConfiguration_Private.h"
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import "MMEConstants.h"
#import <MapboxMobileEvents/MMEConstants.h>
#endif
@interface MGLTilePyramidOfflineRegion () <MGLOfflineRegion_Private, MGLTilePyramidOfflineRegion_Private>

View File

@@ -2,7 +2,13 @@
Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.
## master
## 5.6.0
### Packaging
* Integrates [`MapboxMobileEvents`](https://github.com/mapbox/mapbox-events-ios) as a dependency. ([#60](https://github.com/mapbox/mapbox-gl-native-ios/pull/60))
- CocoaPods: no change.
- Carthage: as an interim measure, please specify `github "mapbox/mapbox-events-ios" == 0.10.1-alpha` in your Cartfile.
- Manual installation: New Github release artifact (`mapbox-ios-sdk-5.6.0-alpha.1-dynamic-with-events.zip`) contains the `MapboxMobileEvents.framework`; please install this along with `Mapbox.framework`
### Networking and storage
* Make network requests for expired resources lower priority than requests for new resources. ([#15950](https://github.com/mapbox/mapbox-gl-native/pull/15950))

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
version = '5.5.0'
version = '5.6.0-alpha.1'
m.name = 'Mapbox-iOS-SDK-snapshot-dynamic'
m.version = "#{version}-snapshot"
@@ -29,4 +29,6 @@ Pod::Spec.new do |m|
m.preserve_path = '**/*.bcsymbolmap'
m.dependency "MapboxMobileEvents", "0.10.1-alpha"
end

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
version = '5.5.0'
version = '5.6.0-alpha.1'
m.name = 'Mapbox-iOS-SDK-stripped'
m.version = "#{version}-stripped"
@@ -29,4 +29,6 @@ Pod::Spec.new do |m|
m.preserve_path = '**/*.bcsymbolmap'
m.dependency "MapboxMobileEvents", "0.10.1-alpha"
end

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
version = '5.5.0'
version = '5.6.0-alpha.1'
m.name = 'Mapbox-iOS-SDK'
m.version = version
@@ -29,4 +29,5 @@ Pod::Spec.new do |m|
m.preserve_path = '**/*.bcsymbolmap'
m.dependency "MapboxMobileEvents", "0.10.1-alpha"
end

View File

@@ -5,4 +5,4 @@ framework module Mapbox {
link "c++"
link "sqlite3"
link "z"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -14,23 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4E8A9455A3A23B7FD2A8FC52"
BuildableName = "All"
BlueprintName = "All"
ReferencedContainer = "container:../../build/ios/platform/ios/platform.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA1DC9491CB6C1C2006E619F"
BuildableName = "Mapbox GL.app"
BlueprintName = "iosapp"
BlueprintIdentifier = "DA8847D11CBAF91600AB86E3"
BuildableName = "Mapbox.framework"
BlueprintName = "dynamic"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@@ -54,11 +40,18 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO"
language = "en"
region = "US"
codeCoverageEnabled = "YES"
onlyGenerateCoverageForSpecifiedTargets = "YES"
shouldUseLaunchSchemeArgsEnv = "NO">
onlyGenerateCoverageForSpecifiedTargets = "YES">
<EnvironmentVariables>
<EnvironmentVariable
key = "MAPBOX_RUN_PENDING_TESTS"
value = "YES"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
@@ -80,24 +73,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA1DC9491CB6C1C2006E619F"
BuildableName = "Mapbox GL.app"
BlueprintName = "iosapp"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "MAPBOX_RUN_PENDING_TESTS"
value = "YES"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -109,17 +84,6 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA1DC9491CB6C1C2006E619F"
BuildableName = "Mapbox GL.app"
BlueprintName = "iosapp"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -127,16 +91,15 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA1DC9491CB6C1C2006E619F"
BuildableName = "Mapbox GL.app"
BlueprintName = "iosapp"
BlueprintIdentifier = "DA8847D11CBAF91600AB86E3"
BuildableName = "Mapbox.framework"
BlueprintName = "dynamic"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">

View File

@@ -87,7 +87,7 @@
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
buildConfiguration = "RelWithDebInfo"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"

View File

@@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -61,8 +59,13 @@
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
<EnvironmentVariables>
<EnvironmentVariable
key = "DYLD_PRINT_RPATHS"
value = "1"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -4,6 +4,9 @@
<FileRef
location = "group:ios.xcodeproj">
</FileRef>
<FileRef
location = "group:vendor/mapbox-events-ios/MapboxMobileEvents.xcodeproj">
</FileRef>
<FileRef
location = "group:../../build/ios/Mapbox GL Native.xcodeproj">
</FileRef>

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env bash
set -eu -o pipefail
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
function finish { >&2 echo -en "\033[0m"; }
trap finish EXIT
find_framework() {
step "Looking for Mapbox.framework…"
echo $( find ./build -name Mapbox | tail -n 1 )
}
FRAMEWORK=$(find_framework)
if [[ -z "${FRAMEWORK}" || ! -f "${FRAMEWORK}" ]]; then
echo "No framework found — building dynamic Mapbox.framework…"
make iframework BUILD_DEVICE=false
FRAMEWORK=$(find_framework)
fi
echo "Found framework: ${FRAMEWORK}"
step "Checking for un-namespaced symbols from mapbox-events-ios…"
# Symbols from mapbox-events-ios are prefixed MME. To avoid duplicate symbol
# warnings when multiple copes of mapbox-events-ios are included in a project,
# the maps SDK prefixes these symbols with MGL_.
SYMBOLS=$( nm "$FRAMEWORK" | grep \$_MME || true )
if [ -z "${SYMBOLS}" ]; then
echo "✅ No un-namespaced symbols found."
else
echo "❗️ Found un-namespaced symbols:"
echo "${SYMBOLS}"
exit 1
fi

View File

@@ -23,7 +23,7 @@ buildPackageStyle() {
style="$2"
fi
step "Building: make ${package} ${style}"
make ${package}
FORMAT=${style} make ${package}
step "Publishing ${package} with ${style}"
local file_name=""
if [ -z ${style} ]
@@ -40,6 +40,8 @@ buildPackageStyle() {
--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
}
@@ -66,6 +68,10 @@ 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 [[ -z ${VERSION_TAG} ]]; then
step "Determining version number from most recent relevant git tag…"
VERSION_TAG=$( git describe --tags --match=ios-v*.*.* --abbrev=0 )
@@ -75,19 +81,27 @@ 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"
exit 1
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}"
exit 1
if [[ "${GITHUB_RELEASE}" == true ]]; then
exit 1
fi
fi
PUBLISH_VERSION=$( echo ${VERSION_TAG} | sed 's/^ios-v//' )
git checkout ${VERSION_TAG}
step "Deploying version ${PUBLISH_VERSION}…"
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}
@@ -105,6 +119,10 @@ if [[ "${GITHUB_RELEASE}" == true ]]; then
--description "${RELEASE_NOTES}"
fi
# Used for binary release on Github - includes events SDK
buildPackageStyle "iframework" "dynamic-with-events"
# Used for Cocoapods/Carthage
buildPackageStyle "iframework" "dynamic"
buildPackageStyle "iframework SYMBOLS=NO" "stripped-dynamic"

View File

@@ -22,25 +22,30 @@ 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`
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
function finish { >&2 echo -en "\033[0m"; }
trap finish EXIT
step "Configuring ${FORMAT} framework for ${SDK} ${IOS_SDK_VERSION} (symbols: ${SYMBOLS}, buildtype: ${BUILDTYPE})"
step "Configuring ${FORMAT} framework for ${SDK} ${IOS_SDK_VERSION} (symbols: ${SYMBOLS}, buildtype: ${BUILDTYPE}, include events:${INCLUDE_EVENTS_IN_PACKAGE})"
xcodebuild -version
@@ -112,6 +117,37 @@ 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
@@ -127,30 +163,13 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then
fi
if [[ ${BUILD_DYNAMIC} == true ]]; then
step "Copying dynamic framework into place for iOS devices"
cp -r \
${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework \
${OUTPUT}/dynamic/
copyAndMakeFatFramework "${NAME}"
if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM ]]; then
step "Copying 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
if [[ ${INCLUDE_EVENTS_IN_PACKAGE} == true ]]; then
copyAndMakeFatFramework "MapboxMobileEvents"
fi
step "Merging 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
# Bundling mapbox-events-ios
fi
cp -rv platform/ios/app/Settings.bundle ${OUTPUT}
@@ -196,14 +215,25 @@ function validate_dsym {
fi
}
if [[ ${BUILD_DYNAMIC} == true && ${BUILDTYPE} == Release ]]; then
validate_dsym \
"${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}" \
"${OUTPUT}/dynamic/${NAME}.framework/${NAME}"
function removeSimulatorSlice {
local NAME=$1
step "Removing i386 slice from 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}"
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

View File

@@ -41,15 +41,19 @@ du -sch pkg/dynamic/*
#
# upload
#
DRYRUN=""
if [[ ${SKIP_S3} ]]; then
DRYRUN="--dryrun"
fi
PROGRESS=""
if [ -n "${CI:-}" ]; then
PROGRESS="--no-progress"
fi
step "Uploading ${ZIP_FILENAME} to s3… ${DRYRUN}"
step "Uploading ${ZIP_FILENAME} to s3…"
aws s3 cp ${ZIP_FILENAME} s3://mapbox/mapbox-gl-native/ios/builds/ --acl public-read ${PROGRESS}
aws s3 cp ${ZIP_FILENAME} s3://mapbox/mapbox-gl-native/ios/builds/ --acl public-read ${PROGRESS} ${DRYRUN}
S3_URL=https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/${ZIP_FILENAME}
echo "URL: ${S3_URL}"
echo "mapbox-gl-native is currently hardcoded"
@@ -62,7 +66,7 @@ if [[ ${PUBLISH_VERSION} =~ "snapshot" ]]; then
GENERIC_ZIP_FILENAME="mapbox-ios-sdk-${PUBLISH_VERSION}.zip"
aws s3 cp \
s3://mapbox/mapbox-gl-native/ios/builds/${ZIP_FILENAME} \
s3://mapbox/mapbox-gl-native/ios/builds/${GENERIC_ZIP_FILENAME} --acl public-read ${PROGRESS}
s3://mapbox/mapbox-gl-native/ios/builds/${GENERIC_ZIP_FILENAME} --acl public-read ${PROGRESS} {DRYRUN}
fi
#
@@ -70,13 +74,16 @@ fi
#
step "Validating local and remote checksums…"
curl --output remote-${ZIP_FILENAME} ${S3_URL}
LOCAL_CHECKSUM=$( shasum -a 256 -b ${ZIP_FILENAME} | cut -d ' ' -f 1 )
REMOTE_CHECKSUM=$( shasum -a 256 -b remote-${ZIP_FILENAME} | 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
if [[ ! ${SKIP_S3} ]]; then
curl --output remote-${ZIP_FILENAME} ${S3_URL}
LOCAL_CHECKSUM=$( shasum -a 256 -b ${ZIP_FILENAME} | cut -d ' ' -f 1 )
REMOTE_CHECKSUM=$( shasum -a 256 -b remote-${ZIP_FILENAME} | 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

View File

@@ -4,7 +4,7 @@
#import "NSBundle+MGLAdditions.h"
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import "MMEEventsManager.h"
#import <MapboxMobileEvents/MapboxMobileEvents.h>
#endif
std::unique_ptr<MGLMapViewImpl> MGLMapViewImpl::Create(MGLMapView* nativeView) {

View File

@@ -3,8 +3,7 @@
#import "MGLMapView+OpenGL.h"
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import "MMEConstants.h"
#import "MGLMapboxEvents.h"
#import <MapboxMobileEvents/MapboxMobileEvents.h>
#endif
#include <mbgl/gl/renderable_resource.hpp>

View File

@@ -68,7 +68,7 @@
#import "MGLMapAccessibilityElement.h"
#import "MGLLocationManager_Private.h"
#import "MGLLoggingConfiguration_Private.h"
#import "MMEConstants.h"
#import <MapboxMobileEvents/MapboxMobileEvents.h>
#include <algorithm>
#include <cstdlib>

View File

@@ -1,5 +1,5 @@
#import <Foundation/Foundation.h>
#import "MMEEventsManager.h"
#import <MapboxMobileEvents/MapboxMobileEvents.h>
NS_ASSUME_NONNULL_BEGIN

View File

@@ -1,3 +1,5 @@
@import Foundation;
#import "MGLMapboxEvents.h"
#import "MBXSKUToken.h"
#import "NSBundle+MGLAdditions.h"
@@ -9,8 +11,6 @@ static NSString * const MGLMapboxMetricsDebugLoggingEnabledKey = @"MGLMapboxMetr
static NSString * const MGLMapboxMetricsEnabledSettingShownInAppKey = @"MGLMapboxMetricsEnabledSettingShownInApp";
static NSString * const MGLTelemetryAccessTokenKey = @"MGLTelemetryAccessToken";
static NSString * const MGLTelemetryBaseURLKey = @"MGLTelemetryBaseURL";
static NSString * const MGLEventsProfileKey = @"MMEEventsProfile";
static NSString * const MGLVariableGeofenceKey = @"VariableGeofence";
static NSString * const MGLAPIClientUserAgentBase = @"mapbox-maps-ios";
@@ -22,6 +22,11 @@ static NSString * const MGLAPIClientUserAgentBase = @"mapbox-maps-ios";
@end
// TODO: Move to private/public header
@interface MMEEventsManager (TODO)
@property (nonatomic, getter=isDebugLoggingEnabled) BOOL debugLoggingEnabled;
@end
@implementation MGLMapboxEvents
+ (void)initialize {
@@ -49,9 +54,12 @@ static NSString * const MGLAPIClientUserAgentBase = @"mapbox-maps-ios";
if (self) {
_eventsManager = MMEEventsManager.sharedManager;
_eventsManager.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsDebugLoggingEnabledKey];
_eventsManager.accountType = [[NSUserDefaults standardUserDefaults] integerForKey:MGLMapboxAccountTypeKey];
_eventsManager.metricsEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsEnabledKey];
// TODO: What happens if the dev sets MGLMapboxAccountTypeKey prior to using the SDK?
// _eventsManager.accountType = [[NSUserDefaults standardUserDefaults] integerForKey:MGLMapboxAccountTypeKey];
BOOL collectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsEnabledKey];
NSUserDefaults.mme_configuration.mme_isCollectionEnabled = collectionEnabled;
// It is possible for the shared instance of this class to be created because of a call to
// +[MGLAccountManager load] early on in the app lifecycle of the host application.
// If user default values for access token and base URL are available, they are stored here
@@ -83,24 +91,18 @@ static NSString * const MGLAPIClientUserAgentBase = @"mapbox-maps-ios";
}
- (void)updateNonDisablingConfigurationValues {
self.eventsManager.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsDebugLoggingEnabledKey];
// It is possible for the telemetry access token key to have been set yet `userDefaultsDidChange:`
// is called before `setupWithAccessToken:` is called.
// In that case, setting the access token here will have no effect. In practice, that's fine
// because the access token value will be resolved when `setupWithAccessToken:` is called eventually
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryAccessTokenKey]) {
self.eventsManager.accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryAccessTokenKey];
}
// It is possible for the telemetry base URL key to have been set yet `userDefaultsDidChange:`
// is called before setupWithAccessToken: is called.
// In that case, setting the base URL here will have no effect. In practice, that's fine
// because the base URL value will be resolved when `setupWithAccessToken:` is called eventually
if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryBaseURLKey]) {
NSURL *baseURL = [NSURL URLWithString:[[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryBaseURLKey]];
self.eventsManager.baseURL = baseURL;
NSString *telemetryAccessToken = [[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryAccessTokenKey];
NSUserDefaults.mme_configuration.mme_accessToken = telemetryAccessToken;
}
}
- (void)updateDisablingConfigurationValuesWithNotification:(NSNotification *)notification {
@@ -108,49 +110,50 @@ static NSString * const MGLAPIClientUserAgentBase = @"mapbox-maps-ios";
// cares about have not changed. We guard because the pause and resume method checks CoreLocation's
// authorization status and that can drag on the main thread if done too many times (e.g. if the host
// app heavily uses the user defaults API and this method is called very frequently)
if ([[notification object] respondsToSelector:@selector(objectForKey:)]) {
NSUserDefaults *userDefaults = [notification object];
NSInteger accountType = [userDefaults integerForKey:MGLMapboxAccountTypeKey];
BOOL metricsEnabled = [userDefaults boolForKey:MGLMapboxMetricsEnabledKey];
if (accountType != self.eventsManager.accountType || metricsEnabled != self.eventsManager.metricsEnabled) {
self.eventsManager.accountType = accountType;
self.eventsManager.metricsEnabled = metricsEnabled;
// //TODO: Account type changed at runtime
// NSInteger accountType = [userDefaults integerForKey:MGLMapboxAccountTypeKey];
// if (accountType != self.eventsManager.accountType) {
// self.eventsManager.accountType = accountType;
// }
BOOL oldCollectionEnabled = NSUserDefaults.mme_configuration.mme_isCollectionEnabled;
BOOL collectionEnabled = [userDefaults boolForKey:MGLMapboxMetricsEnabledKey];
if (collectionEnabled != oldCollectionEnabled) {
NSUserDefaults.mme_configuration.mme_isCollectionEnabled = collectionEnabled;
[self.eventsManager pauseOrResumeMetricsCollectionIfRequired];
}
}
}
+ (void)setupWithAccessToken:(NSString *)accessToken {
int64_t delayTime = 0;
if ([[[NSBundle mainBundle] objectForInfoDictionaryKey:MGLEventsProfileKey] isEqualToString:MGLVariableGeofenceKey]) {
delayTime = 10;
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSString *semanticVersion = [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"];
NSString *shortVersion = [NSBundle mgl_frameworkInfoDictionary][@"CFBundleShortVersionString"];
NSString *sdkVersion = semanticVersion ?: shortVersion;
// It is possible that an alternative access token was already set on this instance when the class was loaded
// Use it if it exists
NSString *resolvedAccessToken = [MGLMapboxEvents sharedInstance].accessToken ?: accessToken;
[[[self sharedInstance] eventsManager] initializeWithAccessToken:resolvedAccessToken userAgentBase:MGLAPIClientUserAgentBase hostSDKVersion:sdkVersion];
// It is possible that an alternative base URL was set on this instance when the class was loaded
// Use it if it exists
if ([MGLMapboxEvents sharedInstance].baseURL) {
[[MGLMapboxEvents sharedInstance] eventsManager].baseURL = [MGLMapboxEvents sharedInstance].baseURL;
}
[[self sharedInstance] eventsManager].skuId = MBXAccountsSKUIDMapsUser;
[self flush];
});
MGLMapboxEvents *events = [MGLMapboxEvents sharedInstance];
// From https://github.com/mapbox/mapbox-events-ios
NSString *semanticVersion = [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"];
NSString *shortVersion = [NSBundle mgl_frameworkInfoDictionary][@"CFBundleShortVersionString"];
NSString *sdkVersion = semanticVersion ?: shortVersion;
MMEEventsManager *eventsManager = MMEEventsManager.sharedManager;
// It is possible that an alternative access token was already set on this instance when the class was loaded
// Use it if it exists
NSString *resolvedAccessToken = [MGLMapboxEvents sharedInstance].accessToken ?: accessToken;
[eventsManager initializeWithAccessToken:resolvedAccessToken
userAgentBase:MGLAPIClientUserAgentBase
hostSDKVersion:sdkVersion];
eventsManager.skuId = MBXAccountsSKUIDMapsUser;
eventsManager.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey :MGLMapboxMetricsDebugLoggingEnabledKey];
events.eventsManager = eventsManager;
}
+ (void)pushTurnstileEvent {

View File

@@ -1 +0,0 @@
#import "MMENamespacedDependencies.h"