Skip to content

Commit 554fdbd

Browse files
authored
Use use resource_bundle instead of resource in Core Podspec (#4731)
* Use use resource_bundle instead of resource in Core Podspec
1 parent 4b532fb commit 554fdbd

File tree

7 files changed

+86
-26
lines changed

7 files changed

+86
-26
lines changed

MapboxCoreNavigation.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
3737

3838
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
3939

40-
s.resources = ['Sources/MapboxCoreNavigation/Resources/*/*', 'Sources/MapboxCoreNavigation/Resources/*']
40+
s.resource_bundle = { 'MapboxCoreNavigationResources' => ['Sources/MapboxCoreNavigation/Resources/*/*', 'Sources/MapboxCoreNavigation/Resources/*'] }
4141

4242
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
4343

Sources/MapboxCoreNavigation/BundleAdditions.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ extension Bundle {
3232
get {
3333
#if SWIFT_PACKAGE
3434
return .module
35+
#elseif COCOAPODS
36+
let frameworkBundle = Bundle(for: RouteController.self)
37+
38+
guard let resourceBundleURL = frameworkBundle.url(
39+
forResource: "MapboxCoreNavigationResources", withExtension: "bundle")
40+
else { fatalError("MapboxCoreNavigationResources.bundle not found!") }
41+
42+
guard let resourceBundle = Bundle(url: resourceBundleURL)
43+
else { fatalError("Cannot access MapboxCoreNavigationResources.bundle!") }
44+
45+
return resourceBundle
3546
#else
3647
return Bundle(for: RouteController.self)
3748
#endif

Sources/MapboxNavigation/Bundle.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ extension Bundle {
1111
get {
1212
#if SWIFT_PACKAGE
1313
return .module
14-
#else
15-
var frameworkBundle = Bundle(for: NavigationViewController.self)
16-
14+
#elseif COCOAPODS
15+
let frameworkBundle = Bundle(for: NavigationViewController.self)
16+
1717
guard let resourceBundleURL = frameworkBundle.url(
1818
forResource: "MapboxNavigationResources", withExtension: "bundle")
1919
else { fatalError("MapboxNavigationResources.bundle not found!") }
@@ -22,6 +22,8 @@ extension Bundle {
2222
else { fatalError("Cannot access MapboxNavigationResources.bundle!") }
2323

2424
return resourceBundle
25+
#else
26+
return Bundle(for: NavigationViewController.self)
2527
#endif
2628
}
2729
}

Tests/CocoaPodsTest/PodInstall/PodInstall.xcodeproj/project.pbxproj

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -132,6 +132,7 @@
132132
352544D91E66623D004C8F1C /* Frameworks */,
133133
352544DA1E66623D004C8F1C /* Resources */,
134134
2C42AC3C47F2A0A83F753C88 /* [CP] Embed Pods Frameworks */,
135+
2C3768632CC931CD00C04A8A /* Apply Mapbox token */,
135136
);
136137
buildRules = (
137138
);
@@ -224,6 +225,27 @@
224225
/* End PBXResourcesBuildPhase section */
225226

226227
/* Begin PBXShellScriptBuildPhase section */
228+
2C3768632CC931CD00C04A8A /* Apply Mapbox token */ = {
229+
isa = PBXShellScriptBuildPhase;
230+
alwaysOutOfDate = 1;
231+
buildActionMask = 2147483647;
232+
files = (
233+
);
234+
inputFileListPaths = (
235+
);
236+
inputPaths = (
237+
"$(TARGET_BUILD_DIR)/$(INFOPLIST_PATH)",
238+
);
239+
name = "Apply Mapbox token";
240+
outputFileListPaths = (
241+
);
242+
outputPaths = (
243+
);
244+
runOnlyForDeploymentPostprocessing = 0;
245+
shellPath = /bin/sh;
246+
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${SRCROOT}/../../../scripts/apply_mapbox_token.sh\"\n";
247+
showEnvVarsInLog = 0;
248+
};
227249
2C42AC3C47F2A0A83F753C88 /* [CP] Embed Pods Frameworks */ = {
228250
isa = PBXShellScriptBuildPhase;
229251
buildActionMask = 2147483647;
@@ -438,7 +460,8 @@
438460
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
439461
MTL_ENABLE_DEBUG_INFO = NO;
440462
SDKROOT = iphoneos;
441-
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
463+
SWIFT_COMPILATION_MODE = wholemodule;
464+
SWIFT_OPTIMIZATION_LEVEL = "-O";
442465
SWIFT_VERSION = 5.0;
443466
TARGETED_DEVICE_FAMILY = "1,2";
444467
VALIDATE_PRODUCT = YES;
@@ -453,7 +476,10 @@
453476
DEVELOPMENT_TEAM = GJZR2MEM28;
454477
INFOPLIST_FILE = PodInstall/Info.plist;
455478
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
456-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
479+
LD_RUNPATH_SEARCH_PATHS = (
480+
"$(inherited)",
481+
"@executable_path/Frameworks",
482+
);
457483
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.navigation.PodInstall;
458484
PRODUCT_NAME = "$(TARGET_NAME)";
459485
};
@@ -467,7 +493,10 @@
467493
DEVELOPMENT_TEAM = GJZR2MEM28;
468494
INFOPLIST_FILE = PodInstall/Info.plist;
469495
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
470-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
496+
LD_RUNPATH_SEARCH_PATHS = (
497+
"$(inherited)",
498+
"@executable_path/Frameworks",
499+
);
471500
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.navigation.PodInstall;
472501
PRODUCT_NAME = "$(TARGET_NAME)";
473502
};
@@ -480,7 +509,11 @@
480509
BUNDLE_LOADER = "$(TEST_HOST)";
481510
DEVELOPMENT_TEAM = GJZR2MEM28;
482511
INFOPLIST_FILE = PodInstallTests/Info.plist;
483-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
512+
LD_RUNPATH_SEARCH_PATHS = (
513+
"$(inherited)",
514+
"@executable_path/Frameworks",
515+
"@loader_path/Frameworks",
516+
);
484517
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.navigation.PodInstallTests;
485518
PRODUCT_NAME = "$(TARGET_NAME)";
486519
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PodInstall.app/PodInstall";
@@ -494,7 +527,11 @@
494527
BUNDLE_LOADER = "$(TEST_HOST)";
495528
DEVELOPMENT_TEAM = GJZR2MEM28;
496529
INFOPLIST_FILE = PodInstallTests/Info.plist;
497-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
530+
LD_RUNPATH_SEARCH_PATHS = (
531+
"$(inherited)",
532+
"@executable_path/Frameworks",
533+
"@loader_path/Frameworks",
534+
);
498535
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.navigation.PodInstallTests;
499536
PRODUCT_NAME = "$(TARGET_NAME)";
500537
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PodInstall.app/PodInstall";

Tests/CocoaPodsTest/PodInstall/PodInstall/Info.plist

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
<string>1</string>
2121
<key>LSRequiresIPhoneOS</key>
2222
<true/>
23+
<key>MBXAccessToken</key>
24+
<string>YOUR_TOKEN</string>
25+
<key>NSLocationAlwaysUsageDescription</key>
26+
<string>Get user location</string>
27+
<key>NSLocationWhenInUseUsageDescription</key>
28+
<string>Location Usage Description</string>
29+
<key>UIBackgroundModes</key>
30+
<array>
31+
<string>audio</string>
32+
<string>processing</string>
33+
</array>
2334
<key>UILaunchStoryboardName</key>
2435
<string>LaunchScreen</string>
2536
<key>UIMainStoryboardFile</key>
@@ -41,7 +52,5 @@
4152
<string>UIInterfaceOrientationLandscapeLeft</string>
4253
<string>UIInterfaceOrientationLandscapeRight</string>
4354
</array>
44-
<key>NSLocationAlwaysUsageDescription</key>
45-
<string>Get user location</string>
4655
</dict>
4756
</plist>

Tests/CocoaPodsTest/PodInstall/PodInstall/ViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class ViewController: UIViewController {
99

1010
// Test that classes are accessible
1111
// and prevent comiler optimizations for unused imports.
12+
_ = Bundle.mapboxCoreNavigation
1213
_ = PassiveLocationManager()
1314
_ = NavigationMapView(frame: .zero)
1415
}

Tests/CocoaPodsTest/PodInstall/Podfile.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
PODS:
2-
- MapboxCommon (23.10.1)
3-
- MapboxCoreMaps (10.18.0):
4-
- MapboxCommon (~> 23.10)
2+
- MapboxCommon (23.11.0)
3+
- MapboxCoreMaps (10.19.1):
4+
- MapboxCommon (~> 23.11)
55
- MapboxCoreNavigation (2.19.0-beta.1):
66
- MapboxDirections (~> 2.14)
77
- MapboxNavigationNative (< 207.0.0, >= 206.0.1)
88
- MapboxDirections (2.14.0):
99
- Polyline (~> 5.0)
1010
- Turf (~> 2.8.0)
11-
- MapboxMaps (10.18.2):
12-
- MapboxCommon (= 23.10.1)
13-
- MapboxCoreMaps (= 10.18.0)
14-
- MapboxMobileEvents (= 1.0.10)
11+
- MapboxMaps (10.19.0):
12+
- MapboxCommon (= 23.11.0)
13+
- MapboxCoreMaps (= 10.19.1)
14+
- MapboxMobileEvents (= 2.0.0)
1515
- Turf (= 2.8.0)
16-
- MapboxMobileEvents (1.0.10)
16+
- MapboxMobileEvents (2.0.0)
1717
- MapboxNavigation (2.19.0-beta.1):
1818
- MapboxCoreNavigation (= 2.19.0-beta.1)
1919
- MapboxMaps (~> 10.18)
@@ -50,12 +50,12 @@ EXTERNAL SOURCES:
5050
:path: "../../../"
5151

5252
SPEC CHECKSUMS:
53-
MapboxCommon: 0ff437e44988da6856e280d00ffb266564ed0487
54-
MapboxCoreMaps: f1bd9405f5b9d3e343f2fe4138775299699a22fb
55-
MapboxCoreNavigation: 05b0fef0e17875b1077146db98e1d1f72ba35b3c
53+
MapboxCommon: 119f3759f7dc9457f0695848108ab323eb643cb4
54+
MapboxCoreMaps: ca17f67baced23f8c952166ac6314c35bad3f66c
55+
MapboxCoreNavigation: c26feb2d56acfdbde7ca237b8bb7a9c459d33b2a
5656
MapboxDirections: 3d468327d3e2ac52ae1be2176004976580cf6fd9
57-
MapboxMaps: e76b14f52c54c40b76ddecd04f40448e6f35a864
58-
MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6
57+
MapboxMaps: b7f29ec7c33f7dc6d2947c1148edce6db81db9a7
58+
MapboxMobileEvents: d044b9edbe0ec7df60f6c2c9634fe9a7f449266b
5959
MapboxNavigation: 08e931ce1894597f6b8e8241fb6794ffbbfd2a84
6060
MapboxNavigationNative: ef4ef55f669336b689a8941388a4b65796d1337b
6161
MapboxSpeech: cd25ef99c3a3d2e0da72620ff558276ea5991a77
@@ -65,4 +65,4 @@ SPEC CHECKSUMS:
6565

6666
PODFILE CHECKSUM: bde8103af0e9b326531ee57cf1fa935cbd5f2e18
6767

68-
COCOAPODS: 1.12.0
68+
COCOAPODS: 1.15.2

0 commit comments

Comments
 (0)