Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: install a library missing from local library-index#50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dido18 merged 8 commits intomainfromfix-add-library
Nov 7, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletionsinternal/orchestrator/sketch_libs.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,8 @@ package orchestrator

import (
"context"
"log/slog"
"time"

"github.com/arduino/arduino-cli/commands"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
Expand All@@ -25,6 +27,8 @@ import (
"github.com/arduino/arduino-app-cli/internal/orchestrator/app"
)

const indexUpdateInterval = 10 * time.Minute

func AddSketchLibrary(ctx context.Context, app app.ArduinoApp, libRef LibraryReleaseID, addDeps bool) ([]LibraryReleaseID, error) {
srv := commands.NewArduinoCoreServer()
var inst *rpc.Instance
Expand All@@ -43,6 +47,15 @@ func AddSketchLibrary(ctx context.Context, app app.ArduinoApp, libRef LibraryRel
return nil, err
}

stream, _ := commands.UpdateLibrariesIndexStreamResponseToCallbackFunction(ctx, func(curr *rpc.DownloadProgress) {
slog.Debug("downloading library index", "progress", curr.GetMessage())
})
// update the local library index after a certain time, to avoid if a library is added to the sketch but the local library index is not update, the compile can fail (because the lib is not found)
req := &rpc.UpdateLibrariesIndexRequest{Instance: inst, UpdateIfOlderThanSecs: int64(indexUpdateInterval.Seconds())}
if err := srv.UpdateLibrariesIndex(req, stream); err != nil {
slog.Warn("error updating library index, skipping", slog.String("error", err.Error()))
}

resp, err := srv.ProfileLibAdd(ctx, &rpc.ProfileLibAddRequest{
Instance: inst,
SketchPath: app.MainSketchPath.String(),
Expand All@@ -59,6 +72,7 @@ func AddSketchLibrary(ctx context.Context, app app.ArduinoApp, libRef LibraryRel
if err != nil {
return nil, err
}

return f.Map(resp.GetAddedLibraries(), rpcProfileLibReferenceToLibReleaseID), nil
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp