External Library Dependencies on the new Library Manager

Hey everyone.

So I got the memo the other day about the new Firmware Library Manager. Needless to say I was pretty excited about it.

I read through the new docs section on it as well as the blog post. Also looked at the example library on github(uber-library-example) and decided to give it a go.

I was needing to add another example file to one of my existing libraries. So I updated DEV to the latest version, pulled up that library and migrated it to the new format. So far so good. I created a new folder to hold my new example file as I see you need to do now and wrote the code. This new example depends on two external libraries. One of them is my SI7020 library and the other is Blynk. I saw the dependencies listed in the library.properties on the sample library on github so I tried to mimic that on mine. Saved the library.properties file, then clicked Manage Current Library, updated the version and clicked Save changes, just to find it removed those dependency lines on the library.properties file. What gives?

I know this is a pretty loose explanation but has anyone tried this in DEV yet? I see lots about the CLI but not much on DEV. Also other than docs->guides->firmware libraries and the github library sample are there any other sources of information on this?

paging @jvanier

I had asked the same question a few days ago and the answer was, that there currently is no way to have a specific example require additional dependencies (e.g. via a project.properties file alongside the sample .ino).
One workaround - till this feature finds its way into the next release fo FLM - would be to add some conditional compile directives to check for the presence of a given library and otherwise issue a #pragma GCC error "this and that library needs to be added"

For my case the library would in most cases require these other libraries to become useful anyhow, so I just added the dependencies to the library itself although it would work just as well without them.

But I use CLI to manage the libraries, so I don’t know how Dev does it, but have you uploaded the library after your alterations?

Thanks @ScruffR. Yes I did try uploading the library and through Build I pulled up the Library and selected the example file that required the dependencies and tried using it. Unfortunately it did not recognize the external libraries.

When I looked at the example library(uber-library-example) I looked at the library.properties file and saw line 15 there that looked promising:

example-dependencies.blynk=*

Given the syntax there I thought “Cool looks like you can add external dependencies for examples”. Is that not what that is for? What else would example-dependencies be for I wonder?

As @ScruffR mentioned there is currently no way for a library example to have more dependencies than the enclosing library.

To add dependencies to a library in Dev, open the Library manager, search for a library and click Use -> Add to current library.

Given the feedback we’ll definitely add support for additional dependencies in examples.

3 Likes

Great. Thank you @jvanier I can see lots of examples needing external dependencies so that would be a huge help!

Thanks for the feedback, everyone! Much appreciated on behalf of the whole Particle team!

2 Likes