Skip to content

Commit 57e191e

Browse files
committed
Resolve monitors from platform.txt
1 parent 802917d commit 57e191e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Diff for: arduino/cores/cores.go

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type PlatformRelease struct {
6262
IsIDEBundled bool `json:"-"`
6363
IsTrusted bool `json:"-"`
6464
PluggableDiscoveryAware bool `json:"-"` // true if the Platform supports pluggable discovery (no compatibility layer required)
65+
Monitors map[string]*MonitorDependency
6566
}
6667

6768
// BoardManifest contains information about a board. These metadata are usually

Diff for: arduino/cores/packagemanager/loader.go

+14
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ func (pm *PackageManager) loadPlatformRelease(platform *cores.PlatformRelease, p
326326
} else {
327327
platform.Properties.Set("pluggable_discovery.required.0", "builtin:serial-discovery")
328328
platform.Properties.Set("pluggable_discovery.required.1", "builtin:mdns-discovery")
329+
platform.Properties.Set("pluggable_monitor.required.serial", "builtin:serial-monitor")
329330
}
330331

331332
if platform.Platform.Name == "" {
@@ -359,6 +360,19 @@ func (pm *PackageManager) loadPlatformRelease(platform *cores.PlatformRelease, p
359360
if !platform.PluggableDiscoveryAware {
360361
convertLegacyPlatformToPluggableDiscovery(platform)
361362
}
363+
364+
// Build pluggable monitor references
365+
platform.Monitors = map[string]*cores.MonitorDependency{}
366+
for protocol, ref := range platform.Properties.SubTree("pluggable_monitor.required").AsMap() {
367+
split := strings.Split(ref, ":")
368+
if len(split) != 2 {
369+
return fmt.Errorf(tr("invalid pluggable monitor reference: %s"), ref)
370+
}
371+
platform.Monitors[protocol] = &cores.MonitorDependency{
372+
Packager: split[0],
373+
Name: split[1],
374+
}
375+
}
362376
return nil
363377
}
364378

0 commit comments

Comments
 (0)