Skip to content

When developing a library in default directory structure, setting srcFilter breaks build #1735

@trombik

Description

@trombik
  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

Operating system:

N/A

PlatformIO Version (platformio --version):

PlatformIO, version 3.5.4

Description of problem

When developing a library in default directory structure, setting srcFilter breaks build.

By default, $REPO_ROOT/src is the source directory, or src_dir. The code goes there. Everything is fine.

When srcFilter is set to whatever value, src_dir becomes $REPO_ROOT even if the value is +<*>.

https://github.com/platformio/platformio-core/blob/develop/platformio/builder/tools/piolib.py#L592

Now #include <Foo.h> in the source must be modified to #include <src/Foo.h> since platformio cannot find the header. Or, all the files must be moved to $REPO_ROOT from src.

Steps to Reproduce

  1. Create src/Foo.h and examples/foo/src/main.c
  2. Include <Foo.h> in main.c
  3. Set srcFilter in, say, extrascript.py

Actual Results

examples/foo/src/main.c:13:24: fatal error: Foo.h: No such file or directory

Expected Results

The above logic is documented if this is a feature.

If problems with PlatformIO Build System:

The content of platformio.ini:

[platformio]
lib_dir = ../
src_dir = examples

[common]
upload_port = /dev/cuaU0
lib_deps =
    https://github.com/BoschSensortec/BME280_driver.git#bme280_v3.3.4

[env:lolin32_espidf]
board = lolin32
platform = espressif32
framework = espidf
upload_port = ${common.upload_port}
lib_compat_mode = off
lib_ldf_mode = chain+
lib_deps = ${common.lib_deps}

; note that this src_filter works fine
src_filter = +<esp_idf/>

Source file to reproduce issue:

# extrascript.py

Import("env")
# this one change the behavior
src_filter = ["+<*>"]
env.Replace(SRC_FILTER=src_filter)

Metadata

Metadata

Assignees

No one assigned

    Labels

    LDFLibrary Dependency Finderbug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions