build-logic 사본의 ModuleRegistry는 행마다 `build` 칸을 읽었다(템플릿의 두 번째 빌드용). 이 repo에는 빌드가 하나라, main이 아닌 값(오타 포함)을 적은 모듈은 settings가 include하지 않고 방향 검사도 보지 않는데 ci는 초록으로 남는다. 템플릿 구조 리뷰가 같은 구멍을 템플릿 쪽에서 찾았다. 칸이 있으면 read에서 실패한다. 시험은 칸이 없으면 main, 칸이 있으면 (빈 값 포함) 그 모듈 id와 'build'를 이름 대고 거절함을 본다. UPSTREAM.md 「고친 것」에 적었다. 검증: 템플릿에서 같은 시험이 고치기 전 실패(RED), 고친 뒤 통과(GREEN)를 desktop에서 봤다. 이 repo에서는 desktop ci(buildLogicTest 포함).
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
| `java/JavaConventionsPlugin` | `group`을 `gradle.properties`의 `libraryGroup`에서 읽는다(템플릿은 `dev.caskeleton` 고정). 버전은 `RELEASE_TAG`/`-PreleaseTag`(`vX.Y.Z`)에서도 읽는다. 이미지 목록·도구 설정은 루트의 `config/`만 본다 |
|
||||
| `quality/QualityConventionsPlugin` | 도구 설정은 루트의 `config/`만 본다 |
|
||||
| `convention/PlatformModuleConventionPlugin` | `ca.library-publishing`을 함께 켠다 |
|
||||
| `ModuleRegistry` | registry 행의 `build` 칸을 거절한다. main이 아닌 값(오타 포함)이면 그 모듈이 조용히 빌드에서 빠졌다. 템플릿 `91804ec1` 뒤 브랜치 `claude/x2-grpc-library-43dd09`에 같은 수정이 있다 |
|
||||
| `strictlane/StrictLaneStagesPlugin` | 단계의 계획을 따라갈 때 included build 태스크(`ci`가 부르는 build-logic `test`)는 묻지 않는다. 템플릿 `ci`에는 그런 의존이 없어 드러나지 않았다. 템플릿에도 옮길 만한 수정이다 |
|
||||
| 새 `publishing/LibraryPublishingPlugin`(`ca.library-publishing`) | 모듈마다 Maven publication(sources·javadoc jar, 해석된 버전), 저장소 `gitea`·`staging`, `SIGNING_KEY`가 있으면 PGP 서명 |
|
||||
| 테스트 fixture | `source_path`를 Gradle 루트 기준으로, `PlatformModuleConventionTest`에 `libraryGroup` |
|
||||
|
||||
@@ -108,7 +108,16 @@ public record ModuleRegistry(List<Module> modules, File source) {
|
||||
String id = requireNonBlankText(module, "id", index);
|
||||
String gradlePath = requireNonBlankText(module, "gradle_path", index);
|
||||
String sourcePath = requireNonBlankText(module, "source_path", index);
|
||||
String buildName = module.has("build") ? requireNonBlankText(module, "build", id) : "main";
|
||||
// Every module belongs to the one build. A row naming any other build (a typo included) would
|
||||
// be included by no settings and checked by no direction gate while ci stays green, so the
|
||||
// field is refused rather than read (the template's optional build, which used it, is gone).
|
||||
if (module.has("build")) {
|
||||
throw new IllegalStateException(
|
||||
"Module registry entry '"
|
||||
+ id
|
||||
+ "' has a 'build' field; every module belongs to the main build, so remove it.");
|
||||
}
|
||||
String buildName = "main";
|
||||
List<String> allowedDependencies =
|
||||
requireStringList(module.get("allowed_dependencies"), id, "allowed_dependencies");
|
||||
|
||||
|
||||
@@ -87,7 +87,17 @@ class ModuleRegistryTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildOwnershipDefaultsToMainAndCanSelectOptionalModules() throws Exception {
|
||||
void everyModuleBelongsToTheMainBuild() throws Exception {
|
||||
ModuleRegistry parsed = read(registry(entry("app-bootstrap", ":app-bootstrap", "src/alpha")));
|
||||
assertEquals("main", parsed.byId("app-bootstrap").buildName());
|
||||
assertEquals(List.of("app-bootstrap"), parsed.modulesForBuild("main").stream().map(ModuleRegistry.Module::id).toList());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aBuildFieldIsRejectedBecauseNoOtherBuildIncludesOrChecksTheModule() throws Exception {
|
||||
// The optional gRPC build was the only other build; it moved to its own repository on
|
||||
// 2026-11-08. A row naming any other build (a typo included) would be included by no settings
|
||||
// and checked by no direction gate, while ci stays green.
|
||||
Files.createDirectories(root.resolve("src/grpc/grpc-client"));
|
||||
String json =
|
||||
registry(
|
||||
@@ -96,15 +106,13 @@ class ModuleRegistryTest {
|
||||
{"id":"grpc-client","gradle_path":":grpc:grpc-client","source_path":"src/grpc/grpc-client",
|
||||
"allowed_dependencies":[],"build":"optional-grpc"}
|
||||
""");
|
||||
ModuleRegistry parsed = read(json);
|
||||
assertEquals("main", parsed.byId("app-bootstrap").buildName());
|
||||
assertEquals("optional-grpc", parsed.byId("grpc-client").buildName());
|
||||
assertEquals(List.of("app-bootstrap"), parsed.modulesForBuild("main").stream().map(ModuleRegistry.Module::id).toList());
|
||||
assertEquals(List.of("grpc-client"), parsed.modulesForBuild("optional-grpc").stream().map(ModuleRegistry.Module::id).toList());
|
||||
IllegalStateException failure = assertThrows(IllegalStateException.class, () -> read(json));
|
||||
assertTrue(failure.getMessage().contains("'grpc-client'"), failure.getMessage());
|
||||
assertTrue(failure.getMessage().contains("'build'"), failure.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void blankBuildOwnershipIsRefused() {
|
||||
void aBlankBuildFieldIsRefusedToo() {
|
||||
String json =
|
||||
"""
|
||||
{"modules":[
|
||||
@@ -112,7 +120,7 @@ class ModuleRegistryTest {
|
||||
"allowed_dependencies":[],"build":" "}]}
|
||||
""";
|
||||
IllegalStateException failure = assertThrows(IllegalStateException.class, () -> read(json));
|
||||
assertTrue(failure.getMessage().contains("nonblank string 'build'"), failure.getMessage());
|
||||
assertTrue(failure.getMessage().contains("'build' field"), failure.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user