Skip to content

Commit 4fbdb7e

Browse files
fixup mapper compile
1 parent 8e9893a commit 4fbdb7e

File tree

1 file changed

+72
-0
lines changed
  • internal/cli/feedback/result

1 file changed

+72
-0
lines changed

internal/cli/feedback/result/rpc.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,3 +811,75 @@ func NewMonitorPortSettingDescriptor(m *rpc.MonitorPortSettingDescriptor) *Monit
811811
Value: m.GetValue(),
812812
}
813813
}
814+
815+
type CompileResponse struct {
816+
OutStream []byte `json:"out_stream,omitempty"`
817+
ErrStream []byte `json:"err_stream,omitempty"`
818+
BuildPath string `json:"build_path,omitempty"`
819+
UsedLibraries []*Library `json:"used_libraries,omitempty"`
820+
ExecutableSectionsSize []*ExecutableSectionSize `json:"executable_sections_size,omitempty"`
821+
BoardPlatform *InstalledPlatformReference `json:"board_platform,omitempty"`
822+
BuildPlatform *InstalledPlatformReference `json:"build_platform,omitempty"`
823+
BuildProperties []string `json:"build_properties,omitempty"`
824+
}
825+
826+
func NewCompileResponse(c *rpc.CompileResponse) *CompileResponse {
827+
if c == nil {
828+
return nil
829+
}
830+
usedLibs := make([]*Library, len(c.GetUsedLibraries()))
831+
for i, v := range c.GetUsedLibraries() {
832+
usedLibs[i] = NewLibrary(v)
833+
}
834+
executableSectionsSizes := make([]*ExecutableSectionSize, len(c.GetExecutableSectionsSize()))
835+
for i, v := range c.GetExecutableSectionsSize() {
836+
executableSectionsSizes[i] = NewExecutableSectionSize(v)
837+
}
838+
839+
return &CompileResponse{
840+
OutStream: c.GetOutStream(),
841+
ErrStream: c.GetErrStream(),
842+
BuildPath: c.GetBuildPath(),
843+
UsedLibraries: usedLibs,
844+
ExecutableSectionsSize: executableSectionsSizes,
845+
BoardPlatform: &InstalledPlatformReference{},
846+
BuildPlatform: &InstalledPlatformReference{},
847+
BuildProperties: c.GetBuildProperties(),
848+
}
849+
}
850+
851+
type ExecutableSectionSize struct {
852+
Name string `json:"name,omitempty"`
853+
Size int64 `json:"size,omitempty"`
854+
MaxSize int64 `json:"max_size,omitempty"`
855+
}
856+
857+
func NewExecutableSectionSize(s *rpc.ExecutableSectionSize) *ExecutableSectionSize {
858+
if s == nil {
859+
return nil
860+
}
861+
return &ExecutableSectionSize{
862+
Name: s.GetName(),
863+
Size: s.GetSize(),
864+
MaxSize: s.GetMaxSize(),
865+
}
866+
}
867+
868+
type InstalledPlatformReference struct {
869+
Id string `json:"id,omitempty"`
870+
Version string `json:"version,omitempty"`
871+
InstallDir string `json:"install_dir,omitempty"`
872+
PackageUrl string `json:"package_url,omitempty"`
873+
}
874+
875+
func NewInstalledPlatformReference(r *rpc.InstalledPlatformReference) *InstalledPlatformReference {
876+
if r == nil {
877+
return nil
878+
}
879+
return &InstalledPlatformReference{
880+
Id: r.GetId(),
881+
Version: r.GetVersion(),
882+
InstallDir: r.GetInstallDir(),
883+
PackageUrl: r.GetPackageUrl(),
884+
}
885+
}

0 commit comments

Comments
 (0)