Commit Graph

5 Commits

Author SHA1 Message Date
zzy
098e41d3e5 feat(cbuild): refactor and enhance C build system with new features
- Refactor logging system with simplified ColorFormatter and improved output formatting
- Add test command with regex pattern matching and timeout support
- Implement file size formatting utility for build output
- Remove unused imports and streamline code structure
- Update .gitignore to exclude external/ directory
- Improve error handling and subprocess management in test execution
- Optimize build dependency resolution with topological sorting
- Enhance configuration parsing and target management

The changes focus on code quality improvements, adding testing capabilities, and optimizing the build process for better performance and maintainability.
2025-12-10 22:21:37 +08:00
zzy
1ab07a5815 feat(cbuild): 重构依赖解析器并新增依赖树打印功能
- 修改 `DependencyResolver.resolve` 方法返回类型为 `None`,不再返回依赖映射副本
- 新增 `print_tree` 方法用于打印格式化的依赖树结构
- 调整 `get_sorted_dependencies` 和 `get_all_contexts` 返回值类型为 `PackageConfig` 列表
- 在 `CPackageBuilder.tree` 中调用新的 `print_tree` 方法以简化逻辑
- 添加 `DummyCompiler` 类作为占位编译器实现
- 优化 argparse 命令行参数结构,将通用参数移到子命令中
- 改进编译器初始化逻辑,增加对参数存在性的检查
- 移除 clean 子命令中的 --all 参数选项
2025-11-27 15:25:45 +08:00
zzy
ed829bdc21 feat(cbuild): 重构依赖解析器并增强命令行功能
- 将 `resolved_deps` 重命名为 `deps` 并新增 `dep_map` 用于存储依赖关系
- 新增 `get_dependencies_of` 方法以获取指定包的直接依赖列表
- 实现递归打印依赖树的功能,优化 `tree` 命令展示效果
- 引入分层命令行参数解析,支持子命令及更多选项(如 --record、--args 等)
- 改进日志输出与构建模式提示信息,使其更准确反映当前构建状态
- 编译器类中增加命令记录机制,便于调试和回溯执行过程
2025-11-27 12:15:45 +08:00
zzy
67af0c6bf2 feat(cbuild): 引入构建缓存机制与编译模式支持
新增了基于文件修改时间和内容哈希的构建缓存功能,能够有效避免不必要的重复编译。同时增加了多种编译模式(如 debug、release、test 等)及其对应的默认编译选项,提升了构建过程的灵活性和效率。

- 添加 `BuildCache` 类用于管理缓存逻辑
- 支持通过 `CompilerBuildMode` 枚举选择不同构建模式
- 在 `CPackageBuilder` 中集成缓存判断与更新流程
- 优化日志输出及部分代码结构以提升可读性
2025-11-22 17:03:48 +08:00
zzy
63f6f13883 feat(cbuild): 重构构建系统并迁移至 tools/cbuild
将 `cbuild.py` 迁移至 `tools/cbuild/` 并进行大量功能增强。引入依赖解析器、支持颜色日志输出、
改进包配置默认值处理、完善构建目标识别与拓扑排序依赖管理。同时添加 `.gitignore` 和
`pyproject.toml` 以支持标准 Python 包结构,并更新 README 文档。

新增命令支持:tree(显示依赖树)、clean(带文件统计)、test(运行测试)等,
优化了 Windows 平台下的可执行文件扩展名处理逻辑。

移除了旧的 `wc.py` 行数统计脚本。
2025-11-22 15:08:49 +08:00