Conversation
There was a problem hiding this comment.
Pull request overview
This PR simplifies the header export mechanism by replacing a multi-conditional approach with a single, explicit property-based system. The change aims to make header exports "safer" by requiring explicit configuration.
Key Changes:
- Replaces three conditional checks (
cpp-root-include,cpp-excluded, LIB type default) with a singleexport-headersproperty check - Changes from implicit parent directory inclusion for libraries to explicit path specification
- Removes automatic header export behavior for library components
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cutekit/builder.py
Outdated
| elif c.type == model.Kind.LIB: | ||
| res.add(str(Path(c.dirname()).parent)) | ||
| if "export-headers" in c.props: | ||
| res.add(str(Path(c.dirname()) / c.props["export-headers"])) |
There was a problem hiding this comment.
The new implementation doesn't validate that the path specified in c.props["export-headers"] exists or is a valid directory. Consider adding validation to ensure the exported header path exists and is accessible, to provide better error messages when components are misconfigured.
For example, you could add a check like:
header_path = Path(c.dirname()) / c.props["export-headers"]
if not header_path.exists():
_logger.warning(f"Component {c.id} specifies non-existent export-headers path: {header_path}")This would help developers catch configuration errors early rather than encountering cryptic compilation errors later.
| res.add(str(Path(c.dirname()) / c.props["export-headers"])) | |
| header_path = Path(c.dirname()) / c.props["export-headers"] | |
| if header_path.exists() and header_path.is_dir(): | |
| res.add(str(header_path)) | |
| else: | |
| _logger.warning( | |
| "Component %s specifies non-existent or invalid export-headers path: %s", | |
| getattr(c, "id", "<unknown>"), | |
| header_path, | |
| ) |
| continue | ||
| res.add(str(headerPath)) | ||
|
|
||
| # TODO: Remove when we get 1.0 (will probably be forgotten anyway :^) ) |
aa14593 to
890f83e
Compare
No description provided.