khoih-prog / EthernetWebServer

This is simple yet complete WebServer library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and `ESP8266 ESP8266WebServer` libraries. Ethernet_Generic library is used as default for W5x00 with custom SPI
MIT License
178 stars 49 forks source link

Dependencies in library.json #13

Closed Phintly closed 3 years ago

Phintly commented 3 years ago

Why is the functional library not listed in library.json under dependencies so that PlatformIO can install it automatically?

khoih-prog commented 3 years ago

It's been done in both

  1. platformio.ini
lib_deps = 
; PlatformIO 4.x 
  Functional-Vlpp@~1.0.1
  Ethernet@~2.0.0
  EthernetLarge@~2.0.0
  Ethernet2@~1.0.4
  Ethernet3@~1.5.3
  EthernetENC@~2.0.0
  UIPEthernet@~2.0.9
; PlatformIO 5.x  
;  khoih-prog/Functional-Vlpp@~1.0.1
;  PaulStoffregen/Ethernet@~2.0.0
;  PaulStoffregen/EthernetLarge@~2.0.0
;  adafruit/Ethernet2@~1.0.4
;  sstaub/Ethernet3@~1.5.3
;  jandrassy/EthernetENC@~2.0.0  
;  UIPEthernet/UIPEthernet@~2.0.9

and

  1. library.properties
depends=Functional-Vlpp

It's working with other libraries. If it doesn't work for you, either check your PIO installation or post a question on PIO Forum

Phintly commented 3 years ago

Manually copying the library's dependencies into your own dependencies contradicts the purpose of a dependency management system and library.properties is the configuration for the standard library manager, not for PlatformIO (EDIT: In this case, it can however use library.properties if there is no library.json). See: https://docs.platformio.org/en/latest/librarymanager/config.html#dependencies

khoih-prog commented 3 years ago

PIO is new and is changing quickly. The library original design is for Arduino IDE which relies only on library.properties. Many libraries' dependency installations, so far, are working OK with PIO, but some not. Ask PIO why.

But anyway I'll add the library.json dependencies, from now on, into all new libraries to support this PIO feature. Hopefully will be OK for another while.

Thanks,

khoih-prog commented 3 years ago

Already updated on master of this lib. Certainly will add to every libraries I'm currently maintaining.

khoih-prog commented 3 years ago

The way PIO is doing is very clumsy.

It'll take a lot of time to search and know the correct "owner" and "name" of each dependent library. Many times, the library's name is different from the one used in Arduino IDE.


For example:

STM32duino STM32Ethernet Library

  1. Arduino Library name:
name=STM32duino STM32Ethernet
...
depends=STM32duino LwIP
  1. PIO changes that to
{
   "owner": "stm32duino",
   "name": "STM32Ethernet",      <============ Drop STM32duino
   "version": "^1.2.0"
}

and you can only know that when you search, then access access the Library in PIO and see

pio lib install "stm32duino/STM32Ethernet"

That's why many libraries writers don't care about library.json and PIO. Just only library.properties, even nothing (no library.json and library.properties).

You have to try to add libraries' dependencies once and understand the issue.

khoih-prog commented 3 years ago

Then for

STM32duino LwIP Library

  1. Arduino Library name:
name=STM32duino LwIP
  1. PIO changes that to
{
   "owner": "stm32duino",
   "name": "STM32duino LwIP",      <=========== now using original IDE name
}

and you can only know that when you search, then access access the Library in PIO STM32duino LwIP

and see

pio lib install "stm32duino/STM32duino LwIP"
Phintly commented 3 years ago

Oh god, you are still working on it. I didn't mean to waste your time like that. Maybe try just removing the library.json altogether in the libraries you haven't yet supplemented by the dependencies since, like I said, PIO should also work with the library.properties afaik.

The only requirement is a library manifest file - library.json, library.properties, or module.json.

https://docs.platformio.org/en/latest/librarymanager/creating.html

Or you could just wait until someone complains.

khoih-prog commented 3 years ago

Thanks for your words.

Just try my best to save you all a lot of time later.

In the lengthy and time-consuming process to modify all 50+ libs. Hopefully once and for all. ;-((