@@ -25,6 +25,7 @@ import (
25
25
26
26
"github.com/arduino/arduino-cli/internal/arduino/builder/internal/compilation"
27
27
"github.com/arduino/arduino-cli/internal/arduino/builder/internal/detector"
28
+ "github.com/arduino/arduino-cli/internal/arduino/builder/internal/diagnosticmanager"
28
29
"github.com/arduino/arduino-cli/internal/arduino/builder/internal/diagnostics"
29
30
"github.com/arduino/arduino-cli/internal/arduino/builder/internal/logger"
30
31
"github.com/arduino/arduino-cli/internal/arduino/builder/internal/progress"
@@ -36,7 +37,6 @@ import (
36
37
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
37
38
"github.com/arduino/go-paths-helper"
38
39
"github.com/arduino/go-properties-orderedmap"
39
- "github.com/sirupsen/logrus"
40
40
)
41
41
42
42
// ErrSketchCannotBeLocatedInBuildPath fixdoc
@@ -94,11 +94,7 @@ type Builder struct {
94
94
95
95
toolEnv []string
96
96
97
- // This is a function used to parse the output of the compiler
98
- // It is used to extract errors and warnings
99
- compilerOutputParser diagnostics.CompilerOutputParserCB
100
- // and here are the diagnostics parsed from the compiler
101
- compilerDiagnostics diagnostics.Diagnostics
97
+ diagnosticsManager * diagnosticmanager.Manager
102
98
}
103
99
104
100
// buildArtifacts contains the result of various build
@@ -199,6 +195,7 @@ func NewBuilder(
199
195
logger .Warn (string (verboseOut ))
200
196
}
201
197
198
+ diagnosticmanager := diagnosticmanager .New ()
202
199
b := & Builder {
203
200
sketch : sk ,
204
201
buildProperties : buildProperties ,
@@ -220,12 +217,6 @@ func NewBuilder(
220
217
targetPlatform : targetPlatform ,
221
218
actualPlatform : actualPlatform ,
222
219
toolEnv : toolEnv ,
223
- libsDetector : detector .NewSketchLibrariesDetector (
224
- libsManager , libsResolver ,
225
- useCachedLibrariesResolution ,
226
- onlyUpdateCompilationDatabase ,
227
- logger ,
228
- ),
229
220
buildOptions : newBuildOptions (
230
221
hardwareDirs , otherLibrariesDirs ,
231
222
builtInLibrariesDirs , buildPath ,
@@ -237,25 +228,15 @@ func NewBuilder(
237
228
buildProperties .GetPath ("runtime.platform.path" ),
238
229
buildProperties .GetPath ("build.core.path" ), // TODO can we buildCorePath ?
239
230
),
231
+ diagnosticsManager : diagnosticmanager ,
232
+ libsDetector : detector .NewSketchLibrariesDetector (
233
+ libsManager , libsResolver ,
234
+ useCachedLibrariesResolution ,
235
+ onlyUpdateCompilationDatabase ,
236
+ logger ,
237
+ diagnosticmanager ,
238
+ ),
240
239
}
241
-
242
- b .compilerOutputParser = func (cmdline []string , out []byte ) {
243
- compiler := diagnostics .DetectCompilerFromCommandLine (
244
- cmdline ,
245
- false , // at the moment compiler-probing is not required
246
- )
247
- if compiler == nil {
248
- logrus .Warnf ("Could not detect compiler from: %s" , cmdline )
249
- return
250
- }
251
- diags , err := diagnostics .ParseCompilerOutput (compiler , out )
252
- if err != nil {
253
- logrus .Warnf ("Error parsing compiler output: %s" , err )
254
- return
255
- }
256
- b .compilerDiagnostics = append (b .compilerDiagnostics , diags ... )
257
- }
258
-
259
240
return b , nil
260
241
}
261
242
@@ -281,7 +262,7 @@ func (b *Builder) ImportedLibraries() libraries.List {
281
262
282
263
// CompilerDiagnostics returns the parsed compiler diagnostics
283
264
func (b * Builder ) CompilerDiagnostics () diagnostics.Diagnostics {
284
- return b .compilerDiagnostics
265
+ return b .diagnosticsManager . CompilerDiagnostics ()
285
266
}
286
267
287
268
// Preprocess fixdoc
0 commit comments