Skip to content

compile --show-properties now correctly output the result in text and JSON format #2035

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

Merged
merged 7 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved the direct output of build properties to commands.Compile
  • Loading branch information
cmaglie committed Jan 17, 2023
commit cf38a96a887c6c54f85acbc8d47292c63194dade
7 changes: 7 additions & 0 deletions commands/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
if compileErr != nil {
compileErr = &arduino.CompileFailedError{Message: err.Error()}
}
if buildProperties := builderCtx.BuildProperties; buildProperties != nil {
keys := buildProperties.Keys()
sort.Strings(keys)
for _, key := range keys {
outStream.Write([]byte(fmt.Sprintln(key + "=" + buildProperties.Get(key))))
}
}
return r, compileErr
} else if req.GetPreprocess() {
compileErr := builder.RunPreprocess(builderCtx)
Expand Down
27 changes: 8 additions & 19 deletions legacy/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,6 @@ func (s *Preprocess) Run(ctx *types.Context) error {
return nil
}

type ParseHardwareAndDumpBuildProperties struct{}

func (s *ParseHardwareAndDumpBuildProperties) Run(ctx *types.Context) error {
if ctx.BuildPath == nil {
ctx.BuildPath = sketch.GenBuildPath(ctx.SketchLocation)
}

commands := []types.Command{
&ContainerSetupHardwareToolsLibsSketchAndProps{},

&DumpBuildProperties{},
}

return runCommands(ctx, commands)
}

func runCommands(ctx *types.Context, commands []types.Command) error {
ctx.Progress.AddSubSteps(len(commands))
defer ctx.Progress.RemoveSubSteps()
Expand All @@ -203,9 +187,14 @@ func RunBuilder(ctx *types.Context) error {
return command.Run(ctx)
}

func RunParseHardwareAndDumpBuildProperties(ctx *types.Context) error {
command := ParseHardwareAndDumpBuildProperties{}
return command.Run(ctx)
func RunParseHardware(ctx *types.Context) error {
if ctx.BuildPath == nil {
ctx.BuildPath = sketch.GenBuildPath(ctx.SketchLocation)
}
commands := []types.Command{
&ContainerSetupHardwareToolsLibsSketchAndProps{},
}
return runCommands(ctx, commands)
}

func RunPreprocess(ctx *types.Context) error {
Expand Down
38 changes: 0 additions & 38 deletions legacy/builder/dump_build_properties.go

This file was deleted.