Setting up dependancies in properties for library.

When one submits a library for the IDE you can add a "dependancies=xxx" line to it for showing what library that yours would be dependent on. What if there are multiple libraries to list?

Is this the proper way? Just to list them?

depends=LC_baseTools Adafruit_NeoPixel

Or would I need to add multiple lines?

depends=LC_baseTools
depends=Adafruit_NeoPixel

?

I used the first version (a guess) and it went through. But I really have no way, that I know of, to check if it worked or not.

-jim lee

jimLee:
you can add a “dependancies=xxx” line to it for showing what library that yours would be dependent on.

Make sure that you spell the property right: “depends”

jimLee:
What if there are multiple libraries to list?

From the Arduino Library Specification:
https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format

a comma-separated list of dependencies

jimLee:
depends=LC_baseTools Adafruit_NeoPixel

This is specifying a dependency on a single library named “LC_baseTools Adafruit_NeoPixel”.

Note also that the library name is “Adafruit NeoPixel”, not “Adafruit**_**NeoPixel”:

The dependencies system will only work if you specify the exact name of the library that is in the Library Manager index.

jimLee:
Or would I need to add multiple lines?

depends=LC_baseTools
depends=Adafruit_NeoPixel

The second definition of the depends property overrides the first one, so this is equivalent to depends=Adafruit_NeoPixel.

jimLee:
I used the first version (a guess) and it went through.

The validation of the library on submission to the Library Manager index is currently not very strict.

jimLee:
I really have no way, that I know of, to check if it worked or not.

Well, now that it’s in Library Manager, you can surely try installing it, which will give you some indication that there is a problem:

no protocol: 
java.lang.RuntimeException: java.net.MalformedURLException: no protocol: 
 at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$4(LibraryManagerUI.java:248)
 at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.MalformedURLException: no protocol: 
 at java.net.URL.<init>(URL.java:593)
 at java.net.URL.<init>(URL.java:490)
 at java.net.URL.<init>(URL.java:439)
 at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:64)
 at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:60)
 at cc.arduino.contributions.libraries.LibraryInstaller.performInstall(LibraryInstaller.java:155)
 at cc.arduino.contributions.libraries.LibraryInstaller.install(LibraryInstaller.java:125)
 at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$4(LibraryManagerUI.java:237)
 ... 1 more

If you want to do a more thorough check of the metadata and structure of your library, I recommend Arduino Lint:
https://arduino.github.io/arduino-lint/latest/

$ arduino-lint --library-manager update
Linting library in E:\electronics\git-nobackup\LC_neoPixel
Rule LS008 result: fail
WARNING: No header file found matching library name (LC_neoPixel.h). Best practices are for primary header filename to match library name.
Rule LP021 result: fail
WARNING: library.properties version value 1.0 is not compliant with the semver specification. See https://semver.org/
Rule LP035 result: fail
WARNING: A commonly misspelled word was found in the library.properties paragraph field. Suggested correction: This library allows setting and retereving NeoPixel colors using our colorObj class. Shifting a strings of pixels left or right and to rolling rings of pixels clockwise or counter clockwise. (Great for goggles.) The included chainPixel class allows groups of pixels to be coded independently from each other, while running off of a single processor pin. (Again, imagine goggle rings)
Rule LP038 result: fail
ERROR: Invalid category field value Uncategorized in library.properties. See https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format
Rule LP039 result: fail
WARNING: Use of "Uncategorized" category value in library.properties. Please use one of the allowed categories: https://arduino.github.io/arduino-cli/latest/library-specification/#libraryproperties-file-format
Rule LP048 result: fail
WARNING: library.properties depends field item(s) LC_baseTools Adafruit_NeoPixel not found in the Library Manager index.

Finished linting project. Results:
Warning count: 5
Error count: 1
Rules passed: false

-------------------

Linting sketch in E:\electronics\git-nobackup\LC_neoPixel\examples\christmas_lites

Finished linting project. Results:
Warning count: 0
Error count: 0
Rules passed: true

-------------------

Linting sketch in E:\electronics\git-nobackup\LC_neoPixel\examples\goggle_lights

Finished linting project. Results:
Warning count: 0
Error count: 0
Rules passed: true

-------------------

Linting sketch in E:\electronics\git-nobackup\LC_neoPixel\examples\wreath_lites

Finished linting project. Results:
Warning count: 0
Error count: 0
Rules passed: true

-------------------

Finished linting projects. Results:
Warning count: 5
Error count: 1
Rules passed: false

There is also a GitHub Actions action that makes it super easy to run Arduino Lint on every change and pull request in the GitHub repositories of your Arduino libraries to make sure no new problems are ever introduced:

Thanks! That's what I needed to know.

-jim lee

You're welcome.