Repository navigation
fix(build): keep spotless from walking into build/ so the release job builds again - #20
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The release workflow has failed since #17 (runs 39092981684 and 39094290993, the second one for dp7) before building anything:
release.ymlchecks termux-packages out underbuild/beforespotlessCheck. Spotless'stargetExcludeonly 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
fileTreethat excludes**/build/**,**/.gradle/**and.worktree/**, so Gradle prunes those directories during the walk instead of filtering them afterwards. Excluding.worktree/also stopsspotlessApplyin the main checkout from touching other branches' worktrees.Verified locally
build/,spotlessCheckfails with the same error before the change and passes after it.app/src/main/javastill failsspotlessCheck, so no sources dropped out of the check.detektpasses.After merge, dp7 will be released with
workflow_dispatch(tagv1.2.27-dp7)..release-versionalready 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に戻すと再発する旨を一言足すと、後から誰かが元に戻す事故を防ぎやすくなります。任意です。チェック済み項目
5a9b8084、変更はbuild.gradle.ktsのみ(+10/−4)。全 hunk を読みました。target("**/*.kt")+targetExclude("**/build/**")に対し、新しい include/exclude で外れる追加分は**/.gradle/**と.worktree/**だけです。.gradle/は.gitignoreに入っており、追跡対象の.kt/.ktsはありません。.worktree/は.gitignore:10に入っている、別ブランチのチェックアウトです。むしろ以前は、メインツリーで spotless を実行すると他ブランチのファイルまで検査・spotlessApplyで書き換えてしまう余地がありました。除外は妥当で、改善です。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 で確認、該当なし)。build/**形式の Ant パターンはbuildディレクトリ自体にもマッチするので、build/termux-packages内の壊れたシンボリックリンクにはたどり着きません。修正前に再現し、修正後は成功したというローカル検証の結果とも一致します。.gitの扱い: 文字列ターゲットから FileTree に替えたことで Spotless 独自の追加除外は付かなくなりますが、.gitは Gradle の既定除外に含まれるので問題ありません。fun spotlessSourcesはConfigurableFileTreeを返し、target(Object...)は FileCollection を受け取れます。ktlint(kotlinGradle)がこの build script 自体を検査して通ることは、作成者のspotlessCheck通過報告で確認しました(シェル実行が権限で拒否されたため、私自身は再実行していません)。ci.ymlはなく、同じ役割はandroid.ymlとpr-apk-build.ymlが担っています。どちらもクリーンなチェックアウトで./gradlew detekt spotlessCheckを実行します。build/generated/runtime-*のキャッシュ復元が先に走る場合も、その場所はもともと除外対象です。対象集合は実質同じなので、悪い影響はありません。src/...なので、ルートのbuild/は走査されず、今回の問題とは関係ありません。.worktree/fix/spotless-build-symlink上にあり、origin/main5a9b808 を親にした 1 コミットです。