Selectable renderer implementation (#1247)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -58,6 +58,40 @@ android {
|
||||
buildConfigField "String", "MAPBOX_VERSION_STRING", String.format("\"Mapbox/%s\"", project.VERSION_NAME)
|
||||
buildConfigField "String", "MAPBOX_EVENTS_USER_AGENT", String.format("\"mapbox-maps-android/%s\"", project.VERSION_NAME)
|
||||
consumerProguardFiles 'proguard-rules.pro'
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DMLN_LEGACY_RENDERER=ON", "-DMLN_DRAWABLE_RENDERER=OFF", "-DMLN_RENDERER_SPLIT_VIEW=OFF"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions += "renderer"
|
||||
productFlavors {
|
||||
create("legacy") {
|
||||
dimension = "renderer"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DMLN_LEGACY_RENDERER=ON", "-DMLN_DRAWABLE_RENDERER=OFF", "-DMLN_RENDERER_SPLIT_VIEW=OFF"
|
||||
}
|
||||
}
|
||||
}
|
||||
create("drawable") {
|
||||
dimension = "renderer"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DMLN_LEGACY_RENDERER=OFF", "-DMLN_DRAWABLE_RENDERER=ON", "-DMLN_RENDERER_SPLIT_VIEW=OFF"
|
||||
}
|
||||
}
|
||||
}
|
||||
create("split") {
|
||||
dimension = "renderer"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DMLN_LEGACY_RENDERER=ON", "-DMLN_DRAWABLE_RENDERER=ON", "-DMLN_RENDERER_SPLIT_VIEW=ON"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// build native libraries
|
||||
@@ -93,6 +127,7 @@ android {
|
||||
debug {
|
||||
testCoverageEnabled false
|
||||
jniDebuggable true
|
||||
debuggable true
|
||||
}
|
||||
}
|
||||
namespace 'org.maplibre.android'
|
||||
|
||||
@@ -37,4 +37,13 @@
|
||||
# while we don't include this dependency directly
|
||||
# a large amount of users combine it with our SDK
|
||||
# we aren't able to provide a proguard config in that project (jar vs aar)
|
||||
-dontwarn com.sun.xml.internal.ws.spi.db.*
|
||||
-dontwarn com.sun.xml.internal.ws.spi.db.*
|
||||
|
||||
# okhttp
|
||||
-dontwarn org.bouncycastle.jsse.BCSSLSocket
|
||||
-dontwarn org.bouncycastle.jsse.BCSSLParameters
|
||||
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
|
||||
-dontwarn org.conscrypt.*
|
||||
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
|
||||
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
|
||||
-dontwarn org.openjsse.net.ssl.OpenJSSE
|
||||
@@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:glEsVersion="0x00030000"
|
||||
android:required="true"/>
|
||||
<uses-feature
|
||||
android:name="android.hardware.wifi"
|
||||
|
||||
@@ -392,6 +392,10 @@ public class MapLibreGLSurfaceView extends SurfaceView implements SurfaceHolder.
|
||||
mEglContext = null;
|
||||
} else {
|
||||
mEglConfig = view.eglConfigChooser.chooseConfig(mEgl, mEglDisplay);
|
||||
if (mEglConfig == null) {
|
||||
Log.e(TAG, "failed to select an EGL configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an EGL context. We want to do this as rarely as we can, because an
|
||||
|
||||
@@ -33,6 +33,8 @@ android {
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
jniDebuggable true
|
||||
debuggable true
|
||||
testCoverageEnabled true
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
@@ -46,6 +48,19 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions += "renderer"
|
||||
productFlavors {
|
||||
create("legacy") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
create("drawable") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
create("split") {
|
||||
dimension = "renderer"
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
@@ -78,7 +93,7 @@ dependencies {
|
||||
|
||||
implementation dependenciesList.okhttp3
|
||||
|
||||
implementation dependenciesList.leakCanary
|
||||
debugImplementation dependenciesList.leakCanary
|
||||
|
||||
androidTestImplementation dependenciesList.supportAnnotations
|
||||
androidTestImplementation dependenciesList.testRunner
|
||||
|
||||
@@ -11,4 +11,13 @@
|
||||
# GMS
|
||||
-dontnote com.google.android.gms.**
|
||||
|
||||
-keep class org.maplibre.android.testapp.model.customlayer.ExampleCustomLayer { *; }
|
||||
-keep class com.mapbox.mapboxsdk.testapp.model.customlayer.ExampleCustomLayer { *; }
|
||||
|
||||
# okhttp
|
||||
-dontwarn org.bouncycastle.jsse.BCSSLSocket
|
||||
-dontwarn org.bouncycastle.jsse.BCSSLParameters
|
||||
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
|
||||
-dontwarn org.conscrypt.*
|
||||
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
|
||||
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
|
||||
-dontwarn org.openjsse.net.ssl.OpenJSSE
|
||||
@@ -3,9 +3,10 @@ package org.maplibre.android.testapp.activity.maplayout
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import org.maplibre.android.maps.*
|
||||
import org.maplibre.android.testapp.R
|
||||
import org.maplibre.android.testapp.utils.NavUtils
|
||||
import com.mapbox.mapboxsdk.maps.*
|
||||
import com.mapbox.mapboxsdk.testapp.R
|
||||
import com.mapbox.mapboxsdk.testapp.utils.ApiKeyUtils
|
||||
import com.mapbox.mapboxsdk.testapp.utils.NavUtils
|
||||
|
||||
/**
|
||||
* Test activity showcasing a simple MapView without any MapboxMap interaction.
|
||||
@@ -18,11 +19,16 @@ class SimpleMapActivity : AppCompatActivity() {
|
||||
mapView = findViewById(R.id.mapView)
|
||||
mapView.onCreate(savedInstanceState)
|
||||
mapView.getMapAsync(
|
||||
OnMapReadyCallback { maplibreMap: MapLibreMap ->
|
||||
val styles = Style.getPredefinedStyles()
|
||||
if (styles != null && styles.size > 0) {
|
||||
val styleUrl = styles[0].url
|
||||
maplibreMap.setStyle(Style.Builder().fromUri(styleUrl))
|
||||
OnMapReadyCallback { mapboxMap: MapboxMap ->
|
||||
var key = ApiKeyUtils.getApiKey(applicationContext)
|
||||
if (key == null || key == "YOUR_API_KEY_GOES_HERE") {
|
||||
mapboxMap.setStyle(Style.Builder().fromUri("https://demotiles.maplibre.org/style.json"))
|
||||
} else {
|
||||
val styles = Style.getPredefinedStyles()
|
||||
if (styles != null && styles.size > 0) {
|
||||
val styleUrl = styles[0].url
|
||||
mapboxMap.setStyle(Style.Builder().fromUri(styleUrl))
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -44,7 +44,7 @@ afterEvaluate {
|
||||
artifactId project.ext.mapLibreArtifactId
|
||||
version this.version
|
||||
|
||||
from components.release
|
||||
from components.legacyRelease
|
||||
|
||||
artifact androidSourcesJar
|
||||
artifact androidJavadocsJar
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "apple_xcframework")
|
||||
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_static_xcframework", "apple_xcframework", "local_provisioning_profile")
|
||||
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework")
|
||||
load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle")
|
||||
load(
|
||||
"@rules_xcodeproj//xcodeproj:defs.bzl",
|
||||
"top_level_target",
|
||||
"xcodeproj",
|
||||
"xcode_provisioning_profile"
|
||||
)
|
||||
load("//platform/ios/bazel:macros.bzl", "info_plist")
|
||||
load("//platform/ios/bazel:config.bzl", "BUILD_MODE", "BUNDLE_ID_PREFIX")
|
||||
load(
|
||||
"//platform/ios/bazel:files.bzl",
|
||||
"MLN_IOS_PRIVATE_HEADERS",
|
||||
"MLN_IOS_PUBLIC_HEADERS",
|
||||
"MLN_IOS_PUBLIC_OBJCPP_SOURCE",
|
||||
"MLN_IOS_PUBLIC_OBJC_SOURCE",
|
||||
"MLN_IOS_SDK_HEADERS",
|
||||
"MLN_PUBLIC_IOS_APP_SOPURCE",
|
||||
load("bazel/macros.bzl", "info_plist")
|
||||
load("bazel/__generated__/provisioning_profile.bzl", "APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID", "APPLE_MOBILE_PROVISIONING_PROFILE_UUID")
|
||||
|
||||
local_provisioning_profile(
|
||||
name = "provisioning_profile",
|
||||
profile_name = APPLE_MOBILE_PROVISIONING_PROFILE_UUID,
|
||||
team_id = APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID
|
||||
)
|
||||
|
||||
xcode_provisioning_profile(
|
||||
name = "xcode_profile",
|
||||
managed_by_xcode = True,
|
||||
provisioning_profile = ":provisioning_profile"
|
||||
)
|
||||
load("//platform/ios/bazel:provisioning.bzl", "configure_device_profiles")
|
||||
|
||||
configure_device_profiles()
|
||||
|
||||
@@ -138,7 +141,237 @@ apple_resource_bundle(
|
||||
"resources/*.lproj/**",
|
||||
"resources/*.xcassets/**",
|
||||
]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Objcpp files for the iOS source
|
||||
objc_library(
|
||||
name = "objcpp-sdk",
|
||||
srcs = [
|
||||
"platform/darwin/src/MLNAttributionInfo.mm",
|
||||
"platform/darwin/src/MLNBackgroundStyleLayer.mm",
|
||||
"platform/darwin/src/MLNCircleStyleLayer.mm",
|
||||
"platform/darwin/src/MLNComputedShapeSource.mm",
|
||||
"platform/darwin/src/MLNDefaultStyle.mm",
|
||||
"platform/darwin/src/MLNFeature.mm",
|
||||
"platform/darwin/src/MLNFillExtrusionStyleLayer.mm",
|
||||
"platform/darwin/src/MLNFillStyleLayer.mm",
|
||||
"platform/darwin/src/MLNForegroundStyleLayer.mm",
|
||||
"platform/darwin/src/MLNFoundation.mm",
|
||||
"platform/darwin/src/MLNGeometry.mm",
|
||||
"platform/darwin/src/MLNHeatmapStyleLayer.mm",
|
||||
"platform/darwin/src/MLNHillshadeStyleLayer.mm",
|
||||
"platform/darwin/src/MLNImageSource.mm",
|
||||
"platform/darwin/src/MLNLight.mm",
|
||||
"platform/darwin/src/MLNLineStyleLayer.mm",
|
||||
"platform/darwin/src/MLNLoggingConfiguration.mm",
|
||||
"platform/darwin/src/MLNMapCamera.mm",
|
||||
"platform/darwin/src/MLNMapSnapshotter.mm",
|
||||
"platform/darwin/src/MLNMultiPoint.mm",
|
||||
"platform/darwin/src/MLNNetworkConfiguration.mm",
|
||||
"platform/darwin/src/MLNOfflinePack.mm",
|
||||
"platform/darwin/src/MLNOfflineStorage.mm",
|
||||
"platform/darwin/src/MLNOpenGLStyleLayer.mm",
|
||||
"platform/darwin/src/MLNPointAnnotation.mm",
|
||||
"platform/darwin/src/MLNPointCollection.mm",
|
||||
"platform/darwin/src/MLNPolygon.mm",
|
||||
"platform/darwin/src/MLNPolyline.mm",
|
||||
"platform/darwin/src/MLNRasterDEMSource.mm",
|
||||
"platform/darwin/src/MLNRasterStyleLayer.mm",
|
||||
"platform/darwin/src/MLNRasterTileSource.mm",
|
||||
"platform/darwin/src/MLNSettings.mm",
|
||||
"platform/darwin/src/MLNShape.mm",
|
||||
"platform/darwin/src/MLNShapeCollection.mm",
|
||||
"platform/darwin/src/MLNShapeOfflineRegion.mm",
|
||||
"platform/darwin/src/MLNShapeSource.mm",
|
||||
"platform/darwin/src/MLNSource.mm",
|
||||
"platform/darwin/src/MLNStyle.mm",
|
||||
"platform/darwin/src/MLNStyleLayer.mm",
|
||||
"platform/darwin/src/MLNStyleLayerManager.mm",
|
||||
"platform/darwin/src/MLNStyleValue.mm",
|
||||
"platform/darwin/src/MLNSymbolStyleLayer.mm",
|
||||
"platform/darwin/src/MLNTilePyramidOfflineRegion.mm",
|
||||
"platform/darwin/src/MLNTileServerOptions.mm",
|
||||
"platform/darwin/src/MLNTileSource.mm",
|
||||
"platform/darwin/src/MLNVectorStyleLayer.mm",
|
||||
"platform/darwin/src/MLNVectorTileSource.mm",
|
||||
"platform/darwin/src/NSArray+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSBundle+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSCoder+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSComparisonPredicate+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSCompoundPredicate+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSDate+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSDictionary+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSExpression+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSPredicate+MLNAdditions.mm",
|
||||
"platform/darwin/src/NSValue+MLNStyleAttributeAdditions.mm",
|
||||
"platform/ios/src/MLNAnnotationView.mm",
|
||||
"platform/ios/src/MLNCompassButton.mm",
|
||||
"platform/ios/src/MLNFaux3DUserLocationAnnotationView.mm",
|
||||
"platform/ios/src/MLNMapAccessibilityElement.mm",
|
||||
"platform/ios/src/MLNMapProjection.mm",
|
||||
"platform/ios/src/MLNMapView.mm",
|
||||
"platform/ios/src/MLNMapView+Impl.mm",
|
||||
"platform/ios/src/MLNMapView+OpenGL.mm",
|
||||
"platform/ios/src/MLNScaleBar.mm",
|
||||
"platform/ios/src/UIColor+MLNAdditions.mm",
|
||||
"platform/ios/src/UIImage+MLNAdditions.mm",
|
||||
],
|
||||
copts = CPP_FLAGS + MAPLIBRE_FLAGS + [
|
||||
"-fcxx-modules",
|
||||
"-fmodules",
|
||||
"-Wno-c99-extensions",
|
||||
"-Wno-gnu-zero-variadic-macro-arguments",
|
||||
"-Wno-gnu-conditional-omitted-operand",
|
||||
"-Wno-gnu-statement-expression",
|
||||
],
|
||||
includes = [
|
||||
"platform/darwin/include",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"CoreImage",
|
||||
"CoreLocation",
|
||||
"GLKit",
|
||||
"OpenGLES",
|
||||
"QuartzCore",
|
||||
],
|
||||
defines = ["GLES_SILENCE_DEPRECATION=1"],
|
||||
deps = [
|
||||
"objc-headers",
|
||||
"//:mbgl-core",
|
||||
"//platform/darwin:darwin-objcpp",
|
||||
"//platform/default:mbgl-default",
|
||||
"//platform/ios/platform/ios/vendor:SMCalloutView",
|
||||
],
|
||||
)
|
||||
|
||||
# platform/ios/sdk-files.json
|
||||
# Objc files for the iOS source
|
||||
objc_library(
|
||||
name = "objc-sdk",
|
||||
srcs = [
|
||||
"platform/darwin/src/MLNAttributedExpression.m",
|
||||
"platform/darwin/src/MLNClockDirectionFormatter.m",
|
||||
"platform/darwin/src/MLNCompassDirectionFormatter.m",
|
||||
"platform/darwin/src/MLNCoordinateFormatter.m",
|
||||
"platform/darwin/src/MLNDistanceFormatter.m",
|
||||
"platform/darwin/src/MLNLocationManager.m",
|
||||
"platform/darwin/src/MLNReachability.m",
|
||||
"platform/darwin/src/MLNRendererConfiguration.m",
|
||||
"platform/darwin/src/MLNTypes.m",
|
||||
"platform/darwin/src/NSString+MLNAdditions.m",
|
||||
"platform/darwin/src/NSURL+MLNAdditions.m",
|
||||
"platform/darwin/src/NSValue+MLNAdditions.m",
|
||||
"platform/ios/src/MLNAnnotationContainerView.m",
|
||||
"platform/ios/src/MLNAnnotationImage.m",
|
||||
"platform/ios/src/MLNCompactCalloutView.m",
|
||||
"platform/ios/src/MLNUserLocation.m",
|
||||
"platform/ios/src/MLNUserLocationAnnotationView.m",
|
||||
"platform/ios/src/MLNUserLocationAnnotationViewStyle.m",
|
||||
"platform/ios/src/MLNUserLocationHeadingArrowLayer.m",
|
||||
"platform/ios/src/MLNUserLocationHeadingBeamLayer.m",
|
||||
"platform/ios/src/NSOrthography+MLNAdditions.m",
|
||||
"platform/ios/src/UIDevice+MLNAdditions.m",
|
||||
"platform/ios/src/UIView+MLNAdditions.m",
|
||||
"platform/ios/src/UIViewController+MLNAdditions.m",
|
||||
],
|
||||
hdrs = [
|
||||
"platform/darwin/include/mbgl/util/image+MLNAdditions.hpp",
|
||||
],
|
||||
copts = WARNING_FLAGS + MAPLIBRE_FLAGS + [
|
||||
"-fmodules",
|
||||
"-Wno-gnu-zero-variadic-macro-arguments",
|
||||
"-Wno-variadic-macros",
|
||||
"-Wno-gnu-conditional-omitted-operand",
|
||||
],
|
||||
includes = [
|
||||
"platform/darwin/include",
|
||||
],
|
||||
deps = [
|
||||
"objc-headers",
|
||||
"//:mbgl-core",
|
||||
"//platform/darwin:darwin-objc",
|
||||
"//platform/default:mbgl-default",
|
||||
"//platform/ios/platform/ios/vendor:SMCalloutView",
|
||||
],
|
||||
)
|
||||
|
||||
# Common headers between objc and objcpp libraries.
|
||||
objc_library(
|
||||
name = "objc-headers",
|
||||
srcs = glob([
|
||||
"platform/darwin/src/*.h",
|
||||
"platform/ios/src/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"platform/darwin/src",
|
||||
"platform/ios/src",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"CoreGraphics",
|
||||
"CoreLocation",
|
||||
"QuartzCore",
|
||||
],
|
||||
deps = [
|
||||
"//platform/darwin:darwin-objc",
|
||||
"//platform/darwin:darwin-objcpp",
|
||||
],
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "sdk-headers",
|
||||
hdrs = ["platform/ios/src/Mapbox.h"] + _PUBLIC_HEADERS,
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "iosapp",
|
||||
srcs = [
|
||||
"platform/darwin/app/LimeGreenStyleLayer.h",
|
||||
"platform/darwin/app/LimeGreenStyleLayer.m",
|
||||
"platform/ios/app/MBXAnnotationView.m",
|
||||
"platform/ios/app/MBXAppDelegate.m",
|
||||
"platform/ios/app/MBXCustomCalloutView.h",
|
||||
"platform/ios/app/MBXCustomCalloutView.m",
|
||||
"platform/ios/app/MBXCustomLocationViewController.m",
|
||||
"platform/ios/app/MBXEmbeddedMapViewController.m",
|
||||
"platform/ios/app/MBXFrameTimeGraphView.m",
|
||||
"platform/ios/app/MBXOfflinePacksTableViewController.m",
|
||||
"platform/ios/app/MBXOrnamentsViewController.m",
|
||||
"platform/ios/app/MBXSnapshotsViewController.m",
|
||||
"platform/ios/app/MBXState.m",
|
||||
"platform/ios/app/MBXStateManager.m",
|
||||
"platform/ios/app/MBXUserLocationAnnotationView.m",
|
||||
"platform/ios/app/MBXViewController.m",
|
||||
"platform/ios/app/main.m",
|
||||
],
|
||||
hdrs = [
|
||||
"platform/ios/app/MBXAnnotationView.h",
|
||||
"platform/ios/app/MBXAppDelegate.h",
|
||||
"platform/ios/app/MBXCustomLocationViewController.h",
|
||||
"platform/ios/app/MBXEmbeddedMapViewController.h",
|
||||
"platform/ios/app/MBXFrameTimeGraphView.h",
|
||||
"platform/ios/app/MBXOfflinePacksTableViewController.h",
|
||||
"platform/ios/app/MBXOrnamentsViewController.h",
|
||||
"platform/ios/app/MBXSnapshotsViewController.h",
|
||||
"platform/ios/app/MBXState.h",
|
||||
"platform/ios/app/MBXStateManager.h",
|
||||
"platform/ios/app/MBXUserLocationAnnotationView.h",
|
||||
"platform/ios/app/MBXViewController.h",
|
||||
"platform/ios/app/MLNMapView_Experimental.h",
|
||||
],
|
||||
data = glob([
|
||||
"platform/ios/app/Assets.xcassets/**",
|
||||
]),
|
||||
includes = [
|
||||
"platform/darwin/app",
|
||||
"platform/darwin/src",
|
||||
"platform/ios/src",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"GLKit", # needed for LimeGreenStyleLayer
|
||||
],
|
||||
deps = [
|
||||
"sdk-headers",
|
||||
],
|
||||
)
|
||||
|
||||
_IOS_APPLICATION_RESOURCES = [
|
||||
@@ -165,11 +398,12 @@ ios_application(
|
||||
"iphone",
|
||||
"ipad",
|
||||
],
|
||||
infoplists = ["app/Info.plist"],
|
||||
infoplists = ["build/Info-app.plist"],
|
||||
minimum_os_version = "12.0",
|
||||
provisioning_profile = "xcode_profile",
|
||||
resources = _IOS_APPLICATION_RESOURCES,
|
||||
visibility = ["//visibility:public"],
|
||||
provisioning_profile = ":xcode_profile",
|
||||
deps = [
|
||||
"//platform:iosapp",
|
||||
],
|
||||
@@ -190,6 +424,7 @@ ios_application(
|
||||
provisioning_profile = ":xcode_profile",
|
||||
resources = _IOS_APPLICATION_RESOURCES,
|
||||
visibility = ["//visibility:public"],
|
||||
provisioning_profile = ":xcode_profile",
|
||||
deps = [
|
||||
"//platform:iosapp",
|
||||
],
|
||||
@@ -220,39 +455,8 @@ xcodeproj(
|
||||
tags = ["manual"],
|
||||
top_level_targets = [
|
||||
top_level_target(
|
||||
"App",
|
||||
target_environments = [
|
||||
"simulator",
|
||||
"device",
|
||||
],
|
||||
),
|
||||
top_level_target(
|
||||
"//render-test/ios:RenderTest",
|
||||
target_environments = [
|
||||
"simulator",
|
||||
"device",
|
||||
],
|
||||
),
|
||||
top_level_target(
|
||||
"//platform/ios/iosapp-UITests:uitest",
|
||||
target_environments = [
|
||||
"simulator",
|
||||
"device",
|
||||
],
|
||||
),
|
||||
top_level_target(
|
||||
"//platform/ios/test:ios_test",
|
||||
target_environments = [
|
||||
"simulator",
|
||||
"device",
|
||||
],
|
||||
),
|
||||
top_level_target(
|
||||
"//platform/ios/test/core:CppUnitTests",
|
||||
target_environments = [
|
||||
"simulator",
|
||||
"device",
|
||||
],
|
||||
":App",
|
||||
target_environments = ["device", "simulator"],
|
||||
),
|
||||
],
|
||||
xcode_configurations = {
|
||||
|
||||
@@ -8,6 +8,15 @@ build_type="static"
|
||||
# "release" or "debug"
|
||||
release_type="release"
|
||||
|
||||
# Renderer flavor
|
||||
flavor="legacy"
|
||||
|
||||
# Provisioning team ID
|
||||
teamid="0000000000"
|
||||
|
||||
# Provisioning profile name/UUID
|
||||
uuid="iOS Team Provisioning Profile: *"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--static)
|
||||
@@ -36,6 +45,21 @@ while [[ $# -gt 0 ]]; do
|
||||
echo "Defaults to \"--static --release\""
|
||||
exit 1
|
||||
;;
|
||||
--flavor)
|
||||
shift
|
||||
flavor="$1"
|
||||
shift
|
||||
;;
|
||||
--teamid)
|
||||
shift
|
||||
teamid="$1"
|
||||
shift
|
||||
;;
|
||||
--profile-uuid)
|
||||
shift
|
||||
uuid="$1"
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
@@ -75,13 +99,28 @@ plutil -replace MLNCommitHash -string "$hash" "$temp_info_plist"
|
||||
|
||||
echo "------ Building Maplibre version: $sem_version hash: $hash ------"
|
||||
|
||||
# Generate provisioning team ID
|
||||
if [ ! -d platform/ios/bazel/__generated__ ]; then
|
||||
mkdir platform/ios/bazel/__generated__
|
||||
fi
|
||||
|
||||
cat > platform/ios/bazel/__generated__/provisioning_profile.bzl <<EOF
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID = "$teamid"
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_UUID = "$uuid"
|
||||
EOF
|
||||
|
||||
# Build
|
||||
ncpu=$(sysctl -n hw.ncpu)
|
||||
bazel build //platform/ios:"$target" --apple_platform_type=ios \
|
||||
--apple_generate_dsym \
|
||||
--compilation_mode="$compilation_mode" \
|
||||
--features=dead_strip \
|
||||
--objc_enable_binary_stripping \
|
||||
--copt=-Wall --copt=-Wextra --copt=-Wpedantic \
|
||||
--copt=-Werror
|
||||
--copt=-Werror \
|
||||
--jobs "$ncpu" \
|
||||
--//:renderer=$flavor \
|
||||
--//:maplibre_platform=ios
|
||||
|
||||
echo "Done."
|
||||
echo "Package will be available in \"/bazel-bin/platform/ios/$target.xcframework.zip\""
|
||||
|
||||
@@ -1,28 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
set -eo pipefail
|
||||
|
||||
echo "------ Determining Maplibre version and hash ------"
|
||||
|
||||
sem_version=0.0.0
|
||||
hash=$(git log | head -1 | awk '{ print $2 }' | cut -c 1-10) && true
|
||||
|
||||
echo "------ Configuring project ------"
|
||||
# Move and configure the info plists with the semantic version and hash.
|
||||
temp_info_static_plist="platform/ios/build/Info-static.plist"
|
||||
temp_info_plist="platform/ios/build/Info.plist"
|
||||
# Move and configure the app plist
|
||||
temp_app_info_plist="platform/ios/build/Info-app.plist"
|
||||
|
||||
if [ ! -d platform/ios/build ]; then
|
||||
mkdir platform/ios/build
|
||||
fi
|
||||
|
||||
cp platform/ios/framework/Info-static.plist "$temp_info_static_plist"
|
||||
cp platform/ios/framework/Info.plist "$temp_info_plist"
|
||||
cp platform/ios/platform/ios/framework/Info-static.plist "$temp_info_static_plist"
|
||||
cp platform/ios/platform/ios/framework/Info.plist "$temp_info_plist"
|
||||
cp platform/ios/platform/ios/app/Info.plist "$temp_app_info_plist"
|
||||
|
||||
# Replace semver and hash
|
||||
plutil -replace MLNSemanticVersionString -string "$sem_version" "$temp_info_static_plist"
|
||||
plutil -replace MLNCommitHash -string "$hash" "$temp_info_static_plist"
|
||||
plutil -replace MLNSemanticVersionString -string "$sem_version" "$temp_info_plist"
|
||||
plutil -replace MLNCommitHash -string "$hash" "$temp_info_plist"
|
||||
|
||||
# Build parameters
|
||||
token_file=~/.maplibre
|
||||
token_file2=~/maplibre
|
||||
token="$(cat $token_file 2>/dev/null || cat $token_file2 2>/dev/null || echo $MLN_API_KEY)"
|
||||
flavor="legacy" # Renderer build flavor: legacy, drawable, split
|
||||
teamid="0000000000" # Provisioning profile team ID, required for targeting physical devices
|
||||
uuid="iOS Team Provisioning Profile: *" # provisioning profile name/UUID
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--flavor)
|
||||
shift
|
||||
flavor="$1"
|
||||
shift
|
||||
;;
|
||||
--teamid)
|
||||
shift
|
||||
teamid="$1"
|
||||
shift
|
||||
;;
|
||||
--profile-uuid)
|
||||
shift
|
||||
uuid="$1"
|
||||
shift
|
||||
;;
|
||||
--apikey)
|
||||
shift
|
||||
token="$1"
|
||||
shift
|
||||
;;
|
||||
-*|--*)
|
||||
echo "Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Insert API Key
|
||||
echo "Inserting MapLibre API key..."
|
||||
if [ "$token" ]; then
|
||||
plutil -replace MLNApiKey -string $token "$temp_app_info_plist"
|
||||
echo "API key insertion successful"
|
||||
else
|
||||
echo "Warning: Missing API key."
|
||||
fi
|
||||
|
||||
# Generate the team ID for Xcode device provisioning
|
||||
if [ ! -d platform/ios/bazel/__generated__ ]; then
|
||||
mkdir platform/ios/bazel/__generated__
|
||||
fi
|
||||
|
||||
cat > platform/ios/bazel/__generated__/provisioning_profile.bzl <<EOF
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_TEAM_ID = "$teamid"
|
||||
APPLE_MOBILE_PROVISIONING_PROFILE_UUID = "$uuid"
|
||||
EOF
|
||||
|
||||
echo "------ Building Maplibre version: $sem_version hash: $hash ------"
|
||||
|
||||
bazel run //platform/ios:xcodeproj
|
||||
# Generate the Xcode project
|
||||
# Example invocation: ./bazel-xcodeproj.sh flavor split teamid 1234567890
|
||||
# Find your team ID inside a .mobileprovision file or in your keychain (Apple development: your@email -> Get Info -> Organizational Unit)
|
||||
bazel run //platform/ios:xcodeproj --@rules_xcodeproj//xcodeproj:extra_common_flags="--//:renderer=$flavor --//:maplibre_platform=ios"
|
||||
|
||||
popd
|
||||
|
||||
Reference in New Issue
Block a user