Skip to content

Commit 61563a4

Browse files
committed
Report used libraries even in case of unsuccessful build
1 parent 0b0d1c9 commit 61563a4

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

commands/compile/compile.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,19 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
219219
return r, compileErr
220220
}
221221

222+
defer func() {
223+
importedLibs := []*rpc.Library{}
224+
for _, lib := range builderCtx.ImportedLibraries {
225+
rpcLib, err := lib.ToRPCLibrary()
226+
if err != nil {
227+
msg := tr("Error getting information for library %s", lib.Name) + ": " + err.Error() + "\n"
228+
errStream.Write([]byte(msg))
229+
}
230+
importedLibs = append(importedLibs, rpcLib)
231+
}
232+
r.UsedLibraries = importedLibs
233+
}()
234+
222235
// if it's a regular build, go on...
223236
if err := builder.RunBuilder(builderCtx); err != nil {
224237
return r, &arduino.CompileFailedError{Message: err.Error()}
@@ -268,16 +281,6 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
268281
}
269282
}
270283

271-
importedLibs := []*rpc.Library{}
272-
for _, lib := range builderCtx.ImportedLibraries {
273-
rpcLib, err := lib.ToRPCLibrary()
274-
if err != nil {
275-
return r, &arduino.PermissionDeniedError{Message: tr("Error getting information for library %s", lib.Name), Cause: err}
276-
}
277-
importedLibs = append(importedLibs, rpcLib)
278-
}
279-
r.UsedLibraries = importedLibs
280-
281284
r.ExecutableSectionsSize = builderCtx.ExecutableSectionsSize.ToRPCExecutableSectionSizeArray()
282285

283286
logrus.Tracef("Compile %s for %s successful", sk.Name, fqbnIn)

0 commit comments

Comments
 (0)