From 946f09bfa8cb5da3432f817be709cbcd96543be9 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 20 Nov 2026 12:03:58 +0900 Subject: [PATCH] =?UTF-8?q?build(app-bootstrap):=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=EC=86=8C=20=ED=8C=8C=EC=9D=BC=20=ED=8A=B8=EB=A6=AC=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=EC=9D=B4=20=ED=8F=B4=EB=8D=94=20=ED=95=AD=EB=AA=A9?= =?UTF-8?q?=EC=9D=84=20=EC=A7=80=EB=AC=B8=EC=97=90=20=EB=84=A3=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :app-bootstrap:test가 실행되면 ApprovalTests가 leaf 폴더에 .approval_tests_temp/를 만든다. architectureTest의 scannedSources와 repositoryContractTest의 repositoryContractInputs는 그 폴더를 지나는 파일 트리라서 그 폴더가 DIR 항목으로 캐시 키에 들어간다. 그래서 두 시험의 키는 같은 빌드에서 test가 실행됐는지, 캐시에서 왔는지에 따라 달라진다. main done이 test를 실행해 저장하면 test를 캐시에서 받는 PR은 두 시험을 다시 돈다. 문서만 바꾼 PR run 404도 그랬다. - 저장소 파일 트리 입력 넷(documentContractInputs, repositoryContractInputs, scannedSources, securitySourcesAndBaseline)에 ignoreEmptyDirectories()를 붙인다. Gradle 9.0에서는 빈 폴더만이 아니라 모든 폴더 항목이 빠지고 파일만 남는다. 이 lane들의 시험은 파일만 판정한다. documentContractTest와 publicPathSnapshotTest는 main 단계라 늘 다시 돌지만, 같은 규칙으로 맞춘다. - docs/registries는 registryCatalog 입력(inputs.dir)으로 뗀다. RegistryGovernanceCatalog는 정규 파일이 아닌 자식과 모르는 파일을 거절한다. 폴더 항목을 빼면 README.md만 든 하위 폴더가 PR lane을 다시 돌리지 못한다. 그래서 이 폴더만 폴더 항목을 남기고, .md exclude도 걸지 않는다. 그 전에는 README.md 하나를 더해도 PR lane이 안 돌았다. - 그 폴더에는 ApprovalTests의 .gitignore, 로그 둘, 내려받은 스크립트 둘이 남는다. 지금은 어떤 include도 그 파일에 닿지 않는다. 그래도 include가 넓어질 때를 위해 repositoryContractExcludes에 그 폴더를 더한다. 버린 것: - 그 폴더 하나만 exclude: 다른 도구가 만드는 폴더에서 같은 모양이 다시 생긴다. - repositoryContractTest에 shouldRunAfter 'test': main done(test 실행)과 PR(test를 캐시에서 받음)의 차이는 실행 순서로 풀리지 않는다. 키가 폴더에 기대지 않으면 순서도 필요 없다. 위험과 한계: - 이 lane들은 폴더만 생기거나 사라지는 변경에 다시 돌지 않는다. 시험을 읽어 보니 폴더 검사는 .java·.yml을 모으기 전의 문이라, 폴더가 없을 때와 파일 없이 있을 때 결과가 같다. 예외인 docs/registries는 따로 입력으로 둔다. - Gradle 기본 exclude(.gitignore 등)는 registryCatalog에도 걸린다. docs/registries/.gitignore 하나는 PR에서 못 잡고 main documentContractTest가 잡는다. 이 변경 전에도 같았다. - 입력이 바뀌므로 병합 뒤 첫 main done에서 네 태스크가 한 번 다시 돈다. 검증(desktop, 기준 7e049c6f, 같은 경로 새 checkout, variant마다 빈 빌드 캐시, :prCheck --info -Dorg.gradle.caching.debug=true): - RED(main 그대로): 둘째 실행이 223 executed, 271 from cache였다. architectureTest·repositoryContractTest가 다시 돌았다. 첫 실행 지문에는 .approval_tests_temp 항목이 둘 있었다. - GREEN(이 변경): 둘째 실행이 221 executed, 273 from cache였다. 두 시험이 FROM-CACHE였고 :prCheck는 1분 12초에서 32초로 줄었다. - 같은 GREEN 트리에서 입력이 잡을 것은 잡는지 봤다. - 폴더에 ApprovalTests 파일 셋을 두면: 두 시험이 UP-TO-DATE. - docs/registries에 README.md만 든 하위 폴더를 두면: repositoryContractTest가 실행되고 "registry catalog child must be a regular file"로 실패. - main Java 소스에 주석 한 줄을 더하면: 두 시험이 실행. - scripts/verify.sh pr --no-cache rc=0(트리 80cb43e1, 530 executed, FROM-CACHE 0, 시험 7,269개). scripts/verify.sh main --no-cache rc=0 (바깥 빌드 446 executed, 시험 1,980개). main 단계 lane 둘의 입력 선언을 바꿔서 main도 돌렸다. Refs: design-docs ci/manual.md 5.5절, ci/03-time-reduction-plan.md BE-1 --- src/bootstrap/app/build.gradle | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/app/build.gradle b/src/bootstrap/app/build.gradle index d518cf32..d00bc45f 100644 --- a/src/bootstrap/app/build.gradle +++ b/src/bootstrap/app/build.gradle @@ -345,13 +345,25 @@ def repositoryRootForContractTests = rootProject.projectDir // Nor is the Python bytecode Git ignores: the root testDocumentChecks writes it under scripts/ in the // same build, so with it the lane's fingerprint changed between two runs of one tree and on every // fresh checkout (the files carry their source's modification time). +// Every whole-repository file-tree input below also leaves directories out: Gradle then drops every +// directory entry, not only empty ones, and keeps the files. :app-bootstrap:test writes +// .approval_tests_temp/ here (ApprovalTests' .gitignore, logs and the scripts it downloads) when it +// executes, not when it comes from the cache, so the architecture and repository-contract keys +// followed whether the same build had executed `test`, and a pull request missed main's entries. +// No include reaches those files today; the exclude keeps it that way when an include widens. +// These lanes judge files, not directories. The one directory rule, no subdirectory and no unknown +// file under docs/registries, keeps its own input (registryCatalog). def repositoryContractExcludes = ['**/build/**', '**/.gradle/**', '**/node_modules/**', '.claude/worktrees/**', - '**/__pycache__/**', '**/*.pyc'] + '**/__pycache__/**', '**/*.pyc', '**/.approval_tests_temp/**'] +// docs/registries/** are machine contracts, not prose: a malformed registry must fail the pull request +// (RegistrySchemaPullRequestGateTest), so the lane reruns when anything there changes. The catalog +// rejects any child that is not a regular file and any file it does not know, README.md included, so +// this input is the whole directory, directories too, with no exclude of ours. Gradle's default +// excludes (.gitignore and the like) still stay out; main's documentContractTest catches one there. +def registryCatalogInput = new File(repositoryRootForContractTests, 'docs/registries') def repositoryContractInputs = files( fileTree(repositoryRootForContractTests) { - // docs/registries/** are machine contracts, not prose: a malformed registry must fail - // the pull request (RegistrySchemaPullRequestGateTest), so the lane reruns when one changes. - include '.gitea/**', '.github/**', 'compose/**', 'scripts/**', '*.yml', '*.yaml', 'docs/registries/**', '*.example', '.tool-versions' + include '.gitea/**', '.github/**', 'compose/**', 'scripts/**', '*.yml', '*.yaml', '*.example', '.tool-versions' exclude '**/*.md' exclude repositoryContractExcludes }, @@ -386,6 +398,7 @@ strictTestLanes { customize { Test task -> task.inputs.files(documentContractInputs) .withPathSensitivity(PathSensitivity.RELATIVE) + .ignoreEmptyDirectories() .withPropertyName('documentContractInputs') } } @@ -396,7 +409,11 @@ strictTestLanes { customize { Test task -> task.inputs.files(repositoryContractInputs) .withPathSensitivity(PathSensitivity.RELATIVE) + .ignoreEmptyDirectories() .withPropertyName('repositoryContractInputs') + task.inputs.dir(registryCatalogInput) + .withPathSensitivity(PathSensitivity.RELATIVE) + .withPropertyName('registryCatalog') } } } @@ -416,7 +433,9 @@ tasks.named('architectureTest', Test) { include 'src/**/src/main/java/**/*.java', 'build-logic/src/main/java/**/*.java', 'src/bootstrap/app/src/architectureTest/java/**' exclude repositoryContractExcludes - }).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('scannedSources') + }).withPathSensitivity(PathSensitivity.RELATIVE) + .ignoreEmptyDirectories() + .withPropertyName('scannedSources') } tasks.named('conditionalTransportBuildContractTest', Test) { inputs.file('build.gradle').withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('buildScript') @@ -470,7 +489,9 @@ tasks.named('publicPathSnapshotTest', Test) { inputs.files(fileTree(rootProject.projectDir) { include 'src/**/src/main/java/**/*.java', 'docs/security/public-paths-snapshot.txt' exclude repositoryContractExcludes - }).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('securitySourcesAndBaseline') + }).withPathSensitivity(PathSensitivity.RELATIVE) + .ignoreEmptyDirectories() + .withPropertyName('securitySourcesAndBaseline') } tasks.register('stageDockerJar', Sync) { -- 2.54.0