Skip to content

Handle zephyr module generation#457

Merged
edriouk merged 3 commits into
mainfrom
cbuild2cmake-zephyr-module-generation
Apr 17, 2026
Merged

Handle zephyr module generation#457
edriouk merged 3 commits into
mainfrom
cbuild2cmake-zephyr-module-generation

Conversation

@brondani
Copy link
Copy Markdown
Collaborator

@brondani brondani commented Apr 17, 2026

Fixes

Changes

  • Add --zephyr, -z option for generation of zephyr modules from clayer components info

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

@brondani brondani requested a review from Copilot April 17, 2026 12:20
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-in --zephyr/-z generation mode to emit Zephyr module scaffolding (module.yml, Kconfig, CMakeLists.txt, sources.cmake) from clayer metadata and cbuild pack/component information, addressing devtools issue #2429.

Changes:

  • Add --zephyr/-z CLI flag and route generation through Maker.GenerateZephyrModules().
  • Introduce clayer parsing (ParseClayerFile(s)) and a Zephyr module generator (pkg/maker/zephyr.go) with unit tests.
  • Add small utility helpers (ExtractPackIdParts, CopyFile) and extend identifier normalization with ReplaceSpecialChars.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pkg/utils/utils.go Adds pack-id parsing helper and a simple file copy helper used by Zephyr generation.
pkg/utils/utils_test.go Adds tests for new utils helpers.
pkg/maker/zephyr.go Implements Zephyr module generation (module.yml, Kconfig, CMakeLists, sources.cmake) and file-path rewriting.
pkg/maker/zephyr_test.go Adds focused unit tests for Zephyr generation outputs and path rewriting.
pkg/maker/parser.go Adds clayer YAML model + parsing routines and extends cbuild-idx model to include clayers.
pkg/maker/maker.go Adds Options.Zephyr and short-circuits standard generation when enabled.
pkg/maker/buildcontent.go Adds ReplaceSpecialChars variant for identifiers that may include -.
pkg/maker/buildcontent_test.go Adds unit tests for ReplaceSpecialChars.
cmd/cbuild2cmake/commands/root.go Wires the --zephyr/-z flag into CLI options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/maker/zephyr.go
Comment thread pkg/maker/zephyr.go
Comment thread pkg/maker/parser.go
Comment thread pkg/maker/parser.go Outdated
Comment thread pkg/maker/zephyr.go
Comment thread pkg/maker/zephyr.go Outdated
Comment thread pkg/maker/zephyr.go Outdated
@qltysh
Copy link
Copy Markdown

qltysh Bot commented Apr 17, 2026

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on main by 0.87%.

Modified Files with Diff Coverage (6)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
pkg/maker/parser.go76.9%361-362, 374-375...
Coverage rating: A Coverage rating: A
pkg/utils/utils.go100.0%
Coverage rating: B Coverage rating: C
pkg/maker/maker.go50.0%77-78
Coverage rating: A Coverage rating: A
cmd/cbuild2cmake/commands/root.go100.0%
Coverage rating: B Coverage rating: B
pkg/maker/buildcontent.go100.0%
New Coverage rating: A
pkg/maker/zephyr.go92.2%41-42, 67, 81, 107...
Total90.7%
🤖 Increase coverage with AI coding...
In the `cbuild2cmake-zephyr-module-generation` branch, add test coverage for this new code:

- `pkg/maker/maker.go` -- Line 77-78
- `pkg/maker/parser.go` -- Lines 361-362, 374-375, and 379-380
- `pkg/maker/zephyr.go` -- Lines 41-42, 67, 81, 107, 122-123, 127-128, 132-133, 137-138, 159-160, 201-202, 221-222, and 362-363

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

  6 files  ± 0   18 suites  ±0   1s ⏱️ ±0s
109 tests +10  109 ✅ +10  0 💤 ±0  0 ❌ ±0 
654 runs  +60  654 ✅ +60  0 💤 ±0  0 ❌ ±0 

Results for commit a1a9487. ± Comparison against base commit f92f316.

@brondani brondani marked this pull request as ready for review April 17, 2026 13:43
@brondani brondani requested a review from edriouk April 17, 2026 13:44
Copy link
Copy Markdown

@edriouk edriouk left a comment

Choose a reason for hiding this comment

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

LGTM

@edriouk edriouk merged commit 386f4f3 into main Apr 17, 2026
25 checks passed
@edriouk edriouk deleted the cbuild2cmake-zephyr-module-generation branch April 17, 2026 14:06
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.

3 participants