Files
messaging-library/messaging/messaging-kafka/build.gradle
T
DongHyeonka c9733223a6 refactor(repo)!: 들여온 플랫폼을 src/platforms 아래로 묶는다
문제: src/ 최상위에 계층 폴더와 들여온 제품 폴더(messaging, grpc,
grpc-advanced)와 optional 빌드 폴더(optional-platforms)가 같은 높이로
놓여, 무엇이 이 애플리케이션의 계층인지 폴더만으로 안 보인다.
src/config/에는 빌드 전체 설정과 기능 하나가 주인인 데이터(jpa,
messaging, mongodb)가 섞여 있다.

고른 방법(소유자 결정 2026-11-07, 설계 가-1):
- git mv로 src/platforms/{messaging,grpc,grpc-advanced,optional-build}.
  registry source_path 28행만 바꾸고 Gradle 경로(:messaging:*, :grpc:*)는
  그대로다. optional 빌드의 이름(optional-platforms)도 그대로다.
- optional 빌드가 한 단계 깊어져, build-logic이 "optional 빌드의 부모 =
  주 빌드"로 가정한 네 곳(registry settings, ArchitecturePlugin, 테스트
  이미지 catalog, checkstyle·spotbugs 설정)을 MainBuild(위로 올라가며
  registry·설정 파일을 찾음)로 바꾼다.
- settings.gradle·build.gradle의 상대 경로, workflow의 -p 값과 경로,
  buf 작업 폴더를 고친다. buf breaking은 이동 전 baseline에서도 옛
  경로로 비교해 이동 PR에서 건너뛰지 않는다.
- config/jpa, config/messaging, config/mongodb의 데이터를 주인 leaf의
  release/로 옮기고 읽는 빌드 줄·테스트·스크립트·문서를 고친다.
- 루트 CLAUDE.md 5절에 최상위 폴더 지도를 한 줄로 적는다.
버린 대안: Gradle 루트를 저장소 루트로(가-3, CI 재편 때 다시 봄),
application-* 묶기(가-2, 파생 서비스 충돌이 큼).

위험·한계: Gradle 문서의 "이름 = 위치" 권고와 한 단계 어긋난다
(:messaging:x가 platforms/messaging/x). 옮긴 폴더를 고쳐 쓰던 파생
서비스는 이름 바뀜 충돌이 날 수 있다(B-52). docs/capability-status.md
「제거된 코드」 표와 docs/work/evidence.md의 옛 경로는 이력이라 두었다.

검증(desktop, 트리 2b3354a4, ~/t1-layout-logs/):
- ./gradlew :ci :verifyDependencyLocks --warning-mode=fail --continue
  첫 실행 rc=1: MessagingAuthorityContractTest가 src/messaging을 찾아 실패
  → 경로를 고침. 두 번째 rc=1: messaging-policy
  MessagingAdmissionControllerTest.aWaitingCallerIsAdmittedOnceAPermitIsReturned
  (2초 대기 경쟁, 부하 7.3에서 한 번 실패, 코드 변경 없는 leaf) → --rerun
  3회 모두 통과. 세 번째 rc=0
- -p platforms/optional-build ci rc=0, 두 빌드의 verifyStrictLaneStages
  --dry-run rc=0, -p build-logic check rc=0
- :app-bootstrap:documentContractTest
  :adapter:outbound:persistence-mongo:mongoDocumentContractTest rc=0
- ./gradlew projects(주 빌드)와 optional 빌드 projects의 프로젝트 목록이
  이동 전 트리와 같다(Gradle 경로 불변)
- check-work-docs.py, 상대 링크 검사 rc=0

Refs: design-docs repo-structure/README.md 3.1, repo-structure/01-backend-layout.md 6.1
BREAKING CHANGE: src/messaging·src/grpc·src/grpc-advanced·src/optional-platforms가 src/platforms/ 아래로, src/config/{jpa,messaging,mongodb}가 주인 leaf의 release/로 옮겨졌다. optional 빌드는 -p platforms/optional-build로 부른다. docs/upgrade/2026-11-maturity-review.md B-52.
2026-11-07 13:04:54 +09:00

120 lines
6.0 KiB
Groovy

