@@ -107,6 +107,11 @@ struct PackageManifestBuilder {
107
107
// Add the generated content that defines the list of services to include
108
108
buildServiceTargets ( ) ,
109
109
" " ,
110
+ // Add the dependencies for the internal clients
111
+ buildInternalAWSSTSDependencies ( ) ,
112
+ buildInternalAWSSSODependencies ( ) ,
113
+ buildInternalAWSSSOOIDCDependencies ( ) ,
114
+ " " ,
110
115
]
111
116
return contents. joined ( separator: . newline)
112
117
}
@@ -139,10 +144,44 @@ struct PackageManifestBuilder {
139
144
/// This generates an array of strings, where the each item is a name of a service
140
145
/// and calls the `addServiceTarget` for each item.
141
146
private func buildServiceTargets( ) -> String {
147
+ guard !services. isEmpty else {
148
+ return " let serviceTargets: [String: [Target.Dependency]] = [:] "
149
+ }
142
150
var lines : [ String ] = [ ]
143
- lines += [ " let serviceTargets: [String] = [ " ]
144
- lines += services. map { " \( $0. name. wrappedInQuotes ( ) ) , " }
151
+ lines += [ " let serviceTargets: [String: [Target.Dependency]] = [ " ]
152
+ lines += services. map {
153
+ let jsonFilePath = " Sources/Services/ \( $0. name) /Dependencies.json "
154
+ let dependencies = clientDependencies ( service: $0, jsonFilePath: jsonFilePath)
155
+ return " \( $0. name. wrappedInQuotes ( ) ) : \( dependencies) , "
156
+ }
145
157
lines += [ " ] " ]
146
158
return lines. joined ( separator: . newline)
147
159
}
160
+
161
+ private func buildInternalAWSSTSDependencies( ) -> String {
162
+ buildInternalClientDependencies ( name: " AWSSTS " )
163
+ }
164
+
165
+ private func buildInternalAWSSSODependencies( ) -> String {
166
+ buildInternalClientDependencies ( name: " AWSSSO " )
167
+ }
168
+
169
+ private func buildInternalAWSSSOOIDCDependencies( ) -> String {
170
+ buildInternalClientDependencies ( name: " AWSSSOOIDC " )
171
+ }
172
+
173
+ private func buildInternalClientDependencies( name: String ) -> String {
174
+ let jsonFilePath = " Sources/Core/AWSSDKIdentity/InternalClients/Internal \( name) /Dependencies.json "
175
+ let service = Service ( name: name)
176
+ let dependencies = clientDependencies ( service: service, jsonFilePath: jsonFilePath)
177
+ return " let internal \( name) Dependencies: [Target.Dependency] = \( dependencies) "
178
+ }
179
+
180
+ private func clientDependencies( service: Service , jsonFilePath: String ) -> String {
181
+ let jsonFileData = FileManager . default. contents ( atPath: jsonFilePath) ?? Data ( " [] " . utf8)
182
+ let dependencies = try ! JSONDecoder ( ) . decode ( [ String ] . self, from: jsonFileData)
183
+ . filter { $0 != " SmithyTestUtil " } // links to test files only
184
+ return " [ " + dependencies. map { " . \( $0) " } . joined ( separator: " , " ) + " ] "
185
+ }
148
186
}
187
+
0 commit comments