The Wayback Machine - https://web.archive.org/web/20211231042914/https://github.com/arduino/arduino-cli/pull/1608/files
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report board platform and build platform on compile JSON output #1608

Merged
merged 2 commits into from Dec 29, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -23,6 +23,7 @@ import (

"github.com/arduino/arduino-cli/arduino/resources"
"github.com/arduino/arduino-cli/i18n"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
paths "github.com/arduino/go-paths-helper"
properties "github.com/arduino/go-properties-orderedmap"
semver "go.bug.st/relaxed-semver"
@@ -342,6 +343,14 @@ func (release *PlatformRelease) String() string {
return release.Platform.String() + "@" + version
}

// ToRPCPlatformReference creates a gRPC PlatformReference message out of this PlatformRelease
func (release *PlatformRelease) ToRPCPlatformReference() *rpc.PlatformReference {
return &rpc.PlatformReference{
Id: release.Platform.String(),
Version: release.Version.String(),
}
}

// MarshalJSON provides a more user friendly serialization for
// PlatformRelease objects.
func (release *PlatformRelease) MarshalJSON() ([]byte, error) {
@@ -217,6 +217,12 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
if p := builderCtx.BuildPath; p != nil {
r.BuildPath = p.String()
}
if pl := builderCtx.TargetPlatform; pl != nil {
r.BoardPlatform = pl.ToRPCPlatformReference()
}
if pl := builderCtx.ActualPlatform; pl != nil {
r.BuildPlatform = pl.ToRPCPlatformReference()
}
}()

// if --preprocess or --show-properties were passed, we can stop here
@@ -291,11 +297,11 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
}
importedLibs = append(importedLibs, rpcLib)
}
r.UsedLibraries = importedLibs

r.ExecutableSectionsSize = builderCtx.ExecutableSectionsSize.ToRPCExecutableSectionSizeArray()

logrus.Tracef("Compile %s for %s successful", sk.Name, fqbnIn)

return &rpc.CompileResponse{
UsedLibraries: importedLibs,
ExecutableSectionsSize: builderCtx.ExecutableSectionsSize.ToRPCExecutableSectionSizeArray(),
}, nil
return r, nil
}

Some generated files are not rendered by default. Learn more.