Skip to content

fix(build): keep spotless from walking into build/ so the release job builds again - #20

Merged
doublepi123 merged 2 commits into
mainfrom
fix/spotless-build-symlink
Oct 18, 2026
Merged

doublepi123 merged 2 commits into
mainfrom
fix/spotless-build-symlink

Conversation

@doublepi123

Copy link
Copy Markdown
Owner

The release workflow has failed since #17 (runs 39092981684 and 39094290993, the second one for dp7) before building anything:

Execution failed for task ':spotlessKotlin'.
> Couldn't follow symbolic link '.../build/termux-packages/disabled-packages/protobuf-static/retain-linker-array.patch'.

release.yml checks termux-packages out under build/ before spotlessCheck. Spotless's targetExclude only filters files after it has walked the tree, and that walk trips over termux-packages' dangling symlinks. PR CI never checks termux-packages out, so it stayed green.

The Spotless targets are now a fileTree that excludes **/build/**, **/.gradle/** and .worktree/**, so Gradle prunes those directories during the walk instead of filtering them afterwards. Excluding .worktree/ also stops spotlessApply in the main checkout from touching other branches' worktrees.

Verified locally

  • With a dangling symlink under build/, spotlessCheck fails with the same error before the change and passes after it.
  • A badly formatted file under app/src/main/java still fails spotlessCheck, so no sources dropped out of the check.
  • detekt passes.

After merge, dp7 will be released with workflow_dispatch (tag v1.2.27-dp7). .release-version already says dp7 on main.

Pre-PR review

Reviewed at db7588b: APPROVE. The follow-up commit only adds the comment the review suggested. Report:

判定: APPROVE

ブロッカー

なし

提案(非ブロッキング)

  • .github/workflows/release.yml:91 — 根本原因は termux-packages をリポジトリ内の build/termux-packages に clone していることです(scripts/build_android_runtime_native_debs.sh:80 の既定値)。今回の修正で Spotless は直りますが、今後リポジトリ全体を走査するツールを追加すると同じ問題がまた起きる可能性があります。多重の備えとして、TERMUX_PACKAGES_DIR="$RUNNER_TEMP/termux-packages" のようにツリー外へ置く手もあります。ただし fdroiddata の srclib とそろえる意図があれば現状のままで構いません。今回の PR の範囲外です。
  • build.gradle.kts:32-33 のコメントは「ツリー走査後のフィルタではなく、走査そのものから外す」理由を説明しています。ここに、target(String) / targetExclude に戻すと再発する旨を一言足すと、後から誰かが元に戻す事故を防ぎやすくなります。任意です。

チェック済み項目

  • 差分の範囲: merge-base は 5a9b8084、変更は build.gradle.kts のみ(+10/−4)。全 hunk を読みました。
  • 対象ファイル集合が以前と同等か
    • 以前の target("**/*.kt") + targetExclude("**/build/**") に対し、新しい include/exclude で外れる追加分は **/.gradle/** と .worktree/** だけです。
    • .gradle/ は .gitignore に入っており、追跡対象の .kt/.kts はありません。
    • .worktree/ は .gitignore:10 に入っている、別ブランチのチェックアウトです。むしろ以前は、メインツリーで spotless を実行すると他ブランチのファイルまで検査・spotlessApply で書き換えてしまう余地がありました。除外は妥当で、改善です。
  • benchmark/ と buildSrc
    • settings.gradle.kts に含まれるのは :app と :benchmark だけで、buildSrc も included build もありません。
    • benchmark/build.gradle.kts と benchmark/src/main/java/** はルートの fileTree の include に入るので、引き続き対象です。
    • app/src/github/** などフレーバー別ソースも対象に入ることを glob で確認しました。
    • runtime_tools/、scripts/、pages/、docs/、config/、gradle/、.github/、.opencode/ には .kt/.kts がありません。node_modules もありません。
    • **/build/** の exclude に巻き込まれる、build という名前のソースパッケージはありません({app,benchmark}/src/**/build/** を glob で確認、該当なし)。
  • exclude したディレクトリに降りないか: Gradle の DirectoryFileTree は、exclude spec に合うディレクトリをサブツリーごと刈り込みます。build/** 形式の Ant パターンは build ディレクトリ自体にもマッチするので、build/termux-packages 内の壊れたシンボリックリンクにはたどり着きません。修正前に再現し、修正後は成功したというローカル検証の結果とも一致します。
  • .git の扱い: 文字列ターゲットから FileTree に替えたことで Spotless 独自の追加除外は付かなくなりますが、.git は Gradle の既定除外に含まれるので問題ありません。
  • Kotlin DSL の妥当性: トップレベルの fun spotlessSources は ConfigurableFileTree を返し、target(Object...) は FileCollection を受け取れます。ktlint(kotlinGradle)がこの build script 自体を検査して通ることは、作成者の spotlessCheck 通過報告で確認しました(シェル実行が権限で拒否されたため、私自身は再実行していません)。
  • 他の CI ワークフローへの影響: リポジトリに ci.yml はなく、同じ役割は android.yml と pr-apk-build.yml が担っています。どちらもクリーンなチェックアウトで ./gradlew detekt spotlessCheck を実行します。build/generated/runtime-* のキャッシュ復元が先に走る場合も、その場所はもともと除外対象です。対象集合は実質同じなので、悪い影響はありません。
  • detekt への影響: detekt の既定 source は各プロジェクトの src/... なので、ルートの build/ は走査されず、今回の問題とは関係ありません。
  • リポジトリのルール
    • i18n、テスト、ViewModel/DI の変更はなく、シークレットもありません。
    • ブランチはワークツリー .worktree/fix/spotless-build-symlink 上にあり、origin/main 5a9b808 を親にした 1 コミットです。

… builds again

The release workflow checks termux-packages out under build/ before
running spotlessCheck. targetExclude only filters after Spotless has
walked the tree, and that walk fails on termux-packages' dangling
symlinks (disabled-packages/protobuf-static/retain-linker-array.patch),
so every release since 09a331b failed before building. Exclude build/,
.gradle/ and .worktree/ from the file tree itself.
@doublepi123
doublepi123 merged commit 966dc61 into main Oct 18, 2026
5 checks passed
@doublepi123
doublepi123 deleted the fix/spotless-build-symlink branch October 18, 2026 03:55
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.

1 participant