diff --git a/commands/compile/compile.go b/commands/compile/compile.go index cf6dadc75c0..0307f7c2d39 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -158,18 +158,16 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W builderCtx.ExecStdout = outStream builderCtx.ExecStderr = errStream builderCtx.SetLogger(i18n.LoggerToCustomStreams{Stdout: outStream, Stderr: errStream}) + + // if --preprocess or --show-properties were passed, we can stop here if req.GetShowProperties() { - err = builder.RunParseHardwareAndDumpBuildProperties(builderCtx) + return &rpc.CompileResp{}, builder.RunParseHardwareAndDumpBuildProperties(builderCtx) } else if req.GetPreprocess() { - if err = builder.RunPreprocess(builderCtx); err != nil { - return nil, fmt.Errorf("preprocessing sketch: %s", err) - } - return &rpc.CompileResp{}, nil - } else { - err = builder.RunBuilder(builderCtx) + return &rpc.CompileResp{}, builder.RunPreprocess(builderCtx) } - if err != nil { + // if it's a regular build, go on... + if err := builder.RunBuilder(builderCtx); err != nil { return nil, fmt.Errorf("build failed: %s", err) } diff --git a/legacy/builder/wipeout_build_path_if_build_options_changed.go b/legacy/builder/wipeout_build_path_if_build_options_changed.go index 3dca51365eb..beb59db76cd 100644 --- a/legacy/builder/wipeout_build_path_if_build_options_changed.go +++ b/legacy/builder/wipeout_build_path_if_build_options_changed.go @@ -49,7 +49,6 @@ func (s *WipeoutBuildPathIfBuildOptionsChanged) Run(ctx *types.Context) error { } buildOptionsJson := ctx.BuildOptionsJson previousBuildOptionsJson := ctx.BuildOptionsJsonPrevious - logger := ctx.GetLogger() var opts *properties.Map var prevOpts *properties.Map @@ -79,7 +78,9 @@ func (s *WipeoutBuildPathIfBuildOptionsChanged) Run(ctx *types.Context) error { } } - logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED) + // FIXME: this should go outside legacy and behind a `logrus` call so users can + // control when this should be printed. + // logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED) buildPath := ctx.BuildPath files, err := gohasissues.ReadDir(buildPath.String())