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

Fix compile error when --preprocess or --show-properties were passed #331

Merged
merged 3 commits into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 6 additions & 8 deletions commands/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
5 changes: 3 additions & 2 deletions legacy/builder/wipeout_build_path_if_build_options_changed.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down