lmarzen / esp32-weather-epd

A low-power E-Paper weather display powered by an ESP32 microcontroller. Utilizes the OpenWeatherMap API.
GNU General Public License v3.0
2.33k stars 179 forks source link

Speed up PlatformIO's build process #69

Closed ivankravets closed 7 months ago

ivankravets commented 7 months ago

Source:

Hi Luke,

Thanks for using PlatformIO for this amazing project! šŸ™

We received a report regarding the slow compilation time of the PlatformIO project. See https://community.platformio.org/t/scanning-dependencies-takes-more-than-90-seconds-every-build/36901

The reason for this issue is a huge amount (4000+) of header files in fonts/icons folders https://github.com/lmarzen/esp32-weather-epd/tree/main/platformio/include

PlatformIO's LDF scans all these files and looks for dependencies (#include directive). The simplest solution is to move a ton of these headers to the private library (https://github.com/lmarzen/esp32-weather-epd/tree/main/platformio/lib) and disable LDF for it.

Proposed solution

  1. Create a media folder in platformio/lib
  2. Move platformio/include/fonts and platformio/include/icons folders to the platformio/lib/media
  3. Create library.json file in the platformio/lib/media folder with the following contents:
{
  "$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
  "name": "media",
  "version": "1.0.0",
  "build": {
    "libLDFMode": "off"
  }
}

P.S.: The media name is an example. You can use whatever you want.

esonhon commented 7 months ago

Source:

Hi Luke,

Thanks for using PlatformIO for this amazing project! šŸ™

We received a report regarding the slow compilation time of the PlatformIO project. See https://community.platformio.org/t/scanning-dependencies-takes-more-than-90-seconds-every-build/36901

The reason for this issue is a huge amount (4000+) of header files in fonts/icons folders https://github.com/lmarzen/esp32-weather-epd/tree/main/platformio/include

PlatformIO's LDF scans all these files and looks for dependencies (#include directive). The simplest solution is to move a ton of these headers to the private library (https://github.com/lmarzen/esp32-weather-epd/tree/main/platformio/lib) and disable LDF for it.

Proposed solution

  1. Create a media folder in platformio/lib
  2. Move platformio/include/fonts and platformio/include/icons folders to the platformio/lib/media
  3. Create library.json file in the platformio/lib/media folder with the following contents:
{
  "$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
  "name": "media",
  "version": "1.0.0",
  "build": {
    "libLDFMode": "off"
  }
}

P.S.: The media name is an example. You can use whatever you want.

It works! You saved my ass.

lmarzen commented 7 months ago

Hi Ivan,

I have implemented the proposed solution (adc388e78f033aef5ceb54b2de45d2f6e8175952). Thank you for the suggestion, it has greatly reduced the project build-time.

ivankravets commented 7 months ago

@lmarzen, thanks! šŸ™ šŸš€