Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Correctly mark package manager instance as "under profile"
even in case an unversioned platform is requsted.
  • Loading branch information
cmaglie committed Jul 3, 2025
commit d4861020a53054bfd3ae91b164e7e3e49d9d04bc
7 changes: 6 additions & 1 deletion commands/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,16 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
}

// Load Platforms
if profile == nil || profile.RequireSystemInstalledPlatform() {
if profile == nil {
for _, err := range pmb.LoadHardware() {
s := &cmderrors.PlatformLoadingError{Cause: err}
responseError(s.GRPCStatus())
}
} else if profile.RequireSystemInstalledPlatform() {
for _, err := range pmb.LoadGlobalHardwareForProfile(profile) {
s := &cmderrors.PlatformLoadingError{Cause: err}
responseError(s.GRPCStatus())
}
} else {
// Load platforms from profile
errs := pmb.LoadHardwareForProfile(ctx, profile, true, downloadCallback, taskCallback, s.settings)
Expand Down
7 changes: 7 additions & 0 deletions internal/arduino/cores/packagemanager/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ import (
"github.com/sirupsen/logrus"
)

// LoadGlobalHardwareForProfile loads the hardware platforms for the given profile.
// It uses the global package manager and does not download or install any missing tools or platforms.
func (pmb *Builder) LoadGlobalHardwareForProfile(p *sketch.Profile) []error {
pmb.profile = p
return pmb.LoadHardware()
}

// LoadHardwareForProfile load the hardware platforms for the given profile.
// If installMissing is true then possibly missing tools and platforms will be downloaded and installed.
func (pmb *Builder) LoadHardwareForProfile(ctx context.Context, p *sketch.Profile, installMissing bool, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB, settings *configuration.Settings) []error {
Expand Down