Skip to content

Commit d81cbbf

Browse files
authored
Fix compile error when --preprocess or --show-properties were passed (#331)
* do not expect binary artifacts when preprocess or show-properties * remove noisy line
1 parent f2d14b2 commit d81cbbf

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Diff for: commands/compile/compile.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,16 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
158158
builderCtx.ExecStdout = outStream
159159
builderCtx.ExecStderr = errStream
160160
builderCtx.SetLogger(i18n.LoggerToCustomStreams{Stdout: outStream, Stderr: errStream})
161+
162+
// if --preprocess or --show-properties were passed, we can stop here
161163
if req.GetShowProperties() {
162-
err = builder.RunParseHardwareAndDumpBuildProperties(builderCtx)
164+
return &rpc.CompileResp{}, builder.RunParseHardwareAndDumpBuildProperties(builderCtx)
163165
} else if req.GetPreprocess() {
164-
if err = builder.RunPreprocess(builderCtx); err != nil {
165-
return nil, fmt.Errorf("preprocessing sketch: %s", err)
166-
}
167-
return &rpc.CompileResp{}, nil
168-
} else {
169-
err = builder.RunBuilder(builderCtx)
166+
return &rpc.CompileResp{}, builder.RunPreprocess(builderCtx)
170167
}
171168

172-
if err != nil {
169+
// if it's a regular build, go on...
170+
if err := builder.RunBuilder(builderCtx); err != nil {
173171
return nil, fmt.Errorf("build failed: %s", err)
174172
}
175173

Diff for: legacy/builder/wipeout_build_path_if_build_options_changed.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func (s *WipeoutBuildPathIfBuildOptionsChanged) Run(ctx *types.Context) error {
4949
}
5050
buildOptionsJson := ctx.BuildOptionsJson
5151
previousBuildOptionsJson := ctx.BuildOptionsJsonPrevious
52-
logger := ctx.GetLogger()
5352

5453
var opts *properties.Map
5554
var prevOpts *properties.Map
@@ -79,7 +78,9 @@ func (s *WipeoutBuildPathIfBuildOptionsChanged) Run(ctx *types.Context) error {
7978
}
8079
}
8180

82-
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED)
81+
// FIXME: this should go outside legacy and behind a `logrus` call so users can
82+
// control when this should be printed.
83+
// logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED)
8384

8485
buildPath := ctx.BuildPath
8586
files, err := gohasissues.ReadDir(buildPath.String())

0 commit comments

Comments
 (0)