@@ -160,6 +160,52 @@ type Library struct {
160
160
InDevelopment bool `json:"in_development,omitempty"`
161
161
}
162
162
163
+ func NewLibrary (l * rpc.Library ) * Library {
164
+ if l == nil {
165
+ return nil
166
+ }
167
+ libraryPropsMap := orderedmap .New [string , string ]()
168
+ for k , v := range l .GetProperties () {
169
+ libraryPropsMap .Set (k , v )
170
+ }
171
+ libraryPropsMap .SortStableKeys (cmp .Compare )
172
+
173
+ libraryCompatibleWithMap := orderedmap .New [string , bool ]()
174
+ for k , v := range l .GetCompatibleWith () {
175
+ libraryCompatibleWithMap .Set (k , v )
176
+ }
177
+ libraryCompatibleWithMap .SortStableKeys (cmp .Compare )
178
+
179
+ return & Library {
180
+ Name : l .GetName (),
181
+ Author : l .GetAuthor (),
182
+ Maintainer : l .GetMaintainer (),
183
+ Sentence : l .GetSentence (),
184
+ Paragraph : l .GetParagraph (),
185
+ Website : l .GetWebsite (),
186
+ Category : l .GetCategory (),
187
+ Architectures : l .GetArchitectures (),
188
+ Types : l .GetTypes (),
189
+ InstallDir : l .GetInstallDir (),
190
+ SourceDir : l .GetSourceDir (),
191
+ UtilityDir : l .GetUtilityDir (),
192
+ ContainerPlatform : l .GetContainerPlatform (),
193
+ DotALinkage : l .GetDotALinkage (),
194
+ Precompiled : l .GetPrecompiled (),
195
+ LdFlags : l .GetLdFlags (),
196
+ IsLegacy : l .GetIsLegacy (),
197
+ Version : l .GetVersion (),
198
+ License : l .GetLicense (),
199
+ Properties : libraryPropsMap ,
200
+ Location : LibraryLocation (l .GetLocation ().String ()),
201
+ Layout : LibraryLayout (l .GetLayout ().String ()),
202
+ Examples : l .GetExamples (),
203
+ ProvidesIncludes : l .GetProvidesIncludes (),
204
+ CompatibleWith : libraryCompatibleWithMap ,
205
+ InDevelopment : l .GetInDevelopment (),
206
+ }
207
+ }
208
+
163
209
type LibraryRelease struct {
164
210
Author string `json:"author,omitempty"`
165
211
Version string `json:"version,omitempty"`
@@ -211,47 +257,8 @@ type LibraryDependency struct {
211
257
}
212
258
213
259
func NewInstalledLibraryResult (l * rpc.InstalledLibrary ) * InstalledLibrary {
214
- libraryPropsMap := orderedmap .New [string , string ]()
215
- for k , v := range l .GetLibrary ().GetProperties () {
216
- libraryPropsMap .Set (k , v )
217
- }
218
- libraryPropsMap .SortStableKeys (cmp .Compare )
219
-
220
- libraryCompatibleWithMap := orderedmap .New [string , bool ]()
221
- for k , v := range l .GetLibrary ().GetCompatibleWith () {
222
- libraryCompatibleWithMap .Set (k , v )
223
- }
224
- libraryCompatibleWithMap .SortStableKeys (cmp .Compare )
225
-
226
260
return & InstalledLibrary {
227
- Library : & Library {
228
- Name : l .GetLibrary ().GetName (),
229
- Author : l .GetLibrary ().GetAuthor (),
230
- Maintainer : l .GetLibrary ().GetMaintainer (),
231
- Sentence : l .GetLibrary ().GetSentence (),
232
- Paragraph : l .GetLibrary ().GetParagraph (),
233
- Website : l .GetLibrary ().GetWebsite (),
234
- Category : l .GetLibrary ().GetCategory (),
235
- Architectures : l .GetLibrary ().GetArchitectures (),
236
- Types : l .GetLibrary ().GetTypes (),
237
- InstallDir : l .GetLibrary ().GetInstallDir (),
238
- SourceDir : l .GetLibrary ().GetSourceDir (),
239
- UtilityDir : l .GetLibrary ().GetUtilityDir (),
240
- ContainerPlatform : l .GetLibrary ().GetContainerPlatform (),
241
- DotALinkage : l .GetLibrary ().GetDotALinkage (),
242
- Precompiled : l .GetLibrary ().GetPrecompiled (),
243
- LdFlags : l .GetLibrary ().GetLdFlags (),
244
- IsLegacy : l .GetLibrary ().GetIsLegacy (),
245
- Version : l .GetLibrary ().GetVersion (),
246
- License : l .GetLibrary ().GetLicense (),
247
- Properties : libraryPropsMap ,
248
- Location : LibraryLocation (l .GetLibrary ().GetLocation ().String ()),
249
- Layout : LibraryLayout (l .GetLibrary ().GetLayout ().String ()),
250
- Examples : l .GetLibrary ().GetExamples (),
251
- ProvidesIncludes : l .GetLibrary ().GetProvidesIncludes (),
252
- CompatibleWith : libraryCompatibleWithMap ,
253
- InDevelopment : l .GetLibrary ().GetInDevelopment (),
254
- },
261
+ Library : NewLibrary (l .GetLibrary ()),
255
262
Release : NewLibraryRelease (l .GetRelease ()),
256
263
}
257
264
}
0 commit comments