-
Notifications
You must be signed in to change notification settings - Fork 4
Pluggable discovery #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
3dc657e
Add RFC for pluggable discovery
cmaglie 2f7f65d
Fixed some typos and made RFC compliant to RFC template
cmaglie 3254493
Assign RFC number
cmaglie 78ee413
Added a note about multiple 'add' events
cmaglie bfcb83d
Added a note about START_SYNC
cmaglie 16a2687
Added discovery priority based on the currently selected board
cmaglie afac1cc
fix: Address and Protocol must be unique
cmaglie 2a1cc89
Renamed 'prefs' field to 'properties'
cmaglie 2cab0a9
Made matching algorithm more explicit about mixing identification props
cmaglie e17982c
Removed identificationPrefs
cmaglie 44e8d99
Added some backward compatibility considerations
cmaglie b10d52d
Added HELLO command
cmaglie a88bd92
Added possibility to use discovery from other platforms
cmaglie 4c7f1bf
cleaned up examples for board identification
cmaglie 972e15a
Update RFCs/0002-pluggable-discovery.md
cmaglie 8aa8f6e
Made 'plugin' more explicit
cmaglie 4b9d4b2
Added HELLO negotiation
cmaglie 0316cb9
Use a single number revision scheme
cmaglie e051454
Added 'name' field in hypotetical serial-discovery
cmaglie bad688c
Update RFCs/0002-pluggable-discovery.md
cmaglie 3916891
Update RFCs/0002-pluggable-discovery.md
cmaglie 26de7ce
Update RFCs/0002-pluggable-discovery.md
cmaglie 8affbd7
Update RFCs/0002-pluggable-discovery.md
cmaglie a4a7e63
fixed link
cmaglie ec88d16
Update RFCs/0002-pluggable-discovery.md
cmaglie e50a9dc
Removed weird cuts markers
cmaglie 7f8c194
Update RFCs/0002-pluggable-discovery.md
cmaglie 69c3f9f
Added a note about LIST timings
cmaglie c591ebb
Specify that backward compatibliity rules apply only for VID/PID
cmaglie 5149d92
Specify that backward compatibliity rules apply even for indexed rules
cmaglie cc44f9b
Builtin discoveries are used by default, unless specified
cmaglie 875ce97
fix typo
cmaglie c3242ad
Transfer ALL port metadata into upload preferences
cmaglie 5bdfe30
Added no-port protocol support
cmaglie db340b1
Rename 'user' custom field to 'field'
cmaglie bc3963d
Added error handling
cmaglie c6cdecc
Moved paragraph and cleared arduino-cli usage scenario
cmaglie e756a44
Added more details about message sequencing
cmaglie 1c082fd
Discovery install via package_index.json
cmaglie 6ed74a2
Give to 'Board Identification' its own chapter
cmaglie 2e078d4
Only serial-discovery and network-discovery are automatically added t…
cmaglie 1885102
Renamed 'no-port' protocol to 'default'
cmaglie 6830030
Made backward compatibility mode more explicit for default upload
cmaglie ef19331
Changed field to integer
cmaglie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added possibility to use discovery from other platforms
- Loading branch information
commit a88bd92e28183475bc8b663004f323318d908fce
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this section on duplicate discoveries be updated now that
discovery.requiredis added? I believe there are two problems here:discovery.required, which limits to just the explicitly required or defined discoveries. Within that set, it might be good to provide some more explicit guidance over priorities (maybe locally defined over required third-party over (required) builtins)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's suppose we have an hypothetical 3rd party
blediscovery, it may happen that one platform defines:and another one:
we may match the
discovery.ble.part of the definition to group them together, and look at the(runtime.tools...}definition to identify the latest version of the discovery and run only that one. BTW this is very fragile because it requires the developers to agree on 2 identifiers (thediscovery.ble.definition and the tool definition inpackage_index.json).Another thing that can be done is to move the discovery definition inside
package_index.jsonat thevendorlevel, so we will have:{ "packages": [ { "name": "arduino", "maintainer": "Arduino", "websiteURL": "http://www.arduino.cc/", "platforms": [ { "name": "Arduino AVR Boards", "architecture": "avr", "version": "1.6.2", ... "toolsDependencies": [ { "packager": "arduino", "name": "arm-none-eabi-gcc", "version": "4.8.3-2014q1" }, { "packager": "arduino", "name": "CMSIS", "version": "4.5.0" }, ... ], + "discoveriesDependencies": [ <--- discovery that must be installed with the platform + { "packager": "arduino", <--- another vendor may be referenced + "name": "ble", + } + ] }, { "name": "Arduino SAMD Boards", "architecture": "samd", "version": "1.6.18", ... } ], "tools": [ { "name": "arm-none-eabi-gcc", "version": "4.8.3-2014q1", ... } ], + "discoveries": [ <-- discoveries provided by the current vendor (outside a specific platform) + { "name": "ble", <-- discovery ID + "tool": { <-- discovery tool archive files + "name": "ble-discovery", + "version": "1.0.0", + ... + } + } + ] } } }this will de-couple discoveries from the single platforms so, in our example, the
blediscovery will be identified byarduino:bleinstead of, say,arduino:avr:bleand the platforms.txt may simply be:in this case the
arduino:blebecomes the unique identifier of the tool making it more very easy to group together.Drawbacks:
.pattern=...definition, in this case, the tool must be just a single executable that runs without parametersThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthijskooijman I've just pushed a proposal on how to integrate discoveries into platforms, based on the package_index.json, that should allow a better "sharing" of the tools.
The old way (directly placing the discovery in the platform and providing a
pattern) is still available, but its use should be limited to:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read the new RFC before reading the above comments, and was a bit suprised about
discoveryDependencies, since it:toolDependenciesalready exists and seemed sufficientHowever, I had initially not realized that the discovery definitions also moved from the platform level to the vendor level, which is significant because it:
OTOH the last point seems to already be supported by
toolDependenciesalready, in the sense that you can reference another vendor's tools using e.g.:However, that would only allow depending on another vendor's tool to get it installed, it would not allow "importing" the recipe from another (not-installed) platform. In other words, you would have to redefine the recipe in each platform that wants to import a discovery tool, which then leads to duplication and again potential version conflicts...
Summarizing: It's a complex challenge, and I'm not quite sure what the best approach would be. I think the current proposal would work, but also has some limitations and complexities, but I haven't thought of something better here (maybe this needs a more thorough reconsideration of the relation between the JSON and platform.txt, but I guess that's out of scope here...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deliberately removed the possibility to provide recipes and to put extra files in the discovery archive.
arduino:bleand we are done.toolsDependenciesforces you to pin aversion: this is a good thing for uploaders/compilers but not for discoveries. We want to always use the latest version available. Adding thediscoveryDependenciesfield looked like the easiest way forward in this case.I agree that those constraints make the whole system less flexible, but they guarantee that all platforms using the same discovery are compatible, allowing us to run one instance of the discovery for all of them and also allows us to upgrade the discovery tool if needed!
I like the idea that the discovery is not part of a platform and should be able to run independently from it, in this sense, I feel that removing the possibility to pass command line recipes from
platform.txtis not a big loss, the to contrary I see it as a way to force developers to design their discoveries with this isolation in mind from the beginning.Anyway, there is still the possibility to use a recipe exactly as before (in the "not recommended" integration solution), the drawback is that in that case, we will not try to do any optimization and the discovery will be used only on that specific platform (no way to use it from a 3rd party platform).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's still possible to reuse the discovery tool (by
toolDependingon it and by adding the recipe), but the CLI will run two instances of the same discovery.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, so maybe try this and see how it works, and reiterate later if needed... I see the advantage of enlarging the surface for sharing discoveries between platforms, though that might also result in breakage, one reason to pin versions of tools is to ensure that the platform uses it in a way that will work with that particular version. For discovery tools, there's no chance to get conflicts in commandline arguments, but there could be issues with the properties returned (but maybe that mostly means that discovery tools should be written conservatively, adding new properties rather than changing the meaning of existing ones, etc.).