File tree Expand file tree Collapse file tree 4 files changed +80
-1
lines changed
plugins/package-managers/swiftpm/src
assets/projects/synthetic
only-lockfile-v3-with-SPM-registry-dependency Expand file tree Collapse file tree 4 files changed +80
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ project :
3
+ id : " SwiftPM::src/funTest/assets/projects/synthetic/only-lockfile-v3-with-SPM-registry-dependency/Package.resolved:<REPLACE_REVISION>"
4
+ definition_file_path : " <REPLACE_DEFINITION_FILE_PATH>"
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 : " Swift::alamofire.alamofire:5.4.4"
22
+ packages :
23
+ - id : " Swift::alamofire.alamofire:5.4.4"
24
+ purl :
" pkg:swift/[email protected] "
25
+ declared_licenses : []
26
+ declared_licenses_processed : {}
27
+ description : " "
28
+ homepage_url : " "
29
+ binary_artifact :
30
+ url : " "
31
+ hash :
32
+ value : " "
33
+ algorithm : " "
34
+ source_artifact :
35
+ url : " "
36
+ hash :
37
+ value : " "
38
+ algorithm : " "
39
+ vcs :
40
+ type : " "
41
+ url : " "
42
+ revision : " "
43
+ path : " "
44
+ vcs_processed :
45
+ type : " "
46
+ url : " "
47
+ revision : " "
48
+ path : " "
Original file line number Diff line number Diff line change
1
+ {
2
+ "pins" : [
3
+ {
4
+ "identity" : " alamofire.alamofire" ,
5
+ "kind" : " registry" ,
6
+ "location" : " " ,
7
+ "state" : {
8
+ "version" : " 5.4.4"
9
+ }
10
+ }
11
+ ],
12
+ "version" : 3
13
+ }
Original file line number Diff line number Diff line change @@ -73,6 +73,19 @@ class SwiftPmFunTest : WordSpec({
73
73
}
74
74
}
75
75
76
+ " Analyzing a lockfile with a dependency loaded over SPM registry instead of source control" should {
77
+ " return the correct result" {
78
+ val definitionFile =
79
+ getAssetFile("projects/synthetic/only-lockfile-v3-with-SPM -registry-dependency/Package .resolved")
80
+ val expectedResultFile =
81
+ getAssetFile("projects/synthetic/expected-output-only-lockfile-v3-with-SPM -registry-dependency.yml")
82
+
83
+ val result = SwiftPmFactory .create().resolveSingleProject(definitionFile)
84
+
85
+ result.withInvariantIssues().toYaml() should matchExpectedResult(expectedResultFile, definitionFile)
86
+ }
87
+ }
88
+
76
89
" Analyzing a definition file with a sibling lockfile" should {
77
90
" return the correct result" {
78
91
val definitionFile = getAssetFile("projects/synthetic/project-with-lockfile/Package .swift")
Original file line number Diff line number Diff line change @@ -244,7 +244,12 @@ private fun PinV2.toId(): Identifier =
244
244
Identifier (
245
245
type = PACKAGE_TYPE ,
246
246
namespace = " " ,
247
- name = getCanonicalName(location),
247
+ // For SPM registry dependencies the `location` field is blank, so use the `identity` field instead.
248
+ name = if (kind == PinV2 .Kind .REGISTRY ) {
249
+ identity
250
+ } else {
251
+ getCanonicalName(location)
252
+ },
248
253
version = state?.run {
249
254
when {
250
255
! version.isNullOrBlank() -> version
You can’t perform that action at this time.
0 commit comments