Skip to content
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

Add libraries super compatibility and explicit incompatibility in the spec #2149

Open
3 tasks done
umbynos opened this issue Apr 17, 2023 · 1 comment · May be fixed by #2155
Open
3 tasks done

Add libraries super compatibility and explicit incompatibility in the spec #2149

umbynos opened this issue Apr 17, 2023 · 1 comment · May be fixed by #2155
Assignees
Labels
phase: design Work is in the design phase status: waiting for information More information must be provided before work can proceed topic: code Related to content of the project itself topic: documentation Related to documentation for the project type: enhancement Proposed improvement

Comments

@umbynos
Copy link
Contributor

umbynos commented Apr 17, 2023

Describe the request

Add support for a field named supported in the library.properties library metadata file. This field is a comma-separated list of patterns to match against an FQBN.

This will allow library developers to define the supported boards for the library down to board-level granularity.

The result would be something like this in the library.properties file:

name=Camera
version=1.0
author=Arduino
maintainer=Arduino <[email protected]>
sentence=Camera library for Portenta H7 Vision Shield
paragraph=
category=Other
url=https://github.com/arduino/ArduinoCore-mbed/tree/master/libraries/Camera
architectures=mbed,!avr
supported=*:mbed:portenta,!*:*:nano33ble
#supported=mbed:portenta,!mbed:nano33ble <- without wildcards

This information could be used for applications such as:

Describe the current behavior

Library developers can only indicate compatibility at architecture-level granularity. A library may have dependencies on attributes that only present on a subset of boards of a given architecture.

This means it is not possible for tools to accurately determine whether a specific board is supported by a library.

For example, the "Keyboard" library specifies compatibility with the avr architecture:

https://github.com/arduino-libraries/Keyboard/blob/1.0.4/library.properties#L9

architectures=avr, samd, sam

However, not all AVR microcontrollers have the required native USB capability. This results in inaccurate information about the library's support for those boards.

The library is listed in lib list command output when the FQBN of an unsupported board (e.g., Uno) is specified via the --fqbn flag:

$ arduino-cli lib install Keyboard
Downloading [email protected]...
[email protected] [email protected] already downloaded
Installing [email protected]...
Installed [email protected]

$ arduino-cli lib list Keyboard --fqbn arduino:avr:uno
Name     Installed     Available         Location              Description
Keyboard 1.0.4         -                 LIBRARY_LOCATION_USER -

Unsupported boards are included in the automatically generated "Compatibility" list of the library's reference page:

https://www.arduino.cc/reference/en/libraries/keyboard/

Arduino CLI version

0.32.2

Operating system

N/A

Operating system version

N/A

Additional context

The newly added field should be ignored by versions of Arduino development tools that don't have support for the new field. If so, this change would not result in any backwards incompatibility of the libraries that use it.


Relevant code:

CompatibleWith map[string]bool

Related

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details
@umbynos umbynos added type: enhancement Proposed improvement topic: documentation Related to documentation for the project topic: code Related to content of the project itself phase: design Work is in the design phase labels Apr 17, 2023
@umbynos
Copy link
Contributor Author

umbynos commented Apr 17, 2023

Original reporter @facchinm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
phase: design Work is in the design phase status: waiting for information More information must be provided before work can proceed topic: code Related to content of the project itself topic: documentation Related to documentation for the project type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants