Good question @roberto_imai and thanks for the ping @Dave .
I verified that the the importer does not allow sub-directories for source or header files. I believe the reason for doing this was to ensure the include path to a library was simple and to not allow libraries that are so large that they require sub-directories. The idea was to encourage libraries to be relatively small and tightly focussed and therefore wouldn’t need this capability. After seeing your use case though, I now understand that this design might not be ideal. For libraries seeking to provide broad and complete encapsulation of other complimentary hardware like this, the idea is not appropriate. I’ve added a “You should be able to sub-directories for source and header files within a library” spec to our backlog–I’ll ping this thread when we ship it. I’m not sure when the ETA is on this.
If you want to get this library up and in a working state ASAP, I’d recommend the following:
Change the name of the library in the spark.json to “reef-angle-controller” instead of “SparkCoreLibraries” and change the main source and main header file to
reef-angle-controller.cpp. This provides something more descriptive for potential users of your library. (I’d also add a bit more to the readme to exhibit use cases, etc before publishing)
When porting, for each sub-directory in the Arduino repo, use it as a file name prefix, so
firmware/ReefAngel_ReefAngle.h. This way file grouping will still be preserved when rendered via
ls or in GitHub. Also, the convention will make clear where things are being ported from. You could probably write a little script to do the rename for you too if it will save you time.
So, @roberto_imai , thank you for bringing this up, the use case you’ve illustrated justifies a tweak to the library system to accommodate this kind of thing. In the meantime, I hope the approach I’ve described will work for you.