platformio / platformio-core

Your Gateway to Embedded Software Development Excellence :alien:
https://platformio.org
Apache License 2.0
7.92k stars 792 forks source link

Dependencies not needed for my platform are installed and compiled anyway #1232

Closed papodaca closed 6 years ago

papodaca commented 6 years ago

Configuration

Operating system: Same on all MacOS, Windows and linux

PlatformIO Version (platformio --version): PlatformIO, version 3.4.1

Description of problem

Incorrect dependencies are installed when platform is espressif32. Dependency lists two different dependency based on platform:

{
  "name":"ESP Async WebServer",
  "description":"Asynchronous HTTP and WebSocket Server Library for ESP8266 and ESP32",
  "keywords":"http,async,websocket,webserver",
  "authors":
  {
    "name": "Hristo Gochkov",
    "maintainer": true
  },
  "repository":
  {
    "type": "git",
    "url": "https://github.com/me-no-dev/ESPAsyncWebServer.git"
  },
  "version": "1.1.1",
  "license": "LGPL-3.0",
  "frameworks": "arduino",
  "platforms": ["espressif8266", "espressif32"],
  "dependencies": [
    {
      "name": "ESPAsyncTCP",
      "platforms": "espressif8266"
    },
    {
      "name": "AsyncTCP",
      "platforms": "espressif32"
    }
  ]
}

Dependency graph generated includes ESPAsyncTCP which should not be included given the current platform. This causes compilation issues.

Steps to Reproduce

  1. pio init -b lolin32
  2. Add ESP Async WebServer as a dependency.
    lib_deps =
    ESP Async WebServer
  3. pio run

Actual Results

Library Dependency Graph
|-- <ESP Async WebServer> v1.1.1
|   |-- <AsyncTCP> v1.0.1
|   |-- <ESPAsyncTCP> v1.1.3
|   |-- <WiFi> v1.0
|   |-- <FS> v1.0

Expected Results

Expectation is that

Library Dependency Graph
|-- <ESP Async WebServer> v1.1.1
|   |-- <AsyncTCP> v1.0.1
|   |-- <WiFi> v1.0
|   |-- <FS> v1.0

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:lolin32]
platform = espressif32
board = lolin32
framework = arduino
lib_deps =
  ESP Async WebServer

Source file to reproduce issue:

#include <WiFi.h>
#include <ESPmDNS.h>
#include <ArduinoOTA.h>
#include <FS.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>

AsyncWebServer server(80);

void setup() {

}

void loop() {

}

Additional info

To work around this I have forked the dependency and remove the dependencies that are not needed on my platform:

{
  "name":"ESP Async WebServer",
  "description":"Asynchronous HTTP and WebSocket Server Library for ESP8266 and ESP32",
  "keywords":"http,async,websocket,webserver",
  "authors":
  {
    "name": "Hristo Gochkov",
    "maintainer": true
  },
  "repository":
  {
    "type": "git",
    "url": "https://github.com/me-no-dev/ESPAsyncWebServer.git"
  },
  "version": "1.1.1",
  "license": "LGPL-3.0",
  "frameworks": "arduino",
  "platforms": ["espressif32"],
  "dependencies": [
    {
      "name": "AsyncTCP",
      "platforms": "espressif32"
    }
  ]
}
ivankravets commented 6 years ago

Fixed in the latest development version http://docs.platformio.org/en/latest/installation.html#development-version

The final release of PIO Core 3.5 is planned this month.