Skip to content

Commit

Permalink
🔨 Use 'build_src_filter' (MarlinFirmware#25810)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and oponyx committed May 12, 2023
1 parent 852c34e commit e86df3d
Show file tree
Hide file tree
Showing 2 changed files with 244 additions and 244 deletions.
22 changes: 11 additions & 11 deletions buildroot/share/PlatformIO/scripts/common-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def add_to_feat_cnf(feature, flines):
for line in atoms:
parts = line.split('=')
name = parts.pop(0)
if name in ['build_flags', 'extra_scripts', 'src_filter', 'lib_ignore']:
if name in ['build_flags', 'extra_scripts', 'build_src_filter', 'lib_ignore']:
feat[name] = '='.join(parts)
blab("[%s] %s=%s" % (feature, name, feat[name]), 3)
else:
Expand Down Expand Up @@ -130,7 +130,7 @@ def force_ignore_unused_libs():
def apply_features_config():
load_features()
blab("========== Apply enabled features...")
build_filters = ' '.join(env.GetProjectOption('src_filter'))
build_filters = ' '.join(env.GetProjectOption('build_src_filter'))
for feature in FEATURE_CONFIG:
if not env.MarlinHas(feature):
continue
Expand Down Expand Up @@ -175,9 +175,9 @@ def apply_features_config():
blab("Running extra_scripts for %s... " % feature, 2)
env.SConscript(feat['extra_scripts'], exports="env")

if 'src_filter' in feat:
if 'build_src_filter' in feat:
blab("========== Adding build_src_filter for %s... " % feature, 2)
build_filters = build_filters + ' ' + feat['src_filter']
build_filters = build_filters + ' ' + feat['build_src_filter']
# Just append the filter in the order that the build environment specifies.
# Important here is the order of entries in the "features.ini" file.

Expand All @@ -186,7 +186,7 @@ def apply_features_config():
lib_ignore = env.GetProjectOption('lib_ignore') + [feat['lib_ignore']]
set_env_field('lib_ignore', lib_ignore)

src_filter = ""
build_src_filter = ""
if True:
# Build the actual equivalent build_src_filter list based on the inclusions by the features.
# PlatformIO doesn't do it this way, but maybe in the future....
Expand Down Expand Up @@ -247,16 +247,16 @@ def filt(x):
cur_srcs = set(filter(filt, cur_srcs))
# Transform the resulting set into a string.
for x in cur_srcs:
if len(src_filter) > 0: src_filter += ' '
src_filter += "+<" + x + ">"
if len(build_src_filter) > 0: build_src_filter += ' '
build_src_filter += "+<" + x + ">"

#blab("Final src_filter: " + src_filter)
#blab("Final build_src_filter: " + build_src_filter)
else:
src_filter = build_filters
build_src_filter = build_filters

# Update in PlatformIO
set_env_field('build_src_filter', [src_filter])
env.Replace(SRC_FILTER=src_filter)
set_env_field('build_src_filter', [build_src_filter])
env.Replace(SRC_FILTER=build_src_filter)

#
# Use the compiler to get a list of all enabled features
Expand Down
Loading

0 comments on commit e86df3d

Please sign in to comment.