chore(mp-harmony): 移除 ascf_build 下的构建产物 (rawfile + Index.ets)

背景:
  上一个 commit 把 ascf_build 整个目录的元数据纳入 git, 但误把
  每次构建都会变化的产物也入仓了:
    - rawfile/index.js: 每次 DevEco Build 重新生成 (含 webpack chunk id, hash 等)
    - rawfile/<root>/diy-*.pack.js: 同上
    - rawfile/<root>/placeholder/index.html + index.pack.js: 同上
    - Index.ets: 5 个包都是 0 字节空壳, 没有任何内容

  这些文件应该被 .gitignore 排除, 避免每次 DevEco Build 后 git
  status 都会报告 "modified", 污染 diff。

改动:
  1. .gitignore 改造
     - rawfile/** 整体 ignore (鸿蒙端每次 Build 重新生成)
     - Index.ets ignore (空壳, 0 字节)
     - 移除之前的 ! 兜底规则 (rawfile/**/placeholder/index.*,
       rawfile/index.js, base/element/*.json 等), 因为这些都
       已经在 rawfile/ 下被整体 ignore
  2. 从 git 历史删除 12 个误入的产物文件 (5 个 Index.ets +
     5 个 rawfile/index.js + 1 个 placeholder/index.html +
     1 个 placeholder/index.pack.js), 保留在工作树

仍然入 git 的 ascf_build 关键文件 (每次 commit 都更新):
  - oh-package.json5
  - build-profile.json5
  - hvigorfile.ts
  - obfuscation-rules.txt
  - src/main/module.json5
  - src/main/resources/base/element/string.json
This commit is contained in:
2026-07-30 14:36:14 +08:00
parent 6f0d6a9f59
commit d1c58f2ec8
13 changed files with 17 additions and 1943 deletions

42
.gitignore vendored
View File

@@ -20,18 +20,24 @@
stub-app-projects/mp-harmony/ascf/ascf_src
stub-app-projects/mp-harmony/entry/src/main/resources/rawfile
# ascf_build/<pkg>/ 是 HAR 包定义 (有源文件 + uniapp 编译产物)
# 策略: 不整体 ignore, 只精确 ignore 已知的产物路径
# - rawfile/<root>/diy-*.pack.js / *.html: uniapp 编译产物, vue.config.js 拷过来
# - rawfile/index.js: 也是产物 (HAR 入口脚本, 每次构建覆盖)
# - build/: hvigor 中间产物
# - oh_modules/: ohpm 同步产物
# - .preview/, .cxx/, .test/: 预览 / native 中间产物
# ascf_build/<pkg>/ 是 HAR 包定义
# 区分两类内容:
# 1. 必须入 git (元数据 / 构建配置 / HAR 入口):
# - oh-package.json5, build-profile.json5, hvigorfile.ts
# - obfuscation-rules.txt, src/main/module.json5
# - src/main/resources/base/element/string.json (HAR i18n)
# 2. 每次构建覆盖 (不应入 git):
# - src/main/resources/rawfile/** : 鸿蒙端从 ascf_src 同步的编译产物
# - Index.ets : 空壳文件, 无内容
# - build/, oh_modules/, .preview/, .cxx/, .test/, node_modules/
# 关键产物 (每次构建覆盖, 不应入仓)
stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/*.pack.js
stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/*.html
stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/*.json
# rawfile/ 整体 ignore (鸿蒙端每次 Build 重新生成)
stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**
# Index.ets 是空壳 (每个包都是 0 字节), 不入 git
stub-app-projects/mp-harmony/ascf/ascf_build/**/Index.ets
# 其他产物目录
stub-app-projects/mp-harmony/ascf/ascf_build/**/build
stub-app-projects/mp-harmony/ascf/ascf_build/**/oh_modules
stub-app-projects/mp-harmony/ascf/ascf_build/**/.preview
@@ -39,20 +45,6 @@ stub-app-projects/mp-harmony/ascf/ascf_build/**/.cxx
stub-app-projects/mp-harmony/ascf/ascf_build/**/.test
stub-app-projects/mp-harmony/ascf/ascf_build/**/node_modules
# 但 placeholder/ 下的 index.pack.js / index.html 是 HAR 必需, 保留
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/placeholder/index.pack.js
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/placeholder/index.html
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/placeholder/index.json
# 但根 rawfile/ 下的 index.js 是 HAR 入口, 保留
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/index.js
# base/element/string.json 是 HAR i18n, 保留
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/base/element/*.json
# 但 rawfile/ 是 ignore **/*.json 的子目录, 上面那条也针对 rawfile/base/element 取消 ignore
# base/ 在 rawfile/ 之外, 单独处理
!stub-app-projects/mp-harmony/ascf/ascf_build/**/base/element/*.json
# entry 下的产物
stub-app-projects/mp-harmony/entry/build
stub-app-projects/mp-harmony/entry/oh_modules