How to install libraries from a Github repo's subfolders

Hi guys!
I have set up a GitHub repository with various libraries in subfolders from where I am trying to install them in different projects. I have seen this example but cannot emulate it. I only get that the **pio lib install** ... command to work when each library is in a separate repository. What would be the correct command to install them in the global storage if the libraries are located in subfolders but share the repository? Thank you!
P.S. I already implemented a solution with a pre-script similar to this one that works, but that is not what I’m looking for.

I think the magic is in the library.json file… if you look at this one for instance, the git url at line 9 is for the repostiry, but it’s the include line directive that maks it so only that particular libraries directory is… well… included? :smiley:

Even then, I’m not entirely sure how you’d then install it… :open_mouth:

I’ll fork that repo into my account so that the only difference is the username to check if it works. It’s interesting that this case is mentioned at the bottom of the “Creating Library” guide as “Multiple libraries in the one repository”.

Within that same guide, there is this phrase:
“You can hold a lot of libraries (split into separated folders) inside one of the repository/archive. In this case, you need to specify include option of export field to relative path to your library’s source code”.

I think that It has to work somehow unless It was fixed by hand in the PlatformIO Library Registry.

1 Like

So far, no way! I don’t understand how that example works :confused:
Any help is very much appreciated …

Hm… it seems like the magic sauce is the PlatformIO library crawler… when you read what the include parameter does, this all seems to be geared towards telling the crawler about the library format, and it will work it out, and then you’d access the library via the platformio library registry, rather than directly from the github.

It’s looking like the extra_script I did before may be the only way to do it stand-alone… unless you ‘misuse’ branches to have a branch for each library! :laughing:

Thank you for helping me reasoning this out! You read my mind, yesterday I was thinking of creating a git branch for each library, but I discarded it soon, It’d be a maintenance nightmare.

I’m afraid I’ll give up and think about a naming convention for a (future) long list of libraries on my account, each on its repository. I wanted to have just one “library repo” with a folder naming convention, instead but … that’s the way life is ¯_(ツ)_/¯