File tree 3 files changed +31
-0
lines changed
3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import (
25
25
26
26
"github.com/arduino/arduino-cli/arduino/builder/internal/compilation"
27
27
"github.com/arduino/arduino-cli/arduino/builder/internal/detector"
28
+ "github.com/arduino/arduino-cli/arduino/builder/internal/diagnostics"
28
29
"github.com/arduino/arduino-cli/arduino/builder/internal/logger"
29
30
"github.com/arduino/arduino-cli/arduino/builder/internal/progress"
30
31
"github.com/arduino/arduino-cli/arduino/builder/internal/utils"
@@ -90,6 +91,10 @@ type Builder struct {
90
91
buildOptions * buildOptions
91
92
92
93
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
93
98
}
94
99
95
100
// 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(
166
166
}
167
167
b .logger .WriteStderr (commandStderr .Bytes ())
168
168
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
+
169
175
// ...and then return the error
170
176
if err != nil {
171
177
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