Skip to content

Commit 0cc34e0

Browse files
committed
Correctly mark package manager instance as "under profile"
even in case an unversioned platform is requsted.
1 parent 69761fb commit 0cc34e0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

commands/instances.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,16 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
243243
}
244244

245245
// Load Platforms
246-
if profile == nil || profile.RequireSystemInstalledPlatform() {
246+
if profile == nil {
247247
for _, err := range pmb.LoadHardware() {
248248
s := &cmderrors.PlatformLoadingError{Cause: err}
249249
responseError(s.GRPCStatus())
250250
}
251+
} else if profile.RequireSystemInstalledPlatform() {
252+
for _, err := range pmb.LoadGlobalHardwareForProfile(profile) {
253+
s := &cmderrors.PlatformLoadingError{Cause: err}
254+
responseError(s.GRPCStatus())
255+
}
251256
} else {
252257
// Load platforms from profile
253258
errs := pmb.LoadHardwareForProfile(ctx, profile, true, downloadCallback, taskCallback, s.settings)

internal/arduino/cores/packagemanager/profiles.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ import (
3333
"github.com/sirupsen/logrus"
3434
)
3535

36+
// LoadGlobalHardwareForProfile loads the hardware platforms for the given profile.
37+
// It uses the global package manager and does not download or install any missing tools or platforms.
38+
func (pmb *Builder) LoadGlobalHardwareForProfile(p *sketch.Profile) []error {
39+
pmb.profile = p
40+
return pmb.LoadHardware()
41+
}
42+
3643
// LoadHardwareForProfile load the hardware platforms for the given profile.
3744
// If installMissing is true then possibly missing tools and platforms will be downloaded and installed.
3845
func (pmb *Builder) LoadHardwareForProfile(ctx context.Context, p *sketch.Profile, installMissing bool, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB, settings *configuration.Settings) []error {

0 commit comments

Comments
 (0)