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