I would like to know what are the best practices for developing Arduino libraries, making them compatible with the Arduino IDE 1.5: Library specification and using Github.

Here is how I do it right now (but maybe there is a smarter way)

1. create a repository in github (on my computer this is in a folder under ...\documents\github, eg. ...\documents\github\mynewlibrary). Set up the contents of this folder according to the Arduino IDE 1.5: Library specification.

2. do a local commit to Github, then sync with Github.comThe files can now be downloaded from Github as a .zip library, and installed in Arduino IDE and Visual Micro. Doing so they arrive in ...\documents\arduino\libraries\mynewlibrary-master

4. when ready for a new release of your library, you sync the files between :* ...\documents\arduino\libraries\mynewlibrary-master* ...\documents\github\mynewlibraryusing a filesync tool like FreeFileSyncThen commit changes to Github and sync with Github.com

Below is the answer I have given in other threads. You are already on the way but I think you just need to step back and explore VS/VM then GIT is easy.

If you use option A you just need a shared project which in VS terms is just a project file with .vcxitems extension instead of .vcxproj extension. You should use the visual micro options to "Create a project when adding libraries" simply to see how a shared project looks.

When you see a shared project you should realize that you can just add a .vcxitems file with same name as your library to your library project then you can add it to your solution that also contains your arduino project. Then add a Reference>SharedProject from the Arduino project to the shared lib project. See the readme.txt when Visual Micro creates a shared lib project for you. OR use file>new>project>C++>arduino library.

All VS .vcxitems and .vxcproj files are just text files that you can edit with notepad but you should not need to when you explore the various workflows.

So option A gives you a cross platform library that is GIT capable and will work nicely with your Arduino project(s)

Option B is simpler and gives the library sources below the project. The lib sources are then included in the project/solution explorer as if part of the arduino project. The entire single Arduino project can then be checked into GIT which will automatically include your local libraries. Libraries in the specified location in an Arduino project are treated as normal libraries.

You can use the 1.5 spec or older for libs but they MUST have the library.properties file.

You can also right click a library properties in the "solution explorer > publish library" to have the library "Published to your sketchbook/libraries folder".

The -master is not used because it is just some rubbish that git uses. Normally, you can rename any "-master" folders to normal because both arduino ide and visual micro do some internal rubbish to remove the "-master" rubbish when attempting to resolve libraries

Option A Create (or let visual micro create) shared library projects (see the checkbox on the "Add Library" menu for an example). Then right click "References" for your your Arduino project and and add the libraries as "Shared Projects". Using this system the libraries can be in any location. There is also a "File>New>C++>Arduino Library" which shows more clearly how a library can become a "shared library project".

or

Option B You can copy libraries to "project_folder\_micro-api\libraries" and then include them in the project using right click in the solution explorer. You will need to click the little "show all files" icon above the solution explorer to see the libraries you copied using windows explorer. Visual Micro will use the local libraries sources during builds but will treat them as libraries and not local project code. However, they will also be a part of the project as far as any GIT tools are concerned

looks like option A is the more robust one.Thanks for the tip about the -master postfix... another annoyance solved

After mastering this technique, I will look into using Git directly from within VS, instead of using the Windows Git client and syncing files between VS/VM and the local Git repositories. After MS buying Github, I think this will be the preferred way of working in the future.