Skip to content

Commit b7d594f

Browse files
silvanocerzacmaglie
authored andcommitted
Change property to declare pluggable discoveries
1 parent 3e3fcd2 commit b7d594f

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

arduino/cores/packagemanager/loader.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ func (pm *PackageManager) LoadDiscoveries() []*status.Status {
626626

627627
func (pm *PackageManager) loadDiscoveries(release *cores.PlatformRelease) []*status.Status {
628628
statuses := []*status.Status{}
629-
discoveryProperties := release.Properties.SubTree("discovery")
629+
discoveryProperties := release.Properties.SubTree("pluggable_discovery")
630630

631631
if discoveryProperties.Size() == 0 {
632632
return nil
@@ -635,11 +635,11 @@ func (pm *PackageManager) loadDiscoveries(release *cores.PlatformRelease) []*sta
635635
// Handles discovery properties formatted like so:
636636
//
637637
// Case 1:
638-
// "discovery.required": "PLATFORM:DISCOVERY_NAME",
638+
// "pluggable_discovery.required": "PLATFORM:DISCOVERY_NAME",
639639
//
640640
// Case 2:
641-
// "discovery.required.0": "PLATFORM:DISCOVERY_ID_1",
642-
// "discovery.required.1": "PLATFORM:DISCOVERY_ID_2",
641+
// "pluggable_discovery.required.0": "PLATFORM:DISCOVERY_ID_1",
642+
// "pluggable_discovery.required.1": "PLATFORM:DISCOVERY_ID_2",
643643
//
644644
// If both indexed and unindexed properties are found the unindexed are ignored
645645
for _, id := range discoveryProperties.ExtractSubIndexLists("required") {

arduino/cores/packagemanager/loader_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func TestLoadDiscoveries(t *testing.T) {
137137
packageManager := createTestPackageManager()
138138
release := packageManager.Packages["arduino"].Platforms["avr"].Releases["1.0.0"]
139139
release.Properties = properties.NewFromHashmap(map[string]string{
140-
"discovery.required": "arduino:ble-discovery",
140+
"pluggable_discovery.required": "arduino:ble-discovery",
141141
})
142142

143143
errs := packageManager.LoadDiscoveries()
@@ -149,8 +149,8 @@ func TestLoadDiscoveries(t *testing.T) {
149149
packageManager = createTestPackageManager()
150150
release = packageManager.Packages["arduino"].Platforms["avr"].Releases["1.0.0"]
151151
release.Properties = properties.NewFromHashmap(map[string]string{
152-
"discovery.required.0": "arduino:ble-discovery",
153-
"discovery.required.1": "arduino:serial-discovery",
152+
"pluggable_discovery.required.0": "arduino:ble-discovery",
153+
"pluggable_discovery.required.1": "arduino:serial-discovery",
154154
})
155155

156156
errs = packageManager.LoadDiscoveries()
@@ -163,9 +163,9 @@ func TestLoadDiscoveries(t *testing.T) {
163163
packageManager = createTestPackageManager()
164164
release = packageManager.Packages["arduino"].Platforms["avr"].Releases["1.0.0"]
165165
release.Properties = properties.NewFromHashmap(map[string]string{
166-
"discovery.required.0": "arduino:ble-discovery",
167-
"discovery.required.1": "arduino:serial-discovery",
168-
"discovery.teensy.pattern": "\"{runtime.tools.teensy_ports.path}/hardware/tools/teensy_ports\" -J2",
166+
"pluggable_discovery.required.0": "arduino:ble-discovery",
167+
"pluggable_discovery.required.1": "arduino:serial-discovery",
168+
"pluggable_discovery.teensy.pattern": "\"{runtime.tools.teensy_ports.path}/hardware/tools/teensy_ports\" -J2",
169169
})
170170

171171
errs = packageManager.LoadDiscoveries()
@@ -179,10 +179,10 @@ func TestLoadDiscoveries(t *testing.T) {
179179
packageManager = createTestPackageManager()
180180
release = packageManager.Packages["arduino"].Platforms["avr"].Releases["1.0.0"]
181181
release.Properties = properties.NewFromHashmap(map[string]string{
182-
"discovery.required": "arduino:some-discovery",
183-
"discovery.required.0": "arduino:ble-discovery",
184-
"discovery.required.1": "arduino:serial-discovery",
185-
"discovery.teensy.pattern": "\"{runtime.tools.teensy_ports.path}/hardware/tools/teensy_ports\" -J2",
182+
"pluggable_discovery.required": "arduino:some-discovery",
183+
"pluggable_discovery.required.0": "arduino:ble-discovery",
184+
"pluggable_discovery.required.1": "arduino:serial-discovery",
185+
"pluggable_discovery.teensy.pattern": "\"{runtime.tools.teensy_ports.path}/hardware/tools/teensy_ports\" -J2",
186186
})
187187

188188
errs = packageManager.LoadDiscoveries()

docs/platform-specification.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -705,50 +705,50 @@ Discoveries in its [`platform.txt`](#platformtxt). Discoveries can be referenced
705705
There are two different syntaxes to declare discoveries. If the platform uses just one discovery:
706706

707707
```
708-
discovery.required=VENDOR_ID:DISCOVERY_NAME
708+
pluggable_discovery.required=VENDOR_ID:DISCOVERY_NAME
709709
```
710710

711711
instead if it needs multiple discoveries:
712712

713713
```
714-
discovery.required.0=VENDOR_ID:DISCOVERY_0_NAME
715-
discovery.required.1=VENDOR_ID:DISCOVERY_1_NAME
714+
pluggable_discovery.required.0=VENDOR_ID:DISCOVERY_0_NAME
715+
pluggable_discovery.required.1=VENDOR_ID:DISCOVERY_1_NAME
716716
```
717717

718718
A platform that supports only boards connected via serial ports can easily use the `builtin` package's
719719
`serial-discovery` without creating a custom Pluggable Discovery:
720720

721721
```
722-
discovery.required=builtin:serial-discovery
722+
pluggable_discovery.required=builtin:serial-discovery
723723
```
724724

725725
if it also supports boards connected via the network, it can use the `builtin` package's `mdns-discovery`:
726726

727727
```
728-
discovery.required.0=builtin:serial-discovery
729-
discovery.required.1=builtin:mdns-discovery
728+
pluggable_discovery.required.0=builtin:serial-discovery
729+
pluggable_discovery.required.1=builtin:mdns-discovery
730730
```
731731

732732
Since the above syntax requires specifying a discovery via the `discoveryDependencies` field of the platform's
733733
[package index](package_index_json-specification.md), it might be cumbersome to use with manual installations. So we
734734
provide another syntax to ease development and beta testing:
735735

736736
```
737-
discovery.DISCOVERY_ID.pattern=DISCOVERY_RECIPE
737+
pluggable_discovery.DISCOVERY_ID.pattern=DISCOVERY_RECIPE
738738
```
739739

740740
`DISCOVERY_ID` must be replaced by a unique identifier for the particular discovery and `DISCOVERY_RECIPE` must be
741741
replaced by the command line to launch the discovery. An example could be:
742742

743743
```
744744
## Teensy Ports Discovery
745-
discovery.teensy.pattern="{runtime.tools.teensy_ports.path}/hardware/tools/teensy_ports" -J2
745+
pluggable_discovery.teensy.pattern="{runtime.tools.teensy_ports.path}/hardware/tools/teensy_ports" -J2
746746
```
747747

748748
We strongly recommend using this syntax only for development purposes and not on released platforms.
749749

750-
For backward compatibility, if a platform does not declare any discovery (using the `discovery.*` properties in
751-
`platform.txt`) it will automatically inherit `builtin:serial-discovery` and `builtin:mdns-discovery` (but not other
750+
For backward compatibility, if a platform does not declare any discovery (using the `pluggable_discovery.*` properties
751+
in `platform.txt`) it will automatically inherit `builtin:serial-discovery` and `builtin:mdns-discovery` (but not other
752752
builtin discoveries that may be possibly added in the future).
753753

754754
For detailed information, see the [Pluggable Discovery specification](pluggable-discovery-specification.md).

0 commit comments

Comments
 (0)