0

I'm using Visual Studio Code and PlatformIO. I added some libraries to my project using platformio.ini:

lib_deps = 
    olikraus/U8g2@^2.34.4
    crankyoldgit/IRremoteESP8266@^2.8.4
    plerup/EspSoftwareSerial@^6.16.1
    rlogiacco/CircularBuffer@^1.3.3
    https://github.com/me-no-dev/ESPAsyncWebServer.git
    makuna/NeoPixelBus@^2.7.0
    adafruit/Adafruit BusIO@^1.13.2
    bblanchon/ArduinoJson@^6.19.4
    adafruit/Adafruit PN532@^1.2.2
    khoih-prog/ESPAsync_WiFiManager@^1.15.1
    https://github.com/guestisp/ESP32AsyncDNSServer.git

Now, let's say I have to "hack" few lines of code inside a library to fit my needs. Since it's a very specific change (not something that can be useful to others) I can easily change directly the source code without forking it on github.

The downside is every time I download again the libraries (or set up another dev machine) I lose all my changes.

I can also move the downloaded library to the lib/ subfolder in the project tree, removing the dependency from lib_deps.

I wonder if there is a more reliable way to do this, i.e. applying a patch after downloading the code (yocto-like).

Mark
  • 393
  • 2
  • 14

1 Answers1

2

Use a local source control and repository of your choice. Obtain the latest published rev of the library and make your changes to it (I assume you have already done this, probably a number of times). Check in your changed revision of the library to your local repository. When a new rev becomes available, obtain it and merge it into your local repository.

Update:

One problem of this approach is I will end up with nested repositories.

I'm coming from old-school source control - file management. rcs, in my case (don't laugh). I'm guessing your local modifications affect only one or a few of the library files. Mightn't something that simple - a file-level merge - solve your issue (regardless of which tool you choose to do it)?

JRobert
  • 15,407
  • 3
  • 24
  • 51