옮겨 온 메시징 19개 모듈은 템플릿의 src/settings.gradle·build-logic· 카탈로그·registry에 기대고 있어 이 repo만으로는 빌드되지 않는다. repo 루트를 Gradle 루트로 하는 단독 빌드를 만든다. - build-logic/: grpc-library main 2e880c7의 줄인 사본(템플릿 22df3525에서 복사, 템플릿 2959eff0까지의 변경도 같은 내용)에서 gRPC BOM 규칙(ca.grpc-platform-module)만 뺐다. 배포 플러그인 ca.library-publishing과 서명 키 해석(SigningKeys)은 그대로다. 출처·뺀 것·고친 것은 build-logic/UPSTREAM.md. - settings.gradle·build.gradle·gradle.properties: group dev.cakit.messaging, 단계 태스크 ci·mainCheck·releaseCheck와 배포(release·releaseRehearsal·verifySigningKey)는 grpc-library와 같은 모양이다. 메시징만 다른 점: Buf가 없고, 성능 lane이 없고, mainCheck와 releaseCheck가 브로커 인증 증거 게이트 (verifyMessagingCertificationEvidence)를 부른다. 템플릿은 이 게이트를 따로 messaging-certification.yml로 돌렸다. 그 workflow는 지운다. - config/: registry 19행(source_path만 messaging/<leaf>로), 메시징 클래스만 남긴 SpotBugs 제외 목록, 이미지 셋(postgres-16, kafka, toxiproxy, 모두 digest 고정), checkstyle 사본. - gradle/libs.versions.toml: 메시징이 쓰는 항목만(avro, cloudevents, protobuf 4.33.2, toxiproxy, jmh)과 kafka-clients가 끌고 오는 취약 버전을 덮는 pinned-lz4-java·pinned-snappy-java. - 저장소 계약 테스트: MessagingPublicSurfaceContractTest(템플릿 app-bootstrap에서 이력째 옮김)와 새 MessagingSettingsOwnerContractTest (app.messaging 주인은 starter 하나)를 messaging-testkit의 repositoryContractTest lane에 둔다. check에 들어가 PR 단계에서 돈다. - messaging-kafka: 인증 manifest 경로를 새 배치로 고친다. 버린 대안: 계약 테스트를 build-logic 테스트로 두는 안. 빌드 플러그인 시험과 모듈 계약이 섞이고, 소스·build.gradle을 입력으로 선언하는 기존 lane 장치를 쓸 수 없다. 위험: 이 커밋 단독으로는 lockfile을 다시 쓰지 않았다(뒤 커밋에서 desktop에서 쓴다). 패키지는 아직 dev.caskeleton.messaging이다. 검증: desktop ./gradlew projects rc=0(19개 모듈 포함). Refs: design-docs repo-structure/05-library-repos.md 4·10.3·13.1절
120 lines
6.0 KiB
Groovy
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('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.")
|
|
}
|
|
}
|
|
}
|
|
|