@@ -65,50 +65,64 @@ extension DestinationCommand {
65
65
rootPath: bundlePath
66
66
)
67
67
68
- for (artifactID, artifactMetadata) in parsedManifest. artifacts
69
- where artifactMetadata. type == . crossCompilationDestination {
70
- for variant in artifactMetadata. variants {
71
- let destinationJSONPath = try bundlePath
72
- . appending ( RelativePath ( validating: variant. path) )
73
- . appending ( component: " destination.json " )
68
+ try parsedManifest. printValidatedArtifactIDs (
69
+ bundlePath: bundlePath,
70
+ fileSystem: fileSystem,
71
+ observabilityScope: observabilityScope
72
+ )
73
+ } catch {
74
+ observabilityScope. emit (
75
+ . warning(
76
+ " Couldn't parse `info.json` manifest of a destination bundle at \( bundlePath) : \( error) "
77
+ )
78
+ )
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
74
84
75
- guard fileSystem. exists ( destinationJSONPath) else {
76
- observabilityScope. emit (
77
- . warning(
78
- """
79
- Destination metadata file not found at \(
80
- destinationJSONPath
81
- ) for a variant of artifact \( artifactID)
82
- """
83
- )
84
- )
85
+ private extension ArtifactsArchiveMetadata {
86
+ func printValidatedArtifactIDs(
87
+ bundlePath: AbsolutePath ,
88
+ fileSystem: FileSystem ,
89
+ observabilityScope: ObservabilityScope
90
+ ) throws {
91
+ for (artifactID, artifactMetadata) in artifacts
92
+ where artifactMetadata. type == . crossCompilationDestination {
93
+ for variant in artifactMetadata. variants {
94
+ let destinationJSONPath = try bundlePath
95
+ . appending ( RelativePath ( validating: variant. path) )
96
+ . appending ( component: " destination.json " )
85
97
86
- continue
87
- }
98
+ guard fileSystem. exists ( destinationJSONPath) else {
99
+ observabilityScope. emit (
100
+ . warning(
101
+ """
102
+ Destination metadata file not found at \(
103
+ destinationJSONPath
104
+ ) for a variant of artifact \( artifactID)
105
+ """
106
+ )
107
+ )
88
108
89
- do {
90
- _ = try Destination (
91
- fromFile: destinationJSONPath, fileSystem: fileSystem
92
- )
93
- } catch {
94
- observabilityScope. emit (
95
- . warning(
96
- " Couldn't parse destination metadata at \( destinationJSONPath) : \( error) "
97
- )
98
- )
99
- }
100
- }
109
+ continue
110
+ }
101
111
102
- print ( artifactID)
103
- }
112
+ do {
113
+ _ = try Destination (
114
+ fromFile: destinationJSONPath, fileSystem: fileSystem
115
+ )
104
116
} catch {
105
117
observabilityScope. emit (
106
118
. warning(
107
- " Couldn't parse `info.json` manifest of a destination bundle at \( bundlePath ) : \( error) "
119
+ " Couldn't parse destination metadata at \( destinationJSONPath ) : \( error) "
108
120
)
109
121
)
110
122
}
111
123
}
124
+
125
+ print ( artifactID)
112
126
}
113
127
}
114
128
}
0 commit comments