Skip to content

Commit bd8c76b

Browse files
authored
Refactor source path checks and library ignore logic (#294)
Refactor source path handling and improve library ignore entry retrieval.
1 parent 41b3d0b commit bd8c76b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

builder/frameworks/espidf.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,11 +1023,14 @@ def compile_source_files(
10231023
# Canonical, symlink-resolved absolute path of the components directory
10241024
components_dir_path = (Path(FRAMEWORK_DIR) / "components").resolve()
10251025
for source in config.get("sources", []):
1026-
if source["path"].endswith(".rule"):
1026+
src_path = source["path"]
1027+
if src_path.endswith(".rule"):
1028+
continue
1029+
# Always skip dummy_src.c to avoid duplicate build actions
1030+
if os.path.basename(src_path) == "dummy_src.c":
10271031
continue
10281032
compile_group_idx = source.get("compileGroupIndex")
10291033
if compile_group_idx is not None:
1030-
src_path = source.get("path")
10311034
if not os.path.isabs(src_path):
10321035
# For cases when sources are located near CMakeLists.txt
10331036
src_path = str(Path(project_src_dir) / src_path)
@@ -1130,7 +1133,10 @@ def get_lib_ignore_components():
11301133
lib_handler = _component_manager.LibraryIgnoreHandler(config, logger)
11311134

11321135
# Get the processed lib_ignore entries (already converted to component names)
1133-
lib_ignore_entries = lib_handler._get_lib_ignore_entries()
1136+
get_entries = getattr(lib_handler, "get_lib_ignore_entries", None)
1137+
lib_ignore_entries = (
1138+
get_entries() if callable(get_entries) else lib_handler._get_lib_ignore_entries()
1139+
)
11341140

11351141
return lib_ignore_entries
11361142
except (OSError, ValueError, RuntimeError, KeyError) as e:
@@ -1662,7 +1668,6 @@ def get_python_exe():
16621668
if not os.path.isfile(python_exe_path):
16631669
sys.stderr.write("Error: Missing Python executable file `%s`\n" % python_exe_path)
16641670
env.Exit(1)
1665-
16661671
return python_exe_path
16671672

16681673

0 commit comments

Comments
 (0)