From 25c85cb3cb1c582bf4b3e1fa9cc68978c1ac9b2f Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Thu, 8 Aug 2019 11:12:47 +0200 Subject: [PATCH 1/3] do not expect binary artifacts when preprocess or show-properties --- commands/compile/compile.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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) } From e26f82fa327fa6a53a3772b47c4296895e3cc797 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Thu, 8 Aug 2019 15:22:28 +0200 Subject: [PATCH 2/3] remove noisy line --- legacy/builder/wipeout_build_path_if_build_options_changed.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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..6bb276b2147 100644 --- a/legacy/builder/wipeout_build_path_if_build_options_changed.go +++ b/legacy/builder/wipeout_build_path_if_build_options_changed.go @@ -79,7 +79,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()) From 4b499db57e389d4b5519a564ffde9820d6926e24 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Thu, 8 Aug 2019 15:26:01 +0200 Subject: [PATCH 3/3] forgot --- legacy/builder/wipeout_build_path_if_build_options_changed.go | 1 - 1 file changed, 1 deletion(-) 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 6bb276b2147..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