Dependencies in library.json are not recognized by platformio

I am developing a library (GitHub - iotexproject/arduino-sdk) which has two platform dependent dependencies, FlashStorage and WiFiNINA.

I have specified them in library.json, along with "libCompatibilityMode": "strict"

However, it doesn’t look like platformio is reconizing the dependencies. In order to reproduce, follow the steps below:

  1. Clone the repo
git clone https://github.com/iotexproject/arduino-sdk.git
  1. As the library is not yet in pio library manager, we need to tell platformio where to locate it. For this, set the value of PLATFORMIO_LIB_EXTRA_DIRS to the current directory (where we have cloned the repo)
export PLATFORMIO_LIB_EXTRA_DIRS=`pwd`
  1. Change directory to any example and try to run for nano_33_iot.
cd arduino-sdk/examples/GetAccountMetadata
platformio run --environment nano_33_iot

Expected: platformio recognizes FlashStorage and WiFiNINA as dependencies.
Actual: platformio does not recognize any of them as dependencies. See output below:

Processing nano_33_iot (platform: atmelsam; board: nano_33_iot; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/nano_33_iot.html
PLATFORM: Atmel SAM (6.3.1) > NANO 33 IoT
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
PACKAGES:
 - framework-arduino-samd 1.8.11
 - framework-cmsis 1.40500.0 (4.5.0)
 - framework-cmsis-atmel 1.2.2
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Converting GetAccountMetadata.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep+, Compatibility ~ soft
Found 14 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <IoTeX-blockchain-client> 0.0.1
|   |-- <SPI> 1.0
Building in release mode
Compiling .pio/build/nano_33_iot/src/GetAccountMetadata.ino.cpp.o

I often use export PLATFORMIO_LIB_EXTRA_DIRS=... - but not with pwd. PIO will scan the specified area on each run, I found it best to start with an empty directory to avoid slowdowns. Then place just the libraries you want to be found in there, as subdirectories (or as symlinks to those directories).

PS. For other readers, let me just add a reference the other topic you started: Pio compiles dependencies for all platforms when only a specific platform specified per dependency

Found an open issue regarding this error Improve handling library.json dependencies · Issue #2573 · platformio/platformio-core · GitHub
The library.json dependencies are not picked un unless installed by pio lib or added in platformio.ini

It doesn’t look like the PlatformIO tem is working on it as it’s been open for 2 years

The workaround is simply to specify the libraries in platformio.ini as well as library.json