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