Skip to content

Commit

Permalink
Filter some unused Marlin/src subfolders (MarlinFirmware#18729)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhapsodyv authored and albertogg committed Aug 31, 2020
1 parent 4b4d4d9 commit 2c0003f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
21 changes: 9 additions & 12 deletions buildroot/share/PlatformIO/scripts/common-features-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,10 @@ def install_features_dependencies():
del deps_to_add[name]

# any left?
if len(deps_to_add) <= 0:
continue

# add only the missing deps
proj = env.GetProjectConfig()
proj.set("env:" + env["PIOENV"], "lib_deps", deps + list(deps_to_add.values()))
if len(deps_to_add) > 0:
# add only the missing deps
proj = env.GetProjectConfig()
proj.set("env:" + env["PIOENV"], "lib_deps", deps + list(deps_to_add.values()))

if 'extra_scripts' in FEATURE_DEPENDENCIES[feature]:
print("Executing extra_scripts for %s... " % feature)
Expand All @@ -110,17 +108,16 @@ def install_features_dependencies():
if 'src_filter' in FEATURE_DEPENDENCIES[feature]:
print("Adding src_filter for %s... " % feature)
proj = env.GetProjectConfig()
src_filter = env.GetProjectOption("src_filter")

src_filter = ' '.join(env.GetProjectOption("src_filter"))
# first we need to remove the references to the same folder
my_srcs = re.findall( r'[+-](<.*?>)', FEATURE_DEPENDENCIES[feature]['src_filter'])
cur_srcs = re.findall( r'[+-](<.*?>)', src_filter[0])
cur_srcs = re.findall( r'[+-](<.*?>)', src_filter)
for d in my_srcs:
if d in cur_srcs:
src_filter[0] = re.sub(r'[+-]' + d, '', src_filter[0])
src_filter = re.sub(r'[+-]' + d, '', src_filter)

src_filter[0] = FEATURE_DEPENDENCIES[feature]['src_filter'] + ' ' + src_filter[0]
proj.set("env:" + env["PIOENV"], "src_filter", src_filter)
src_filter = FEATURE_DEPENDENCIES[feature]['src_filter'] + ' ' + src_filter
proj.set("env:" + env["PIOENV"], "src_filter", [src_filter])
env.Replace(SRC_FILTER=src_filter)

# search the current compiler, considering the OS
Expand Down
6 changes: 6 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ default_envs = mega2560
#
[common]
default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/lcd/extui/lib/mks_ui>
-<src/lcd/menu> -<src/lcd/dwin> -<src/lcd/extui/lib/dgus> -<src/lcd/extui/lib/ftdi_eve_touch_ui> -<src/lcd/dogm>
extra_scripts =
pre:buildroot/share/PlatformIO/scripts/common-features-dependencies.py
pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py
Expand All @@ -47,7 +48,12 @@ HAS_L64XX = Arduino-L6470@0.8.0
NEOPIXEL_LED = Adafruit NeoPixel@1.5.0
MAX6675_IS_MAX31865 = Adafruit MAX31865 library@~1.1.0
HAS_GRAPHICAL_LCD = U8glib-HAL@0.4.1
src_filter=+<src/lcd/dogm>
HAS_CHARACTER_LCD = LiquidCrystal@1.5.0, LiquidTWI2@1.2.7
TOUCH_UI_FTDI_EVE = src_filter=+<src/lcd/extui/lib/ftdi_eve_touch_ui>
HAS_DGUS_LCD = src_filter=+<src/lcd/extui/lib/dgus>
DWIN_CREALITY_LCD = src_filter=+<src/lcd/dwin>
HAS_LCD_MENU = src_filter=+<src/lcd/menu>

#
# Default values apply to all 'env:' prefixed environments
Expand Down

0 comments on commit 2c0003f

Please sign in to comment.