Skip to content

Commit e7a8321

Browse files
Load indexes first
1 parent 855c238 commit e7a8321

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

Diff for: commands/instances.go

+25-25
Original file line numberDiff line numberDiff line change
@@ -270,31 +270,6 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro
270270
// even if it should not.
271271
pmb, commitPackageManager := instance.pm.NewBuilder()
272272

273-
loadBuiltinTools := func() []error {
274-
builtinPackage := pmb.GetOrCreatePackage("builtin")
275-
return pmb.LoadToolsFromPackageDir(builtinPackage, pmb.PackagesDir.Join("builtin", "tools"))
276-
}
277-
278-
// Load Platforms
279-
if profile == nil {
280-
for _, err := range pmb.LoadHardware() {
281-
s := &arduino.PlatformLoadingError{Cause: err}
282-
responseError(s.ToRPCStatus())
283-
}
284-
} else {
285-
// Load platforms from profile
286-
errs := pmb.LoadHardwareForProfile(
287-
profile, true, downloadCallback, taskCallback,
288-
)
289-
for _, err := range errs {
290-
s := &arduino.PlatformLoadingError{Cause: err}
291-
responseError(s.ToRPCStatus())
292-
}
293-
294-
// Load "builtin" tools
295-
_ = loadBuiltinTools()
296-
}
297-
298273
// Load packages index
299274
urls := []string{globals.DefaultIndexURL}
300275
if profile == nil {
@@ -335,6 +310,31 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro
335310
}
336311
}
337312

313+
loadBuiltinTools := func() []error {
314+
builtinPackage := pmb.GetOrCreatePackage("builtin")
315+
return pmb.LoadToolsFromPackageDir(builtinPackage, pmb.PackagesDir.Join("builtin", "tools"))
316+
}
317+
318+
// Load Platforms
319+
if profile == nil {
320+
for _, err := range pmb.LoadHardware() {
321+
s := &arduino.PlatformLoadingError{Cause: err}
322+
responseError(s.ToRPCStatus())
323+
}
324+
} else {
325+
// Load platforms from profile
326+
errs := pmb.LoadHardwareForProfile(
327+
profile, true, downloadCallback, taskCallback,
328+
)
329+
for _, err := range errs {
330+
s := &arduino.PlatformLoadingError{Cause: err}
331+
responseError(s.ToRPCStatus())
332+
}
333+
334+
// Load "builtin" tools
335+
_ = loadBuiltinTools()
336+
}
337+
338338
// We load hardware before verifying builtin tools are installed
339339
// otherwise we wouldn't find them and reinstall them each time
340340
// and they would never get reloaded.

0 commit comments

Comments
 (0)