plugins {
id 'java-test-fixtures'
id 'ca.platform-module'
id 'me.champeau.jmh'
}
jmh {
jmhVersion = libs.versions.jmh.get()
includeTests = true
}
testing {
suites {
integrationTest(JvmTestSuite) {
dependencies {
implementation project()
implementation testFixtures(project())
}
}
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}
dependencies {
// No spring-kafka. It was declared here and imported by nothing: this adapter drives the plain
// `org.apache.kafka` producer API directly, and a declared library that no source names is a
// resolution, a lock entry and a transitive surface bought for nothing.
api project(':messaging:messaging-core-api')
api project(':messaging:messaging-policy')
api project(':messaging:messaging-transport-spi')
api project(':messaging:messaging-observability')
api project(':messaging:messaging-security')
api project(':messaging:messaging-admin')
// api: the public constructors and mappers take and return Producer, ProducerRecord and
// RecordMetadata. Hiding the dependency does not hide the types — it only stops a consumer
// from compiling against the API this module documents.
api 'org.apache.kafka:kafka-clients'
// Test-only. The shared adapter contract is what makes "Stable" mean something, so the Kafka
// adapter runs it rather than asserting its own behaviour in its own terms.
testImplementation project(':messaging:messaging-testkit')
testFixturesImplementation project(':messaging:messaging-testkit')
// Live-broker certification. The deterministic suite proves the platform's semantics; these
// prove the client actually behaves that way against the version the matrix claims.
integrationTestImplementation 'org.testcontainers:testcontainers-junit-jupiter'
integrationTestImplementation 'org.testcontainers:testcontainers-kafka'
integrationTestImplementation 'org.testcontainers:testcontainers-toxiproxy'
integrationTestImplementation libs.toxiproxy.java
}
// The certification lane, and the gate that makes its output the only source of a Stable claim.
//
// `CertifiedEvidence` used to be a hand-written list of three scenarios, and every consumer of it —
// the compatibility matrix, the cross-broker release suite, the support matrix document — believed
// it without a container ever starting. The lane below produces that list, and
// `verifyMessagingCertificationEvidence` refuses to pass when the committed manifest claims a
// scenario this run did not prove. Editing the manifest by hand therefore fails the build; running
// the lane rewrites it.
strictTestLanes {
lane('messagingCertificationTest') {
integration()
sourceSet = 'integrationTest'
description = 'Runs the broker fault scenarios against a real Kafka and writes the ' +
'certification evidence the compatibility matrix reads.'
// Pinned images. A certification claim names the build it was made against, so a
// floating tag would make a red run unattributable and a green one unrepeatable.
// `-PmessagingKafkaImage=` overrides for a one-off run against another version.
systemProperty 'messaging.kafka.image',
(project.findProperty('messagingKafkaImage') ?: testContainerImages['kafka']).toString()
systemProperty 'messaging.toxiproxy.image',
(project.findProperty('messagingToxiproxyImage')
?: testContainerImages['toxiproxy']).toString()
systemProperty 'messaging.certification.manifest',
project.layout.buildDirectory
.file('messaging-certification/broker-certification-evidence.jsonl')
.get().asFile.absolutePath
// The commit is provenance recorded in the evidence, not an equality key for the
// behavioral claim gate. Re-running the same scenario on a later commit refreshes
// provenance without creating a different scenario identity.
// Read from the environment rather than a `-P` flag so the CI job's command line stays
// the literal grammar the gate matrix lint accepts.
systemProperty 'messaging.certification.commit',
(project.findProperty('certificationCommit')
?: providers.environmentVariable('GITHUB_SHA').getOrElse('local'))
.toString()
}
}
// The certification lane writes the scenarios it proved; the committed manifest in messaging-testkit
// may claim no more and no fewer. gitCommit and observedAt are provenance, not claim identity.
tasks.register('verifyMessagingCertificationEvidence') {
group = 'verification'
description = 'Fails when the committed broker certification manifest claims a scenario the certification lane did not produce.'
dependsOn 'messagingCertificationTest'
def produced = layout.buildDirectory.file('messaging-certification/broker-certification-evidence.jsonl')
def committed = rootProject.file('platforms/messaging/messaging-testkit/src/main/resources/messaging/broker-certification-evidence.jsonl')
inputs.file(produced)
inputs.file(committed)
doLast {
def claims = { File file ->
file.readLines('UTF-8').findAll { !it.trim().isEmpty() }.collect {
it.replaceAll(/,"gitCommit":"[^"]*"/, '').replaceAll(/,"observedAt":"[^"]*"/, '')
} as Set
}
def ran = claims(produced.get().asFile)
def shipped = claims(committed)
if (ran != shipped) {
throw new GradleException("the committed certification manifest does not match this run.\n" +
" claimed but not produced: ${shipped - ran}\n produced but not claimed: ${ran - shipped}\n" +
"Copy ${produced.get().asFile} over ${committed} — the manifest is a record of a run.")
}
}
}