Skip to content

Commit 5e6f880

Browse files
committed
legacy: Builder now support parsing of compiler output
1 parent abd7bcd commit 5e6f880

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

legacy/builder/builder_utils/utils.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ func compileFileWithRecipe(ctx *types.Context, sourcePath *paths.Path, source *p
202202
}
203203
ctx.WriteStderr(stderr)
204204

205+
// Parse the output of the compiler to gather errors and warnings...
206+
if ctx.CompilerOutputParser != nil {
207+
ctx.CompilerOutputParser(command.Args, stdout)
208+
ctx.CompilerOutputParser(command.Args, stderr)
209+
}
210+
205211
// ...and then return the error
206212
if err != nil {
207213
return nil, errors.WithStack(err)

legacy/builder/types/context.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ type Context struct {
148148
// The provided source data is used instead of reading it from disk.
149149
// The keys of the map are paths relative to sketch folder.
150150
SourceOverride map[string]string
151+
152+
// This is a function used to parse the output of the compiler
153+
// It is used to extract errors and warnings
154+
CompilerOutputParser func(cmdline []string, out []byte)
151155
}
152156

153157
// ExecutableSectionSize represents a section of the executable output file

0 commit comments

Comments
 (0)