Skip to content

Commit f9bfcce

Browse files
committed
Fix disabled usermod presence validation
PlatformIO doesn't clean out the libdir when usermods are disabled, so they still appear in the LibBuilders() set. Ensure that we validate only usermods that were actually deps for the build.
1 parent d2d5c42 commit f9bfcce

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

pio-scripts/load_usermods.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,18 @@ def wrapped_ConfigureProjectLibBuilder(xenv):
7777
for dep in result.depbuilders:
7878
cached_add_includes(dep, processed_deps, extra_include_dirs)
7979

80+
wled_deps = [dep for dep in result.depbuilders if is_wled_module(dep)]
81+
8082
broken_usermods = []
81-
for dep in result.depbuilders:
82-
if is_wled_module(dep):
83-
# Add the wled folder to the include path
84-
dep.env.PrependUnique(CPPPATH=str(wled_dir))
85-
# Add WLED's own dependencies
86-
for dir in extra_include_dirs:
87-
dep.env.PrependUnique(CPPPATH=str(dir))
88-
# Enforce that libArchive is not set; we must link them directly to the executable
89-
if dep.lib_archive:
90-
broken_usermods.append(dep)
83+
for dep in wled_deps:
84+
# Add the wled folder to the include path
85+
dep.env.PrependUnique(CPPPATH=str(wled_dir))
86+
# Add WLED's own dependencies
87+
for dir in extra_include_dirs:
88+
dep.env.PrependUnique(CPPPATH=str(dir))
89+
# Enforce that libArchive is not set; we must link them directly to the executable
90+
if dep.lib_archive:
91+
broken_usermods.append(dep)
9192

9293
if broken_usermods:
9394
broken_usermods = [usermod.name for usermod in broken_usermods]
@@ -97,6 +98,9 @@ def wrapped_ConfigureProjectLibBuilder(xenv):
9798
err=True)
9899
Exit(1)
99100

101+
# Save the depbuilders list for later validation
102+
xenv.Replace(WLED_MODULES=wled_deps)
103+
100104
return result
101105

102106
# Apply the wrapper

pio-scripts/validate_modules.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ def validate_map_file(source, target, env):
5353
secho(f"ERROR: Map file not found: {map_file_path}", fg="red", err=True)
5454
Exit(1)
5555

56-
# Identify the WLED module source directories
57-
module_lib_builders = [builder for builder in env.GetLibBuilders() if is_wled_module(env, builder)]
56+
# Identify the WLED module builders, set by load_usermods.py
57+
module_lib_builders = env['WLED_MODULES']
5858

59+
# Filter/warn if an incompatible usermod was requested
5960
if env.GetProjectOption("custom_usermods","") == "*":
6061
# All usermods build; filter non-platform-OK modules
6162
module_lib_builders = [builder for builder in module_lib_builders if env.IsCompatibleLibBuilder(builder)]

0 commit comments

Comments
 (0)