@@ -31,6 +31,7 @@ import (
31
31
"github.com/arduino/arduino-cli/commands"
32
32
"github.com/arduino/arduino-cli/configuration"
33
33
"github.com/arduino/arduino-cli/i18n"
34
+ "github.com/arduino/arduino-cli/internal/builder/diagnostics"
34
35
"github.com/arduino/arduino-cli/internal/inventory"
35
36
"github.com/arduino/arduino-cli/legacy/builder"
36
37
"github.com/arduino/arduino-cli/legacy/builder/types"
@@ -168,7 +169,25 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
168
169
return nil , err
169
170
}
170
171
172
+ var allDiagnostics diagnostics.Diagnostics
173
+ defer func () {
174
+ r .Diagnostics = allDiagnostics .ToRPC ()
175
+ }()
176
+
171
177
builderCtx := & types.Context {}
178
+ builderCtx .CompilerOutputParser = func (cmdline []string , out []byte ) {
179
+ compiler := diagnostics .DetectCompilerFromCommandLine (cmdline , false /* at the moment compiler-probing is not required */ )
180
+ if compiler == nil {
181
+ logrus .Warnf ("Could not detect compiler from: %s" , cmdline )
182
+ return
183
+ }
184
+ diags , err := diagnostics .ParseCompilerOutput (compiler , out )
185
+ if err != nil {
186
+ logrus .Warnf ("Error parsing compiler output: %s" , err )
187
+ return
188
+ }
189
+ allDiagnostics = append (allDiagnostics , diags ... )
190
+ }
172
191
builderCtx .PackageManager = pme
173
192
if pme .GetProfile () != nil {
174
193
builderCtx .LibrariesManager = lm
0 commit comments