Skip to content

Commit 8a466a3

Browse files
authored
Fix PodBuildSpec creation when PodSpec has more than 2 level of subspecs (#803)
* Fix PodBuildSpec creation when PodSpec has more than 2 level of subspecs * Fix test name
1 parent 112439c commit 8a466a3

4 files changed

Lines changed: 150 additions & 1 deletion

File tree

server/src/main/java/com/defold/extender/services/cocoapods/CocoaPodsService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,11 @@ public ResolvedPods resolveDependencies(PlatformConfig config, ExtenderBuildStat
421421

422422
PodBuildSpec buildSpec = null;
423423
if (!tmpRegistry.containsKey(podName)) {
424-
buildSpec = new PodBuildSpec(args, podSpec.parentSpec != null ? podSpec.parentSpec : podSpec);
424+
PodSpec mainSpec = podSpec;
425+
while (mainSpec.parentSpec != null) {
426+
mainSpec = mainSpec.parentSpec;
427+
}
428+
buildSpec = new PodBuildSpec(args, mainSpec);
425429
tmpRegistry.put(podName, buildSpec);
426430
pods.add(buildSpec);
427431
} else {

server/src/test/java/com/defold/extender/services/cocoapods/PodBuildSpecTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.defold.extender.services.cocoapods;
22

3+
import static org.junit.jupiter.api.Assertions.assertEquals;
34
import static org.junit.jupiter.api.Assertions.assertTrue;
45

56
import java.io.File;
@@ -102,4 +103,29 @@ public void testCompilationFlags() throws IOException, ExtenderException {
102103
assertTrue(buildSpec.flags.swift.contains(String.format("-I%s/Sentry/Sources/Sentry/include", this.podsDir.toString())));
103104
}
104105

106+
@Test
107+
public void testNestedPodSpecName() throws IOException, ExtenderException {
108+
String jsonSpec = Files.readString(Path.of("test-data/pod_specs/YandexMobileMetrica.json"));
109+
XCConfigParser parser = new XCConfigParser(this.buildDir, this.podsDir, PodUtils.Platform.IPHONEOS, "Debug", "arm64");
110+
File sentryTargetFolder = Path.of(this.podsDir.toString(), "Target Support Files", "YandexMobileMetrica").toFile();
111+
sentryTargetFolder.mkdirs();
112+
Files.copy(Path.of("test-data/xcconfigs/YandexMobileMetrica.xcconfig"), Path.of(sentryTargetFolder.toString(), "YandexMobileMetrica.debug.xcconfig"), StandardCopyOption.REPLACE_EXISTING);
113+
114+
PodSpec podSpec = PodSpecParser.createPodSpec(PodSpecParser.parseJson(jsonSpec), PodUtils.Platform.IPHONEOS, null);
115+
CocoaPodsServiceBuildState cocoapodsState = new CocoaPodsServiceBuildState();
116+
cocoapodsState.workingDir = this.workingDir;
117+
cocoapodsState.podsDir = this.podsDir;
118+
cocoapodsState.selectedPlatform = PodUtils.Platform.IPHONEOS;
119+
120+
CreateBuildSpecArgs args = new CreateBuildSpecArgs.Builder()
121+
.setConfigParser(parser)
122+
.setCocoapodsBuildState(cocoapodsState)
123+
.setJobContext(this.jobContext)
124+
.build();
125+
args.buildDir = this.buildDir;
126+
args.configuration = "Debug";
127+
128+
PodBuildSpec buildSpec = new PodBuildSpec(args, podSpec);
129+
assertEquals(buildSpec.name, "YandexMobileMetrica");
130+
}
105131
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"name": "YandexMobileMetrica",
3+
"version": "4.5.2",
4+
"summary": "This library is designed to be a part of mobile apps and provide app usage stats to Yandex AppMetrica",
5+
"homepage": "https://appmetrica.yandex.com/",
6+
"license": {
7+
"type": "PROPRIETARY",
8+
"file": "LICENSE.md"
9+
},
10+
"authors": {
11+
"Yandex LLC": "appmetrica@yandex-team.com"
12+
},
13+
"source": {
14+
"http": "https://storage.mds.yandex.net/get-appmetrica-mobile-sdk/175948/YandexMobileMetrica-4.5.2-ios-d70f8cb3-2746-4c3d-aa5f-dcd6acaaa5d8.zip",
15+
"sha1": "2b015941841fca10652cc1dc38a4cda3687c6bce"
16+
},
17+
"platforms": {
18+
"ios": "9.0",
19+
"tvos": "9.0"
20+
},
21+
"libraries": [
22+
"c++",
23+
"z",
24+
"sqlite3"
25+
],
26+
"frameworks": [
27+
"UIKit",
28+
"Foundation",
29+
"CoreLocation",
30+
"CoreGraphics",
31+
"AdSupport",
32+
"SystemConfiguration"
33+
],
34+
"ios": {
35+
"frameworks": [
36+
"CoreTelephony",
37+
"WebKit"
38+
],
39+
"weak_frameworks": [
40+
41+
]
42+
},
43+
"requires_arc": true,
44+
"default_subspecs": "Static",
45+
"subspecs": [
46+
{
47+
"name": "Static",
48+
"subspecs": [
49+
{
50+
"name": "Core",
51+
"preserve_paths": [
52+
"static/YandexMobileMetrica.xcframework"
53+
],
54+
"vendored_frameworks": "static/YandexMobileMetrica.xcframework",
55+
"source_files": "static/YandexMobileMetrica.xcframework/**/YandexMobileMetrica.framework/Versions/A/Headers/*.h",
56+
"public_header_files": "static/YandexMobileMetrica.xcframework/**/YandexMobileMetrica.framework/Versions/A/Headers/*.h"
57+
},
58+
{
59+
"name": "Crashes",
60+
"preserve_paths": [
61+
"static/YandexMobileMetricaCrashes.xcframework",
62+
"helper"
63+
],
64+
"vendored_frameworks": "static/YandexMobileMetricaCrashes.xcframework",
65+
"source_files": "static/YandexMobileMetricaCrashes.xcframework/**/YandexMobileMetricaCrashes.framework/Versions/A/Headers/*.h",
66+
"public_header_files": "static/YandexMobileMetricaCrashes.xcframework/**/YandexMobileMetricaCrashes.framework/Versions/A/Headers/*.h",
67+
"dependencies": {
68+
"YandexMobileMetrica/Static/Core": [
69+
70+
]
71+
}
72+
}
73+
]
74+
},
75+
{
76+
"name": "Dynamic",
77+
"subspecs": [
78+
{
79+
"name": "Core",
80+
"preserve_paths": [
81+
"dynamic/YandexMobileMetrica.xcframework"
82+
],
83+
"vendored_frameworks": "dynamic/YandexMobileMetrica.xcframework",
84+
"source_files": "dynamic/YandexMobileMetrica.xcframework/**/YandexMobileMetrica.framework/Headers/*.h",
85+
"public_header_files": "dynamic/YandexMobileMetrica.xcframework/**/YandexMobileMetrica.framework/Headers/*.h"
86+
},
87+
{
88+
"name": "Crashes",
89+
"preserve_paths": [
90+
"dynamic/YandexMobileMetricaCrashes.xcframework",
91+
"helper"
92+
],
93+
"vendored_frameworks": "dynamic/YandexMobileMetricaCrashes.xcframework",
94+
"source_files": "dynamic/YandexMobileMetricaCrashes.xcframework/**/YandexMobileMetricaCrashes.framework/Headers/*.h",
95+
"public_header_files": "dynamic/YandexMobileMetricaCrashes.xcframework/**/YandexMobileMetricaCrashes.framework/Headers/*.h",
96+
"dependencies": {
97+
"YandexMobileMetrica/Dynamic/Core": [
98+
99+
]
100+
}
101+
}
102+
]
103+
}
104+
]
105+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2+
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YandexMobileMetrica
3+
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/YandexMobileMetrica/static" "${PODS_XCFRAMEWORKS_BUILD_DIR}/YandexMobileMetrica/Static/Core" "${PODS_XCFRAMEWORKS_BUILD_DIR}/YandexMobileMetrica/Static/Crashes"
4+
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
5+
OTHER_LDFLAGS = $(inherited) -l"c++" -l"sqlite3" -l"z" -framework "AdSupport" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony" -framework "Foundation" -framework "SystemConfiguration" -framework "UIKit" -framework "WebKit"
6+
PODS_BUILD_DIR = ${BUILD_DIR}
7+
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8+
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
9+
PODS_ROOT = ${SRCROOT}
10+
PODS_TARGET_SRCROOT = ${PODS_ROOT}/YandexMobileMetrica
11+
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
12+
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
13+
SKIP_INSTALL = YES
14+
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES

0 commit comments

Comments
 (0)