@@ -20,10 +20,23 @@ import (
20
20
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
21
21
)
22
22
23
+ // PlatformToRPCPlatformMetadata converts our internal structure to the RPC structure.
24
+ func PlatformToRPCPlatformMetadata (platform * cores.Platform ) * rpc.PlatformMetadata {
25
+ return & rpc.PlatformMetadata {
26
+ Id : platform .String (),
27
+ Maintainer : platform .Package .Maintainer ,
28
+ Website : platform .Package .WebsiteURL ,
29
+ Email : platform .Package .Email ,
30
+ ManuallyInstalled : platform .ManuallyInstalled ,
31
+ Deprecated : platform .Deprecated_ ,
32
+ Indexed : platform .Indexed ,
33
+ }
34
+ }
35
+
23
36
// PlatformReleaseToRPC converts our internal structure to the RPC structure.
24
37
// Note: this function does not touch the "Installed" field of rpc.Platform as it's not always clear that the
25
38
// platformRelease we're currently converting is actually installed.
26
- func PlatformReleaseToRPC (platformRelease * cores.PlatformRelease ) * rpc.Platform {
39
+ func PlatformReleaseToRPC (platformRelease * cores.PlatformRelease ) * rpc.PlatformRelease {
27
40
// If the boards are not installed yet, the `platformRelease.Boards` will be a zero length slice.
28
41
// In such case, we have to use the `platformRelease.BoardsManifest` instead.
29
42
// So that we can retrieve the name of the boards at least.
@@ -50,21 +63,14 @@ func PlatformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.Platform
50
63
}
51
64
}
52
65
53
- result := & rpc.Platform {
54
- Id : platformRelease .Platform .String (),
55
- Name : platformRelease .Platform .Name ,
56
- Maintainer : platformRelease .Platform .Package .Maintainer ,
57
- Website : platformRelease .Platform .Package .WebsiteURL ,
58
- Email : platformRelease .Platform .Package .Email ,
59
- Help : & rpc.HelpResources {Online : platformRelease .Platform .Package .Help .Online },
60
- Boards : boards ,
61
- Latest : platformRelease .Version .String (),
62
- ManuallyInstalled : platformRelease .Platform .ManuallyInstalled ,
63
- Deprecated : platformRelease .Platform .Deprecated ,
64
- Type : []string {platformRelease .Platform .Category },
65
- Indexed : platformRelease .Platform .Indexed ,
66
- MissingMetadata : ! platformRelease .HasMetadata (),
66
+ return & rpc.PlatformRelease {
67
+ Name : platformRelease .Name ,
68
+ Help : & rpc.HelpResources {Online : platformRelease .Platform .Package .Help .Online },
69
+ Boards : boards ,
70
+ Version : platformRelease .Version .String (),
71
+ Installed : platformRelease .IsInstalled (),
72
+ MissingMetadata : ! platformRelease .HasMetadata (),
73
+ Type : []string {platformRelease .Category },
74
+ Deprecated : platformRelease .Deprecated ,
67
75
}
68
-
69
- return result
70
76
}
0 commit comments