File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import (
2525
2626 "github.com/arduino/arduino-cli/arduino/builder/internal/compilation"
2727 "github.com/arduino/arduino-cli/arduino/builder/internal/detector"
28+ "github.com/arduino/arduino-cli/arduino/builder/internal/diagnostics"
2829 "github.com/arduino/arduino-cli/arduino/builder/internal/logger"
2930 "github.com/arduino/arduino-cli/arduino/builder/internal/progress"
3031 "github.com/arduino/arduino-cli/arduino/builder/internal/utils"
@@ -90,6 +91,10 @@ type Builder struct {
9091 buildOptions * buildOptions
9192
9293 libsDetector * detector.SketchLibrariesDetector
94+
95+ // This is a function used to parse the output of the compiler
96+ // It is used to extract errors and warnings
97+ compilerOutputParser diagnostics.CompilerOutputParserCB
9398}
9499
95100// buildArtifacts contains the result of various build
Original file line number Diff line number Diff line change @@ -166,6 +166,12 @@ func (b *Builder) compileFileWithRecipe(
166166 }
167167 b .logger .WriteStderr (commandStderr .Bytes ())
168168
169+ // Parse the output of the compiler to gather errors and warnings...
170+ if b .compilerOutputParser != nil {
171+ b .compilerOutputParser (command .GetArgs (), commandStdout .Bytes ())
172+ b .compilerOutputParser (command .GetArgs (), commandStderr .Bytes ())
173+ }
174+
169175 // ...and then return the error
170176 if err != nil {
171177 return nil , errors .WithStack (err )
Original file line number Diff line number Diff line change 1+ // This file is part of arduino-cli.
2+ //
3+ // Copyright 2023 ARDUINO SA (http://www.arduino.cc/)
4+ //
5+ // This software is released under the GNU General Public License version 3,
6+ // which covers the main part of arduino-cli.
7+ // The terms of this license can be found at:
8+ // https://www.gnu.org/licenses/gpl-3.0.en.html
9+ //
10+ // You can be released from the requirements of the above licenses by purchasing
11+ // a commercial license. Buying such a license is mandatory if you want to
12+ // modify or otherwise use the software for commercial activities involving the
13+ // Arduino software without disclosing the source code of your own applications.
14+ // To purchase a commercial license, send an email to [email protected] . 15+
16+ package diagnostics
17+
18+ // CompilerOutputParserCB is a callback function that is called to feed a parser
19+ // with the plain-text compiler output.
20+ type CompilerOutputParserCB func (cmdline []string , out []byte )
You can’t perform that action at this time.
0 commit comments