Skip to content

Conversation

Jason2866
Copy link

@Jason2866 Jason2866 commented Sep 19, 2025

Refactor source path handling and improve library ignore entry retrieval.

Description:

**Fix compile issues with some idf managed components

Checklist:

  • The pull request is done against the latest develop branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR, more changes are allowed when changing boards.json
  • I accept the CLA

Summary by CodeRabbit

  • Bug Fixes

    • Skips rule files and known dummy sources during compilation to prevent duplicate or unnecessary build actions.
    • Simplifies path handling for source files, reducing edge-case errors in resolving relative paths.
    • Improves handling of ignored components for better compatibility across different component manager versions.
  • Chores

    • Minor whitespace cleanup with no functional impact.

Refactor source path handling and improve library ignore entry retrieval.
Copy link

coderabbitai bot commented Sep 19, 2025

Walkthrough

Updates in builder/frameworks/espidf.py adjust compile_source_files to skip .rule and dummy_src.c files and to avoid reassigning src_path inside a branch. get_lib_ignore_components now conditionally calls a public get_lib_ignore_entries if available, otherwise falls back to _get_lib_ignore_entries. Minor whitespace cleanup in get_python_exe.

Changes

Cohort / File(s) Summary
Compile source filtering and path handling
builder/frameworks/espidf.py
In compile_source_files: skip sources ending with .rule and basename dummy_src.c; stop reassigning src_path within compile_group_idx branch; continue using initially resolved src_path for path resolution.
Library ignore retrieval compatibility
builder/frameworks/espidf.py
In get_lib_ignore_components: try callable get_lib_ignore_entries on LibraryIgnoreHandler, else fallback to _get_lib_ignore_entries for cross-version compatibility.
Whitespace cleanup
builder/frameworks/espidf.py
Removed an empty line in get_python_exe (no behavioral change).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant B as Build System
  participant F as compile_source_files
  participant FS as FileSystem

  B->>F: Iterate source files
  F->>FS: Read next source path
  alt path endswith ".rule" OR basename == "dummy_src.c"
    F-->>B: Skip adding compile action
  else path needs resolution
    F->>FS: Resolve path using pre-evaluated src_path
    F-->>B: Add compile action
  end
Loading
sequenceDiagram
  autonumber
  participant C as get_lib_ignore_components
  participant H as LibraryIgnoreHandler

  C->>H: Check for get_lib_ignore_entries()
  alt public method exists and callable
    C->>H: get_lib_ignore_entries()
    H-->>C: ignore entries
  else
    C->>H: _get_lib_ignore_entries()
    H-->>C: ignore entries
  end
  C-->>C: Return collected entries
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

In burrows of bits where compilers chew,
I nibbled out rules that shouldn’t accrue.
Dummy crumbs gone, the path stays true,
Ignores fetched smart, old or new.
Thump-thump, I build with lighter hue—
A rabbit’s hop through CI’s queue. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Refactor source path checks and library ignore logic" is a concise, single-sentence summary that accurately describes the primary changes shown in the diff and PR objectives (source path handling and library-ignore retrieval), and it is specific and meaningful for teammates scanning history.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refac_comp_build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Jason2866
Copy link
Author

Jason2866 commented Sep 19, 2025

@coderabbitai full review

Copy link

coderabbitai bot commented Sep 19, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
builder/frameworks/espidf.py (2)

1026-1031: Nit: make the .rule and dummy file checks robust (case-insensitive, Path usage).

Prevents surprises on case-insensitive filesystems and keeps style consistent with Path usage in this function.

-        src_path = source["path"]
-        if src_path.endswith(".rule"):
+        src_path = source["path"]
+        if src_path.lower().endswith(".rule"):
             continue
-        # Always skip dummy_src.c to avoid duplicate build actions
-        if os.path.basename(src_path) == "dummy_src.c":
+        # Always skip dummy_src.c to avoid duplicate build actions
+        if Path(src_path).name.lower() == "dummy_src.c":
             continue

1136-1144: Library ignore retrieval: use public+legacy fallback, normalize output, and catch AttributeError.

  • Verified: class LibraryIgnoreHandler and _get_lib_ignore_entries exist in builder/frameworks/component_manager.py (class ≈ line 531, _get_lib_ignore_entries ≈ line 605).
  • Apply: getattr for "get_lib_ignore_entries" and "_get_lib_ignore_entries", call whichever is callable (call get_entries() — not get_entries()()), return a deduped/sanitized sorted list of non-empty strings (e.g. sorted({e.strip() for e in lib_ignore_entries if isinstance(e, str) and e.strip()})), and include AttributeError in the except clause.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41b3d0b and 286c820.

📒 Files selected for processing (1)
  • builder/frameworks/espidf.py (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#281
File: builder/frameworks/component_manager.py:1047-1054
Timestamp: 2025-09-04T15:27:18.112Z
Learning: In the pioarduino/platform-espressif32 project, Jason2866 prefers not to add guard checks for missing arduino_libs_mcu in backup operations, preferring to let the operation proceed rather than silently skip when the directory might be missing.
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#263
File: platform.py:80-84
Timestamp: 2025-08-20T14:13:13.842Z
Learning: For the pioarduino/platform-espressif32 project, Jason2866 prefers to always override IDF_TOOLS_PATH environment variable with PlatformIO's core directory, rather than respecting any existing user-defined IDF_TOOLS_PATH values. This ensures consistent ESP32 tool management within PlatformIO.
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#268
File: builder/penv_setup.py:87-96
Timestamp: 2025-08-26T14:52:29.044Z
Learning: For the pioarduino/platform-espressif32 project, Jason2866 prefers to trust system executables when falling back to PATH-based command resolution (like "uv"), rather than implementing additional validation checks for security concerns.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: build (macos-15, examples/espidf-ulp-lp)
  • GitHub Check: build (macos-15, examples/espidf-http-request)
  • GitHub Check: build (macos-15, examples/espidf-arduino-matter-light)
  • GitHub Check: build (macos-15, examples/espidf-blink)
  • GitHub Check: build (windows-latest, examples/espidf-peripherals-usb)
  • GitHub Check: build (macos-15, examples/arduino-blink)
  • GitHub Check: build (windows-latest, examples/espidf-hello-world)
  • GitHub Check: build (windows-latest, examples/arduino-zigbee-switch)
  • GitHub Check: build (windows-latest, examples/espidf-storage-sdcard)
  • GitHub Check: build (windows-latest, examples/arduino-blink)
  • GitHub Check: build (windows-latest, examples/espidf-blink)
  • GitHub Check: build (windows-latest, examples/arduino-zigbee-light)
  • GitHub Check: build (windows-latest, examples/arduino-matter-light)
  • GitHub Check: build (windows-latest, examples/arduino-wifiscan)
  • GitHub Check: build (windows-latest, examples/arduino-NimBLE-ext_client)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-blink)
  • GitHub Check: build (ubuntu-latest, examples/arduino-wifiscan)
  • GitHub Check: build (ubuntu-latest, examples/tasmota)
  • GitHub Check: build (ubuntu-latest, examples/arduino-blink)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-matter-light)

@Jason2866 Jason2866 merged commit bd8c76b into develop Sep 19, 2025
1 check passed
@Jason2866 Jason2866 deleted the refac_comp_build branch September 19, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant