Adapter header files for libraries

One of the user visible changes from libraries 1.0 to libraries 2.0 is that a library header file should be included in user applications without a path.

Old way:
#include <InternetButton/InternetButton.h>

New way:
#include <InternetButton.h>

Going forward we want to encourage people to use the new way since it’s compatible with Arduino and resolves differences between local and cloud compile.

To help make the transition smooth for users the CLI now generates an adapter file during library migration so the old include statement will still work. All published libraries are already migrated and now include this adapter.

For library creators, this means the first time you want to publish a new version of an existing library and you do particle library migrate to convert the library to the new format you will see an additional file in src/LibraryName/LibraryName.h

If you create a new library with particle library init we encourage you to leave out the adapter file and use #include <LibraryName.h> in the examples.

Let me know if you’d like clarification on any of this stuff. :smile:

Note: This means that the steps described here to create adapter files in the user application are no longer necessary.

2 Likes