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

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

Closed
1 task done
trombik opened this issue Jul 13, 2018 · 3 comments
Closed
1 task done
Labels
bug ldf Library Dependency Finder
Milestone

Comments

@trombik
Copy link

trombik commented Jul 13, 2018

  • 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)
@trombik
Copy link
Author

trombik commented Jul 26, 2018

94a834e says nothing about the reason. with this commit, any library with src_filter in library.json breaks unless moving all sources to root from src directory.

@ivankravets ivankravets added this to the 3.5.5 milestone Jul 26, 2018
@ivankravets ivankravets added bug ldf Library Dependency Finder labels Jul 26, 2018
ivankravets added a commit that referenced this issue Jul 26, 2018
* hotfix/v3.5.5:
  Fix an issue when "srcFilter" field in "library.json" breaks a library build // Resolve #1735
  Fix "test_lib" test
@ivankravets
Copy link
Member

Thanks for the report! Please re-test with pio upgrade --dev.

@trombik
Copy link
Author

trombik commented Jul 27, 2018

thanks. 9191ea9 fixes the issue and my build successfully finished.

ivankravets added a commit that referenced this issue Aug 6, 2018
Bump version to 3.6.0 (issues #1594 #1412 #1462 #1735)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ldf Library Dependency Finder
Projects
None yet
Development

No branches or pull requests

2 participants