Library.json and "export: include/exclude" in local/git repositories


I want use my local library in platformio project. I created there library.json, because I want decide what files should be in my lib (h ttp:// exclude some extra dirs (doc, tests, …), and include some another file.

After that I found some unexpected (?) behavior. The same problem appears in remote git repository (examples below):

#1. when library.json not exist, library manager find headers/source files and import them to .piolibdeps - sometimes not this files what I expected.
Example: GitHub - ericniebler/meta: A tiny metaprogramming library

$ pio lib install
Library Storage: /home/velmafia/my/project/.piolibdeps
LibraryManager: Installing meta
git version 2.11.0
Cloning into '/home/velmafia/my/project/.piolibdeps/_tmp_installing-Bcuuzr-package'...
test @ 0.0.0 has been successfully installed!

But main library files (from include/meta) are absent:

$ tree .piolibdeps/
└── test
    ├── CMakeLists.txt
    ├── meta.cpp
    └── simple_test.hpp

1 directory, 3 files

#2 when library.json exist, library manager clone whole git/local repository to .piolibdeps, and ignore export: include/exclude section.
Example: GitHub - nanopb/nanopb: Protocol Buffers with small code size

$ pio  lib install
Library Storage: /home/velmafia/my/project/.piolibdeps
LibraryManager: Installing nanopb
git version 2.11.0
Cloning into '/home/velmafia/my/project/.piolibdeps/_tmp_installing-puJdlL-package'...
remote: Counting objects: 342, done.
remote: Compressing objects: 100% (305/305), done.
remote: Total 342 (delta 27), reused 219 (delta 20), pack-reused 0
Receiving objects: 100% (342/342), 274.22 KiB | 0 bytes/s, done.
Resolving deltas: 100% (27/27), done.
Nanopb @ 651bdc4 has been successfully installed!

Nanopb (h ttp:// has correct library.json, so I thing output should be the same as in PlatformIO Registry (h ttp://, but it isn’t.

$ tree .piolibdeps/ -aL 2
└── Nanopb
    ├── AUTHORS
    ├── BUILD
    ├── CHANGELOG.txt
    ├── CMakeLists.txt
    ├── docs
    ├── examples
    ├── extra
    ├── generator
    ├── .git
    ├── .gitignore
    ├── library.json
    ├── LICENSE.txt
    ├── pb_common.c
    ├── pb_common.h
    ├── pb_decode.c
    ├── pb_decode.h
    ├── pb_encode.c
    ├── pb_encode.h
    ├── pb.h
    ├── tests
    ├── tools
└── .travis.yml

According to documentation (h ttp://, library.json should be supported also in local/git repo:

PlatformIO supports installing from local directory or archive. Need to use file:// prefix before local path. Also, directory or archive should contain .library.json manifest (see library.json).

My Questions:
#1 What is correct solution to download files “include/meta/*” from example #1? My first idea was create library.json with “export: include” section, but as we can see in #2, this isn’t working in local/git repository.
#2 In example #2 output should be the same as in PlatformIO Registry, and I found bug?


sorry for “h ttps://…”, but as new user I can’t post more that 2 links :confused:

export field is intended for PIO Library Registry Crawler. PIO Build System doesn’t use it. If you want to control which files to build, you need Redirecting...