PlatformIO Community

Dependency from library.json is not being included

Hello, I have a project which includes a local library like this:
#include <Mylib.h>
this is in my main.cpp. The library it self is being pulled from a dir specified in lib_extra_dir in pio ini.

This library gets included no problem. The issue is, that Mylib has a dependecy that it needs, and this dependency is not being included.
I followed this tutorial when creating the library Creating Library — PlatformIO latest documentation and just as it said, I created the library.json file like so:

{
    "name": "Mylib",
    "version": "1.0",
    "description": "test",
    "keywords": test
    "authors":
    [
      {
        "name": "Mike",
        "email": "sd@sd.sd",    
        "maintainer": true
      }
    ],
    "license": "MIT",
	"dependencies": 
	{		
		"rweather/Crypto" : "^0.2.0"		
	},    
    "frameworks": "Arduino",
    "platforms": "*"
  }

and placed it within the root directory of the Mylib library. But the dependency “rweather/Crypto” : “^0.2.0” is not being included for some reason.
If I specify this library in lib_deps in platformio.ini of my main project like so

lib_deps =
    rweather/Crypto@^0.2.0

then it compiles fine and works, but that is just messy, since I would have to manually include all the dependencies of my libraries in the main project.

Why is the dependency not working?

Hm, maybe the dependency installation process is only kicked off on a fresh build. Try and delete the .pio folder of the project and rebuild. Does it pull dependencies now?

Nope. Looks like it only works if the deps are in lib_deps. If i use lib_extra_dir it seems like doesn’t pull the dependencies. I solved the issue for now by using lib_deps instead, but the problem is that lib_deps makes a local copy of the library, where lib_extra_dir always uses the original one. Which is not a huge issue i suppose, when i modify the original library i can just delete the .pio dir and recombile.

You can also use a symlink with lib_deps, so that no copy is made:

lib_deps =
   symlink://<path to your library>

(docs).

But hm, maybe that installation kickoff procedure should be improved…