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

Disable dependency finder on ESP32 #2435

Merged
merged 3 commits into from
Oct 3, 2021

Conversation

agners
Copy link
Contributor

@agners agners commented Oct 3, 2021

Breaking Change

This change only affects custom components.

Before 2021.10, platformio would automatically look for libraries based on the #includes in your custom code.

That had to be disabled because it was causing issues.

When you use a library (even internal ones like Wire), you now need to explicitly put them in the esphome section like this

esphome:
  libraries
    # Any libraries that were implicitly used before
    - Wire
    - SPI
    - EEPROM
    # Note: order is important, core libraries like `Wire` should be placed before external ones

More information here: esphome/issues#2587

What does this implement/fix?

The platform.io LDF (library dependeny finder) adds libraries based on
header file names. However, this at times causes spurious dependency to
be added to the dependency graph. If a library can't be compiled for a
certain configuration, this blocks certain configurations which would
be buildable otherwise.

Disable the LDF by default for ESP32 targets. Add required libraries
directly to modules.

More information about the LDF:
https://docs.platformio.org/en/latest/librarymanager/ldf.html#ldf-mode

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes esphome/issues#2474

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP8266

Example entry for config.yaml:

# Example config.yaml

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

The platform.io LDF (library dependeny finder) adds libraries based on
header file names. However, this at times causes spurious dependency to
be added to the dependency graph. If a library can't be compiled for a
certain configuration, this blocks certain configurations which would
be buildable otherwise.

Disable the LDF by default for ESP32 targets. Add required libraries
directly to modules.
@probot-esphome
Copy link

probot-esphome bot commented Oct 3, 2021

Hey there @OttoWinter, mind taking a look at this pull request as it has been labeled with an integration (captive_portal) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

probot-esphome bot commented Oct 3, 2021

Hey there @OttoWinter, mind taking a look at this pull request as it has been labeled with an integration (web_server_base) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

probot-esphome bot commented Oct 3, 2021

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (esp32) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

probot-esphome bot commented Oct 3, 2021

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (ota) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@agners
Copy link
Contributor Author

agners commented Oct 3, 2021

I tested this also with Arduino 2.0.0/ESP32-C3 configurations, where the Crypto library gets added as a spurious dependency to ESPAsyncWebServer-esphome.

@OttoWinter
Copy link
Member

OttoWinter commented Oct 3, 2021

Nice! Good that disabling ldf works now :)

Looks like http_request needs a manual HTTPClient add_library as well: https://github.com/esphome/esphome/runs/3783748305#step:11:220

and airthings_wave_plus BLE: https://github.com/esphome/esphome/runs/3783748342#step:11:30 (imports BLEDevice.h unlike other BLE platforms for some helper methods)

and spi SPI: https://github.com/esphome/esphome/runs/3783748419#step:11:127

@probot-esphome
Copy link

probot-esphome bot commented Oct 3, 2021

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (spi) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

probot-esphome bot commented Oct 3, 2021

Hey there @jeromelaban, mind taking a look at this pull request as it has been labeled with an integration (airthings_wave_plus) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

probot-esphome bot commented Oct 3, 2021

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (mdns) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

Copy link
Member

@OttoWinter OttoWinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@OttoWinter OttoWinter merged commit 1627dff into esphome:dev Oct 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.