Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically delete removed dependencies #4170

Closed
1 task done
maxgerhardt opened this issue Feb 6, 2022 · 1 comment
Closed
1 task done

Automatically delete removed dependencies #4170

maxgerhardt opened this issue Feb 6, 2022 · 1 comment

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Feb 6, 2022

What kind of issue is this?

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

Configuration

Operating system: Win10 x64

PlatformIO Version (platformio --version): 5.2.4.

Description of problem

When creating a project and adding a library dependency to it via lib_deps and compiles the project, the specified library gets downloaded into .pio\libdeps\<env>\<library name> and included in the build.

When removing the library again from the lib_deps of the platformio.ini and recompiling, the downloaded dependency is not removed.

The downloaded dependency in .pio\libdeps should be removed because

  1. Users expect that a removal of the library from lib_deps results in wiping the downloaded library off the project completely (see e.g. here)
  2. It can lead to inconsistent behavior / compilation results

E.g., if I add ArduinoJson to the lib_deps and do #include <ArduinoJson.h> in the src\main.cpp, the project compiles. I remove ArduinoJson from lib_deps again, and hit compile. The project still compiles although the library declaration is gone. Now when I upload the PlatformIO project (platformio.ini, src/ etc) thinking it's all working and people download my project and compile it, they won't have that .pio folder with the left-over library and compilation will fail.

Even worse, I've seen it happen that e.g. people include the wrong Servo.h library in lib_deps. They then notice that and remove it from lib_deps to try and get the correct framework built-in library. However, compilation still fails (or the used library won't work correctly) unless they delete the hidden .pio folder that clears off the old library and actually results in the usage of the right library.

Steps to Reproduce

  1. Create an arbitrary project, e.g., Arduino Uno + Framework = Arduino
  2. Add a library dependency to it (e.g., lib_deps=bblanchon/ArduinoJson@^6.19.1)
  3. To the standard empty Arduino sketch, add #include <ArduinoJson.h>
  4. Compile the project, it all works, library is downloaded
  5. Remove the lib_deps expression from the platformio.ini again and save the file
  6. Recompile

Actual Results

Compilation still works although library was removed.

Expected Results

Compilation fails, the library is removed from .pio\libdeps.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps=bblanchon/ArduinoJson@^6.19.1

Source file to reproduce issue:

#include <Arduino.h>
#include <ArduinoJson.h>

void setup() {}
void loop(){}

Additional info

-/-

@ivankravets
Copy link
Member

Duplicate of #3076

Ohh, hope we will fix this issue soon. Sory :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants