已合并
feat: build.sh 按配置变更自动决定是否清理缓存 #173
feat: build.sh 按配置变更自动决定是否清理缓存 #173
已合并
fujun19创建于 6月17日
fujun19成员
6月17日

描述

原来每次构建都无条件删除 build/ 目录,导致无法利用增量编译,每次均为全量构建。

改为读取 CMakeCache.txt 中的关键编译参数(CMAKE_BUILD_TYPEENABLE_EXPERIMENTALENABLE_ASAN),仅在这些值发生变化时才清理缓存,其余情况复用已有构建产物。

用户无需感知清理时机,脚本自动判断:

  • 编译参数未变(包括混用 --torch/--pkg)→ 增量构建
  • --build-type--experimental--asan 有变化 → 自动全量清理后重建
  • 首次构建或 build/ 不存在 → 直接创建,正常构建

如何测试

  1. 执行 bash build.sh --torch,记录编译时间
  2. 再次执行 bash build.sh --torch,确认复用缓存,编译时间明显缩短
  3. 执行 bash build.sh --torch --build-type=Debug,确认输出 Build config changed, cleaning build cache... 并全量重建
  4. 混用 bash build.sh --pkgbash build.sh --torch,确认无问题

文档更新

无需更新文档。

类型标签

  • Bug修复
  • 新特性
  • 性能优化
  • 文档更新
  • 代码重构
  • 其他,请描述:
likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 fujun19 的贡献)
CANN-robotCANN-robot成员
6月17日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
6月17日 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here
You can get sig-info at here


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/amct zhuliangying, 姚广修 (2/2) zhuliangying (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

fujun19, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
fujun19成员
6月17日 评论:

compile

likedislike
CANN-robotCANN-robot成员
6月17日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6月17日 评论:

流水线任务触发成功
任务链接 [d14b5f67b69e4e938c6ce785eff36a8f][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
cocheck_codestyle ✅ SUCCESS
precommit ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_torch ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_torch_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_torch ✅ SUCCESS >>>>> >>>>>
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
UT_Test ✅ SUCCESS >>>>>
PreSmoke_A900 ✅ SUCCESS >>>>>

[2026-06-17 16:00:18]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6月17日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6月17日 添加了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
6月17日 评论:
流水线 PR-pipeline_cann_amct#935 [ commitID:f74b3670 ] 已完成
likedislike
yaoguangxiu成员
6月17日 评论:

/lgtm

likedislike
zhuliangying成员
6月22日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
6月22日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
6月22日 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
6月22日 评论:

The following label is not ready.

ci-pipeline-passed: The ci-pipeline-passed label is expired. Please compile again.

likedislike
fujun19成员
6月22日 评论:

compile

likedislike
CANN-robotCANN-robot成员
6月22日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6月22日 评论:

流水线任务触发成功
任务链接 [73735d405b204d75995715edafecc23c][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
cocheck_codestyle ✅ SUCCESS
precommit ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_torch ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_torch_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_torch ✅ SUCCESS >>>>> >>>>>
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
UT_Test ✅ SUCCESS >>>>>
PreSmoke_A900 ✅ SUCCESS >>>>>

[2026-06-22 20:35:03]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6月22日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6月22日 添加了label:ci-pipeline-passed
CANN-robotCANN-robot成员
6月22日 合入了pull request