Skip to content

Commit 4bbd26a

Browse files
committed
fix(CocoaPods): Parse external sources from lock files
External sources can refer to unpublished packages for which `pod spec which` would fail like Unable to find a pod with name matching `^MLHudAlert$' as no metadata could be retrieved. Support this case by getting as much metadata as possible for such packages from the lock file itself. The added test is based on the files from [1], commit 8c0c913. [1]: https://github.com/youusername/magnetX Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent a2fa752 commit 4bbd26a

File tree

5 files changed

+397
-5
lines changed

5 files changed

+397
-5
lines changed
Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
---
2+
project:
3+
id: "CocoaPods::src/funTest/assets/projects/synthetic/external-sources/Podfile:"
4+
definition_file_path: "plugins/package-managers/cocoapods/src/funTest/assets/projects/synthetic/external-sources/Podfile"
5+
declared_licenses: []
6+
declared_licenses_processed: {}
7+
vcs:
8+
type: ""
9+
url: ""
10+
revision: ""
11+
path: ""
12+
vcs_processed:
13+
type: "Git"
14+
url: "<REPLACE_URL_PROCESSED>"
15+
revision: "<REPLACE_REVISION>"
16+
path: "<REPLACE_PATH>"
17+
homepage_url: ""
18+
scopes:
19+
- name: "dependencies"
20+
dependencies:
21+
- id: "Pod::AFNetworking:3.2.1"
22+
dependencies:
23+
- id: "Pod::AFNetworking/NSURLSession:3.2.1"
24+
dependencies:
25+
- id: "Pod::AFNetworking/Reachability:3.2.1"
26+
- id: "Pod::AFNetworking/Security:3.2.1"
27+
- id: "Pod::AFNetworking/Serialization:3.2.1"
28+
- id: "Pod::AFNetworking/Reachability:3.2.1"
29+
- id: "Pod::AFNetworking/Security:3.2.1"
30+
- id: "Pod::AFNetworking/Serialization:3.2.1"
31+
- id: "Pod::AFNetworking/UIKit:3.2.1"
32+
- id: "Pod::CocoaSecurity:1.2.4"
33+
- id: "Pod::MLHudAlert:0.0.4-3f23fa41632f8935fed028b04335576633ec53a2"
34+
- id: "Pod::Ono:2.1.1"
35+
packages:
36+
- id: "Pod::AFNetworking:3.2.1"
37+
purl: "pkg:cocoapods/[email protected]"
38+
declared_licenses:
39+
- "MIT"
40+
declared_licenses_processed:
41+
spdx_expression: "MIT"
42+
description: "A delightful iOS and OS X networking framework."
43+
homepage_url: "https://github.com/AFNetworking/AFNetworking"
44+
binary_artifact:
45+
url: ""
46+
hash:
47+
value: ""
48+
algorithm: ""
49+
source_artifact:
50+
url: ""
51+
hash:
52+
value: ""
53+
algorithm: ""
54+
vcs:
55+
type: "Git"
56+
url: "https://github.com/AFNetworking/AFNetworking.git"
57+
revision: "3.2.1"
58+
path: ""
59+
vcs_processed:
60+
type: "Git"
61+
url: "https://github.com/AFNetworking/AFNetworking.git"
62+
revision: "3.2.1"
63+
path: ""
64+
- id: "Pod::AFNetworking/NSURLSession:3.2.1"
65+
purl: "pkg:cocoapods/AFNetworking%[email protected]"
66+
declared_licenses:
67+
- "MIT"
68+
declared_licenses_processed:
69+
spdx_expression: "MIT"
70+
description: "A delightful iOS and OS X networking framework."
71+
homepage_url: "https://github.com/AFNetworking/AFNetworking"
72+
binary_artifact:
73+
url: ""
74+
hash:
75+
value: ""
76+
algorithm: ""
77+
source_artifact:
78+
url: ""
79+
hash:
80+
value: ""
81+
algorithm: ""
82+
vcs:
83+
type: "Git"
84+
url: "https://github.com/AFNetworking/AFNetworking.git"
85+
revision: "3.2.1"
86+
path: ""
87+
vcs_processed:
88+
type: "Git"
89+
url: "https://github.com/AFNetworking/AFNetworking.git"
90+
revision: "3.2.1"
91+
path: ""
92+
- id: "Pod::AFNetworking/Reachability:3.2.1"
93+
purl: "pkg:cocoapods/AFNetworking%[email protected]"
94+
declared_licenses:
95+
- "MIT"
96+
declared_licenses_processed:
97+
spdx_expression: "MIT"
98+
description: "A delightful iOS and OS X networking framework."
99+
homepage_url: "https://github.com/AFNetworking/AFNetworking"
100+
binary_artifact:
101+
url: ""
102+
hash:
103+
value: ""
104+
algorithm: ""
105+
source_artifact:
106+
url: ""
107+
hash:
108+
value: ""
109+
algorithm: ""
110+
vcs:
111+
type: "Git"
112+
url: "https://github.com/AFNetworking/AFNetworking.git"
113+
revision: "3.2.1"
114+
path: ""
115+
vcs_processed:
116+
type: "Git"
117+
url: "https://github.com/AFNetworking/AFNetworking.git"
118+
revision: "3.2.1"
119+
path: ""
120+
- id: "Pod::AFNetworking/Security:3.2.1"
121+
purl: "pkg:cocoapods/AFNetworking%[email protected]"
122+
declared_licenses:
123+
- "MIT"
124+
declared_licenses_processed:
125+
spdx_expression: "MIT"
126+
description: "A delightful iOS and OS X networking framework."
127+
homepage_url: "https://github.com/AFNetworking/AFNetworking"
128+
binary_artifact:
129+
url: ""
130+
hash:
131+
value: ""
132+
algorithm: ""
133+
source_artifact:
134+
url: ""
135+
hash:
136+
value: ""
137+
algorithm: ""
138+
vcs:
139+
type: "Git"
140+
url: "https://github.com/AFNetworking/AFNetworking.git"
141+
revision: "3.2.1"
142+
path: ""
143+
vcs_processed:
144+
type: "Git"
145+
url: "https://github.com/AFNetworking/AFNetworking.git"
146+
revision: "3.2.1"
147+
path: ""
148+
- id: "Pod::AFNetworking/Serialization:3.2.1"
149+
purl: "pkg:cocoapods/AFNetworking%[email protected]"
150+
declared_licenses:
151+
- "MIT"
152+
declared_licenses_processed:
153+
spdx_expression: "MIT"
154+
description: "A delightful iOS and OS X networking framework."
155+
homepage_url: "https://github.com/AFNetworking/AFNetworking"
156+
binary_artifact:
157+
url: ""
158+
hash:
159+
value: ""
160+
algorithm: ""
161+
source_artifact:
162+
url: ""
163+
hash:
164+
value: ""
165+
algorithm: ""
166+
vcs:
167+
type: "Git"
168+
url: "https://github.com/AFNetworking/AFNetworking.git"
169+
revision: "3.2.1"
170+
path: ""
171+
vcs_processed:
172+
type: "Git"
173+
url: "https://github.com/AFNetworking/AFNetworking.git"
174+
revision: "3.2.1"
175+
path: ""
176+
- id: "Pod::AFNetworking/UIKit:3.2.1"
177+
purl: "pkg:cocoapods/AFNetworking%[email protected]"
178+
declared_licenses:
179+
- "MIT"
180+
declared_licenses_processed:
181+
spdx_expression: "MIT"
182+
description: "A delightful iOS and OS X networking framework."
183+
homepage_url: "https://github.com/AFNetworking/AFNetworking"
184+
binary_artifact:
185+
url: ""
186+
hash:
187+
value: ""
188+
algorithm: ""
189+
source_artifact:
190+
url: ""
191+
hash:
192+
value: ""
193+
algorithm: ""
194+
vcs:
195+
type: "Git"
196+
url: "https://github.com/AFNetworking/AFNetworking.git"
197+
revision: "3.2.1"
198+
path: ""
199+
vcs_processed:
200+
type: "Git"
201+
url: "https://github.com/AFNetworking/AFNetworking.git"
202+
revision: "3.2.1"
203+
path: ""
204+
- id: "Pod::CocoaSecurity:1.2.4"
205+
purl: "pkg:cocoapods/[email protected]"
206+
declared_licenses:
207+
- "MIT"
208+
declared_licenses_processed:
209+
spdx_expression: "MIT"
210+
description: "Encrypt/Decrypt: AES. Hash: MD5, SHA(SHA1, SHA224, SHA256, SHA384,\
211+
\ SHA512). Encode/Decode: Base64, Hex."
212+
homepage_url: "https://github.com/kelp404/CocoaSecurity.git"
213+
binary_artifact:
214+
url: ""
215+
hash:
216+
value: ""
217+
algorithm: ""
218+
source_artifact:
219+
url: ""
220+
hash:
221+
value: ""
222+
algorithm: ""
223+
vcs:
224+
type: "Git"
225+
url: "https://github.com/kelp404/CocoaSecurity.git"
226+
revision: "1.2.4"
227+
path: ""
228+
vcs_processed:
229+
type: "Git"
230+
url: "https://github.com/kelp404/CocoaSecurity.git"
231+
revision: "1.2.4"
232+
path: ""
233+
- id: "Pod::MLHudAlert:0.0.4-3f23fa41632f8935fed028b04335576633ec53a2"
234+
purl: "pkg:cocoapods/[email protected]"
235+
declared_licenses: []
236+
declared_licenses_processed: {}
237+
description: ""
238+
homepage_url: "https://github.com/MacLabs/MLHudAlert.git"
239+
binary_artifact:
240+
url: ""
241+
hash:
242+
value: ""
243+
algorithm: ""
244+
source_artifact:
245+
url: ""
246+
hash:
247+
value: ""
248+
algorithm: ""
249+
vcs:
250+
type: "Git"
251+
url: "https://github.com/MacLabs/MLHudAlert.git"
252+
revision: "3f23fa41632f8935fed028b04335576633ec53a2"
253+
path: ""
254+
vcs_processed:
255+
type: "Git"
256+
url: "https://github.com/MacLabs/MLHudAlert.git"
257+
revision: "3f23fa41632f8935fed028b04335576633ec53a2"
258+
path: ""
259+
- id: "Pod::Ono:2.1.1"
260+
purl: "pkg:cocoapods/[email protected]"
261+
declared_licenses:
262+
- "MIT"
263+
declared_licenses_processed:
264+
spdx_expression: "MIT"
265+
description: "A sensible way to deal with XML & HTML."
266+
homepage_url: "https://github.com/mattt/Ono"
267+
binary_artifact:
268+
url: ""
269+
hash:
270+
value: ""
271+
algorithm: ""
272+
source_artifact:
273+
url: ""
274+
hash:
275+
value: ""
276+
algorithm: ""
277+
vcs:
278+
type: "Git"
279+
url: "https://github.com/mattt/Ono.git"
280+
revision: "2.1.1"
281+
path: ""
282+
vcs_processed:
283+
type: "Git"
284+
url: "https://github.com/mattt/Ono.git"
285+
revision: "2.1.1"
286+
path: ""
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
target 'magnetX' do
5+
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
6+
# use_frameworks!
7+
8+
# Pods for magnetX
9+
pod 'AFNetworking'
10+
pod 'Ono'
11+
pod 'CocoaSecurity'
12+
#pod 'SSZipArchive'
13+
pod 'MLHudAlert', git: 'https://github.com/MacLabs/MLHudAlert.git'
14+
end
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
PODS:
2+
- AFNetworking (3.2.1):
3+
- AFNetworking/NSURLSession (= 3.2.1)
4+
- AFNetworking/Reachability (= 3.2.1)
5+
- AFNetworking/Security (= 3.2.1)
6+
- AFNetworking/Serialization (= 3.2.1)
7+
- AFNetworking/UIKit (= 3.2.1)
8+
- AFNetworking/NSURLSession (3.2.1):
9+
- AFNetworking/Reachability
10+
- AFNetworking/Security
11+
- AFNetworking/Serialization
12+
- AFNetworking/Reachability (3.2.1)
13+
- AFNetworking/Security (3.2.1)
14+
- AFNetworking/Serialization (3.2.1)
15+
- CocoaSecurity (1.2.4)
16+
- MLHudAlert (0.0.4)
17+
- Ono (2.1.1)
18+
19+
DEPENDENCIES:
20+
- AFNetworking
21+
- CocoaSecurity
22+
- MLHudAlert (from `https://github.com/MacLabs/MLHudAlert.git`)
23+
- Ono
24+
25+
SPEC REPOS:
26+
https://github.com/cocoapods/specs.git:
27+
- AFNetworking
28+
- CocoaSecurity
29+
- Ono
30+
31+
EXTERNAL SOURCES:
32+
MLHudAlert:
33+
:git: https://github.com/MacLabs/MLHudAlert.git
34+
35+
CHECKOUT OPTIONS:
36+
MLHudAlert:
37+
:commit: 3f23fa41632f8935fed028b04335576633ec53a2
38+
:git: https://github.com/MacLabs/MLHudAlert.git
39+
40+
SPEC CHECKSUMS:
41+
AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
42+
CocoaSecurity: d288a6f87e0f363823d2cb83e753814a6944f71a
43+
MLHudAlert: e1654a23a4c1bffbf0fbcea2ef1c5f1c8c5dc896
44+
Ono: 13c25831a4a66b30df93bd1fa57cf70f13c62699
45+
46+
PODFILE CHECKSUM: 13d1396980f8da373e400ea9318d6521b938a692
47+
48+
COCOAPODS: 1.6.0

plugins/package-managers/cocoapods/src/funTest/kotlin/CocoaPodsFunTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ class CocoaPodsFunTest : WordSpec({
4949
result.toYaml() should matchExpectedResult(expectedResultFile, definitionFile)
5050
}
5151

52+
"determine dependencies from a Podfile with a external sources" {
53+
val definitionFile = getAssetFile("projects/synthetic/external-sources/Podfile")
54+
val expectedResultFile = getAssetFile("projects/synthetic/external-sources-expected-output.yml")
55+
56+
val result = create("CocoaPods").resolveSingleProject(definitionFile)
57+
58+
result.toYaml() should matchExpectedResult(expectedResultFile, definitionFile)
59+
}
60+
5261
"return no dependencies along with an issue if the lockfile is absent" {
5362
val definitionFile = getAssetFile("projects/synthetic/no-lockfile/Podfile")
5463
val expectedResultFile = getAssetFile("projects/synthetic/no-lockfile-expected-output.yml")

0 commit comments

Comments
 (0)