문제: 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.
563 lines
33 KiB
Groovy
563 lines
33 KiB
Groovy
plugins {
|
|
id 'ca.spring-library'
|
|
id 'ca.spring-config'
|
|
id 'org.springframework.boot'
|
|
id 'ca.config-contract'
|
|
id 'ca.bootrun-dotenv'
|
|
}
|
|
|
|
// Application entry point. Wires the default runtime module set and runs Spring Boot.
|
|
// Optional leaves require an explicit registry allowance plus a composition-root dependency.
|
|
// The infrastructure lane. Testcontainers-backed tests boot a real PostgreSQL, so they belong to a
|
|
// source set of their own rather than to `test`: the ordinary focused command for this leaf —
|
|
// `./gradlew :app-bootstrap:test` — must not require a Docker daemon, and a leaf whose fastest
|
|
// feedback loop starts a database is a leaf nobody runs the fast loop on. This is the same shape
|
|
// persistence-jpa, web, websocket and objectstorage already use, declared through the repository's
|
|
// own strictTestLanes DSL rather than by hand.
|
|
// The suites see main (and two of them the test classes) as class directories rather than through
|
|
// `implementation project()`: this is a Spring Boot application project, and its lanes have always
|
|
// run on main's output, not on the plain jar.
|
|
testing {
|
|
suites {
|
|
integrationTest(JvmTestSuite)
|
|
architectureTest(JvmTestSuite)
|
|
// No test runtime and no inherited test dependencies: the full-boot lane runs on the
|
|
// composition bootJar packages (see the configurations block below).
|
|
systemTest(JvmTestSuite)
|
|
}
|
|
}
|
|
configurations {
|
|
integrationTestImplementation.extendsFrom testImplementation
|
|
integrationTestCompileOnly.extendsFrom testCompileOnly
|
|
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
|
|
integrationTestAnnotationProcessor.extendsFrom testAnnotationProcessor
|
|
architectureTestImplementation.extendsFrom testImplementation
|
|
architectureTestCompileOnly.extendsFrom testCompileOnly
|
|
architectureTestRuntimeOnly.extendsFrom testRuntimeOnly
|
|
architectureTestAnnotationProcessor.extendsFrom testAnnotationProcessor
|
|
systemTestAnnotationProcessor.extendsFrom testAnnotationProcessor
|
|
}
|
|
sourceSets {
|
|
integrationTest {
|
|
compileClasspath += main.output
|
|
runtimeClasspath += main.output
|
|
}
|
|
architectureTest {
|
|
compileClasspath += main.output + test.output
|
|
}
|
|
systemTest {
|
|
compileClasspath += main.output + test.output
|
|
runtimeClasspath += main.output + test.output
|
|
}
|
|
}
|
|
|
|
strictTestLanes {
|
|
lane('integrationTest') {
|
|
integration()
|
|
description = 'Runs composition-root integration checks against real required providers.'
|
|
sourceSet = 'integrationTest'
|
|
requires 'dev.caskeleton.bootstrap.integration.fileserver.FileserverCompositionIntegrationTest'
|
|
requires 'dev.caskeleton.bootstrap.integration.objectstorage.ObjectStorageCompositionIntegrationTest'
|
|
requires 'dev.caskeleton.bootstrap.integration.idempotency.PostgreSqlIdempotencyProviderIntegrationTest'
|
|
requires 'dev.caskeleton.bootstrap.integration.operation.DurableOperationCompositionIntegrationTest'
|
|
}
|
|
lane('architectureTest') {
|
|
architecture()
|
|
description = 'Runs the whole-repository ArchUnit and architecture contract source set.'
|
|
sourceSet = 'architectureTest'
|
|
maxHeapSize = '2g'
|
|
shouldRunAfter 'test'
|
|
}
|
|
lane('systemTest') {
|
|
system()
|
|
description = 'Runs full-application startup and shipped-profile characterization tests.'
|
|
sourceSet = 'systemTest'
|
|
maxHeapSize = '1g'
|
|
shouldRunAfter 'test'
|
|
}
|
|
lane('conditionalTransportBuildContractTest') {
|
|
description = 'Proves the explicit test-only GraphQL/gRPC/WebSocket opt-in classpath.'
|
|
sourceSet = 'conditionalTransportBuildContractTest'
|
|
requires 'dev.caskeleton.bootstrap.transport.ConditionalTransportBuildContractTest'
|
|
rejectSkipped = true
|
|
shouldRunAfter 'test'
|
|
}
|
|
}
|
|
|
|
tasks.named('check') {
|
|
dependsOn tasks.named('systemTestLaneCheck')
|
|
}
|
|
|
|
// architectureTest runs on the `test` runtime plus its own configuration, so the capability leaves
|
|
// declared `architectureTestRuntimeOnly` reach the whole-repository ArchUnit import without reaching
|
|
// the default composition that `test` and `systemTest` boot. Its compile classpath (test fixtures,
|
|
// testCompileOnly analysis dependencies) is deliberately not its runtime.
|
|
sourceSets.architectureTest.runtimeClasspath = sourceSets.architectureTest.output +
|
|
sourceSets.test.runtimeClasspath + configurations.architectureTestRuntimeClasspath
|
|
|
|
// The full-boot lane boots the composition bootJar packages. It compiles against everything the
|
|
// test lane sees, but it runs on the main runtime graph plus the test frameworks — not on the test
|
|
// lane's extra modules (persistence-jpa, the slice-test starters).
|
|
// A module on the classpath is on, and the shipped artifact contains none of those, so running the
|
|
// full boot on the test classpath would open a pool the artifact cannot open.
|
|
configurations {
|
|
systemTestCompileOnly.extendsFrom testImplementation, testCompileOnly
|
|
systemTestImplementation.extendsFrom implementation
|
|
systemTestRuntimeOnly.extendsFrom runtimeOnly
|
|
}
|
|
dependencies {
|
|
systemTestImplementation 'org.junit.jupiter:junit-jupiter'
|
|
systemTestImplementation 'org.assertj:assertj-core'
|
|
systemTestImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
systemTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
}
|
|
|
|
sourceSets {
|
|
conditionalTransportBuildContractTest {
|
|
java.srcDir 'src/conditionalTransportBuildContractTest/java'
|
|
resources.srcDir 'src/conditionalTransportBuildContractTest/resources'
|
|
compileClasspath += sourceSets.main.output
|
|
runtimeClasspath += sourceSets.main.output
|
|
}
|
|
}
|
|
|
|
// Every capability a service can select — the commented runtimeOnly lines below — listed once.
|
|
// Three consumers read it — the environment contract's metadata classpath (verifyEnvKeys, below)
|
|
// and these two: the whole-repository ArchUnit import (spec §7: the architecture suite sees
|
|
// every module of this build, the shipped runtime only the selected ones; the
|
|
// optional-platforms build is held by its own Gradle direction gate instead) and the qualification artifact the
|
|
// Compose lanes boot (qualificationBootJar, below). None of them reaches `bootJar`, `test` or
|
|
// `systemTest`, because a capability on a classpath is switched on there by its mere presence.
|
|
// A new capability leaf is added here and as a commented line below; nowhere else.
|
|
def capabilityProjects = [
|
|
':adapter:outbound:persistence-jpa',
|
|
':adapter:outbound:cache-redis',
|
|
':adapter:outbound:messaging-kafka',
|
|
':adapter:outbound:persistence-mongo',
|
|
':adapter:inbound:graphql',
|
|
':adapter:outbound:httpclient',
|
|
':adapter:outbound:objectstorage',
|
|
':adapter:inbound:websocket',
|
|
':adapter:inbound:grpc',
|
|
':composition:fileserver-platform',
|
|
':composition:notification-platform',
|
|
]
|
|
|
|
dependencies {
|
|
implementation project(':domain-core')
|
|
implementation project(':application-core')
|
|
// Test sources name the JPA capability types (the JPA rule pack, the persistence failure
|
|
// contract). Test scope only: systemTest runs on the main runtime graph, so the full-boot lane
|
|
// still boots the composition this build ships.
|
|
testImplementation project(':adapter:outbound:persistence-jpa')
|
|
integrationTestImplementation project(':adapter:outbound:persistence-jpa')
|
|
|
|
// 이 서비스가 쓰는 부가 기능 — 필요한 줄의 주석을 푼다.
|
|
// 각 모듈은 있으면 켜지고(자기 AutoConfiguration.imports와 설정 기본값을 가진다), 줄을 지우면
|
|
// 기능·설정·의존성이 함께 빠진다. 켠 뒤 필요한 env 키는 각 모듈 README에 있다.
|
|
// 줄을 바꾼 뒤 strict lock을 갱신한다: ./gradlew :app-bootstrap:resolveAndLockAll --write-locks
|
|
// runtimeOnly project(':adapter:outbound:persistence-jpa') // JPA·Flyway·outbox·lock
|
|
// runtimeOnly project(':adapter:outbound:cache-redis') // Redis (캐시·rate limit·idempotency)
|
|
// runtimeOnly project(':adapter:outbound:messaging-kafka') // Kafka 발행
|
|
// runtimeOnly project(':adapter:outbound:persistence-mongo') // Mongo
|
|
// runtimeOnly project(':adapter:inbound:graphql') // GraphQL
|
|
// runtimeOnly project(':adapter:outbound:httpclient') // 외부 HTTP 호출
|
|
// runtimeOnly project(':adapter:outbound:objectstorage') // 객체 저장소 (S3/로컬)
|
|
// runtimeOnly project(':adapter:inbound:websocket') // WebSocket (STOMP push)
|
|
// runtimeOnly project(':adapter:inbound:grpc') // gRPC 서버
|
|
// runtimeOnly project(':composition:fileserver-platform') // 파일 서버
|
|
// runtimeOnly project(':composition:notification-platform') // 알림 (persistence-jpa·persistence-notification을 함께 가져온다)
|
|
|
|
// 기본 조립에 있는 application composition. 셋 다 포트만 보고, 필요한 것(outbox store, 멱등성
|
|
// provider)이 없으면 아무것도 만들지 않는다.
|
|
runtimeOnly project(':composition:outbox-relay') // outbox relay (store·발행 포트가 있을 때만)
|
|
runtimeOnly project(':composition:idempotency') // 요청 멱등성 executor (provider≠disabled)
|
|
runtimeOnly project(':composition:durable-operation') // /operations (operation store·outbox가 있을 때만)
|
|
// 모든 서비스가 받는 runtime 배선: tracing, metrics 계약 filter, domain context, user principal
|
|
// 가명화, actuator 보안 chain.
|
|
runtimeOnly project(':composition:service-runtime')
|
|
// Contract tests pin those pieces by type (tracing gauge, metrics filters, actuator chain).
|
|
testImplementation project(':composition:service-runtime')
|
|
integrationTestImplementation project(':composition:service-runtime')
|
|
|
|
capabilityProjects.each { architectureTestRuntimeOnly project(it) }
|
|
// What this import does NOT see: the optional-platforms build (`grpc:*`, `grpc-advanced:*`).
|
|
// It is a separate Gradle build, so its classes cannot be on this classpath; its registered
|
|
// leaves are held by the Gradle direction gate (`-p platforms/optional-build ci` runs
|
|
// verifyCleanArchitectureDependencies), which is the whole of what the owner decided it needs.
|
|
|
|
// The capability integration lane selects Fileserver and object storage together, as a service
|
|
// would, and turns off whichever one a test is not about.
|
|
integrationTestImplementation project(':composition:fileserver-platform')
|
|
integrationTestImplementation project(':adapter:inbound:web-fileserver')
|
|
// PostgreSqlIdempotencyProviderIntegrationTest composes the executor module over the real store.
|
|
integrationTestImplementation project(':composition:idempotency')
|
|
|
|
testImplementation(testFixtures(project(':adapter:outbound:persistence-jpa')))
|
|
testImplementation(testFixtures(project(':adapter:inbound:web')))
|
|
// The idempotency composition tests drive the executor over the port owner's shared fake store.
|
|
testImplementation(testFixtures(project(':application-core')))
|
|
// A feature's composition test registers the domain ports' fakes (scripts/new-feature.sh).
|
|
testImplementation(testFixtures(project(':domain-core')))
|
|
testImplementation(testFixtures(project(':shared-contract')))
|
|
// The opt-in web library is in no shipped composition. Runtime-only for the tests so the
|
|
// whole-repository ArchUnit import (architectureTest runs on the test runtime classpath) still
|
|
// reads its classes; no test source may name one of its types. It cannot reach a shipped
|
|
// composition: no module in modules.json may depend on it, so the direction gate refuses the edge.
|
|
testRuntimeOnly project(':adapter:inbound:web-advanced')
|
|
implementation project(':adapter:outbound:support')
|
|
implementation project(':adapter:outbound:identifier')
|
|
implementation project(':adapter:inbound:web')
|
|
implementation project(':shared-contract')
|
|
implementation 'org.springframework.boot:spring-boot-starter'
|
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
|
implementation libs.spring.dotenv
|
|
// Micrometer core for the bootstrap meters (no-op without a MeterRegistry). See README.
|
|
implementation 'io.micrometer:micrometer-core'
|
|
|
|
// The Micrometer Tracing API the tracing contract tests name. The tracer runtime itself — Boot's
|
|
// tracing auto-configuration and the OTLP exporter — is composition:service-runtime's.
|
|
implementation 'io.micrometer:micrometer-tracing-bridge-otel'
|
|
|
|
// Actuator + Prometheus registry (health/info/prometheus/loggers endpoints).
|
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
|
implementation 'io.micrometer:micrometer-registry-prometheus'
|
|
// Spring Security on the runtime graph (the actuator chain itself is composition:service-runtime's). See README.
|
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
|
|
|
// test-only: ArchUnit needs actuator types to verify the health-shape guardrail. See README.
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-actuator'
|
|
// test-only: @WithMockUser for the actuator security authorization tests. See README.
|
|
testImplementation 'org.springframework.security:spring-security-test'
|
|
|
|
// integration-lane-only: Testcontainers PostgreSQL. Declared here and NOT on testImplementation
|
|
// so `:app-bootstrap:test` cannot start a container — the source-set boundary is what enforces
|
|
// BOOT-014, and a dependency left on the test classpath would let the boundary be crossed back
|
|
// by a single import.
|
|
integrationTestImplementation project(':adapter:outbound:objectstorage')
|
|
integrationTestImplementation project(':application-objectstorage')
|
|
// objectstorage intentionally imports the AWS SDK BOM only at its own module scope. This
|
|
// qualification composition consumes the leaf from a separate source set, so it repeats the
|
|
// platform here rather than widening app-bootstrap's production dependency-management surface.
|
|
integrationTestImplementation platform("software.amazon.awssdk:bom:${libs.versions.awsSdk.get()}")
|
|
integrationTestImplementation 'org.testcontainers:testcontainers'
|
|
integrationTestImplementation 'org.testcontainers:testcontainers-postgresql'
|
|
integrationTestImplementation 'org.testcontainers:testcontainers-junit-jupiter'
|
|
// test-only, compile-only: TestcontainersUsingFixture declares a PostgreSQLContainer *field type*
|
|
// as the non-vacuity positive control for the Testcontainers-ban ArchUnit rule. ClassFileImporter
|
|
// reads its bytecode without resolving or constructing the field, so the type is never needed at
|
|
// runtime — the same compileOnly shape the other violation fixtures use.
|
|
testCompileOnly 'org.testcontainers:testcontainers-postgresql'
|
|
// test-only: Boot 4 split JPA slice annotations into dedicated test modules.
|
|
testImplementation 'org.springframework.boot:spring-boot-data-jpa-test'
|
|
// test-only: PG JDBC driver (the vendor module's runtimeOnly does not leak here). See README.
|
|
testRuntimeOnly 'org.postgresql:postgresql'
|
|
// test-only: Boot's relational auto-configuration types, which a few context tests exclude by name.
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
|
testImplementation 'org.springframework.boot:spring-boot-flyway'
|
|
// The integration lane drives Flyway itself and names Boot's Flyway auto-configuration.
|
|
integrationTestImplementation 'org.springframework.boot:spring-boot-flyway'
|
|
integrationTestImplementation 'org.flywaydb:flyway-core'
|
|
testImplementation 'com.zaxxer:HikariCP'
|
|
|
|
testImplementation libs.archunit.junit5
|
|
// test-only: jackson-databind for the deserialization-policy boundary test. See README.
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-json'
|
|
// test-only: parses the checked-in YAML registries (error codes and the like) in contract tests.
|
|
testImplementation 'org.yaml:snakeyaml'
|
|
// test-only: ArchUnit violation fixtures intentionally import forbidden types. See README.
|
|
testCompileOnly 'org.springframework:spring-tx'
|
|
// test-only: streaming/websocket violation fixtures import these forbidden packages. See README.
|
|
testCompileOnly 'org.springframework:spring-webmvc' // SseEmitter, ResponseBodyEmitter, StreamingResponseBody
|
|
testCompileOnly 'org.springframework:spring-websocket' // org.springframework.web.socket..
|
|
testCompileOnly 'jakarta.websocket:jakarta.websocket-api' // jakarta.websocket..
|
|
// architecture-only: positive-control fixture imports Kafka TopicPartition to prove domain code
|
|
// cannot depend on broker SDK types. The shipped main/test compile classpaths must not inherit it.
|
|
architectureTestCompileOnly 'org.apache.kafka:kafka-clients'
|
|
// architecture-only: the system-caller fixture for the `graphql..` entry of the user-transport
|
|
// type list is a raw graphql-java data fetcher. The adapter brings graphql-java onto this source
|
|
// set's runtime already (capabilityProjects); compile-only here so no shipped graph changes.
|
|
architectureTestCompileOnly 'com.graphql-java:graphql-java'
|
|
// architecture-only: the STOMP fixtures for the channel-interceptor entries of the user-transport
|
|
// type list implement spring-messaging's ChannelInterceptor. The websocket adapter brings it onto
|
|
// this source set's runtime already (capabilityProjects); compile-only here so no shipped graph
|
|
// changes.
|
|
architectureTestCompileOnly 'org.springframework:spring-messaging'
|
|
// Kafka producer ownership lives in adapter:outbound:messaging. The composition root sees only
|
|
// the adapter module; it no longer implements the broker seam itself.
|
|
testCompileOnly 'jakarta.ws.rs:jakarta.ws.rs-api' // jakarta.ws.rs..
|
|
// test-only: @RefreshScope for the no-refresh-scope violation fixture (version pinned; not in the BOM). See README.
|
|
testCompileOnly libs.spring.cloud.context // org.springframework.cloud.context..
|
|
// analysis-only: SpotBugs resolves the full type hierarchy of everything on the auxiliary
|
|
// classpath, and spring-beans/spring-context/spring-web each ship an optional Groovy integration
|
|
// class (GroovyBeanDefinitionReader, GenericGroovyApplicationContext, GroovyWebApplicationContext).
|
|
// Groovy itself is optional to Spring and absent here, so the analysis reported "missing class
|
|
// groovy.lang.GroovyObject" and verifySpotBugsAnalysisFailureContract failed closed — correctly,
|
|
// since an incomplete analysis finds fewer bugs while still reporting success. It surfaced when
|
|
// the messaging platform's leaves widened the classpath enough to reach those classes.
|
|
//
|
|
// compileOnly, so it resolves for analysis and reaches no runtime.
|
|
testCompileOnly 'org.apache.groovy:groovy' // groovy.lang.GroovyObject
|
|
|
|
// JSON log encoder; implementation (not runtimeOnly) because StartupFailures uses StructuredArguments at compile time. See README.
|
|
implementation libs.logstash.logback.encoder
|
|
|
|
// test-only: ApprovalTests JSON snapshot verification for the contract-verification suite
|
|
// (feature-contract-verification-test-suite D7 — envelope/error shape snapshots). See README.
|
|
testImplementation libs.approvaltests
|
|
// test-only: JUnit Platform Test Kit — proves optional-adapter tests report SKIPPED (never FAILED)
|
|
// when their enable-flag env var is unset (feature-contract-verification-test-suite D3, Claims #7). See README.
|
|
testImplementation 'org.junit.platform:junit-platform-testkit'
|
|
// Explicit qualification-only composition. These projects remain absent from main
|
|
// api/implementation/compileOnly/runtimeOnly and therefore from both shipped runtime graphs.
|
|
conditionalTransportBuildContractTestImplementation project(':adapter:inbound:graphql')
|
|
conditionalTransportBuildContractTestImplementation project(':adapter:inbound:grpc')
|
|
conditionalTransportBuildContractTestImplementation project(':adapter:inbound:websocket')
|
|
conditionalTransportBuildContractTestImplementation 'org.junit.jupiter:junit-jupiter'
|
|
conditionalTransportBuildContractTestImplementation 'org.assertj:assertj-core'
|
|
conditionalTransportBuildContractTestImplementation 'org.yaml:snakeyaml'
|
|
conditionalTransportBuildContractTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
}
|
|
|
|
// Tests that read the repository itself — registries, runbooks, guidance documents, build scripts,
|
|
// workflows, Compose files, other leaves' sources — run in two tagged lanes, and only those lanes
|
|
// receive the repository root (`ca.repository.root`) and declare what they read as inputs. The plain
|
|
// `test` lane gets neither: a repository-reading test left untagged fails there for want of a root
|
|
// instead of turning `test` into a task that every document edit invalidates (review 2026-11-01
|
|
// 08-03; the inputs are what keeps O-4a's "the lane reruns when a file it reads changes").
|
|
//
|
|
// documentContractTest tag document-contract main stage docs/**, the guidance documents,
|
|
// and the files the same classes
|
|
// cross-check them with
|
|
// repositoryContractTest tag repository-contract pull request build, configuration, workflow and
|
|
// Compose files and leaf sources;
|
|
// no document, so a docs/** edit
|
|
// leaves it up to date
|
|
//
|
|
// The pull-request lane exists because some of those contracts are release and security
|
|
// properties — the signing job's OIDC scope, the Docker staging contract, the request-logging body
|
|
// capture ban — that must stop a merge, not be found after one.
|
|
def repositoryRootForContractTests = rootProject.projectDir.parentFile
|
|
def repositoryContractExcludes = ['**/build/**', '**/.gradle/**', '**/node_modules/**']
|
|
def repositoryContractInputs = files(
|
|
fileTree(repositoryRootForContractTests) {
|
|
include '.github/**', 'compose/**', 'scripts/**', '*.yml', '*.yaml', '*.example', '.tool-versions'
|
|
exclude '**/*.md'
|
|
exclude repositoryContractExcludes
|
|
},
|
|
fileTree(rootProject.projectDir) {
|
|
include 'config/**', '**/*.gradle', 'gradle/*.toml', 'Dockerfile*', '.env*', '**/src/main/**'
|
|
// The compose lane fixtures this leaf owns (the lane contract, overlays, smoke clients).
|
|
include 'app-bootstrap/compose-lanes/**'
|
|
// The release data a capability leaf owns (readiness cards, release registries).
|
|
include 'adapter/outbound/*/release/**'
|
|
exclude '**/*.md'
|
|
exclude repositoryContractExcludes
|
|
})
|
|
def documentContractInputs = files(
|
|
repositoryContractInputs,
|
|
fileTree(repositoryRootForContractTests) {
|
|
include 'docs/**', '*.md', '.github/**/*.md'
|
|
},
|
|
fileTree(rootProject.projectDir) {
|
|
include '**/*.md'
|
|
exclude repositoryContractExcludes
|
|
})
|
|
strictTestLanes {
|
|
lane('documentContractTest') {
|
|
tag = 'document-contract'
|
|
description = 'Holds the composition to the repository documents and registries it promises.'
|
|
rejectSkipped = true
|
|
mainStage()
|
|
systemProperty 'ca.repository.root', repositoryRootForContractTests.absolutePath
|
|
customize { Test task ->
|
|
task.inputs.files(documentContractInputs)
|
|
.withPathSensitivity(PathSensitivity.RELATIVE)
|
|
.withPropertyName('documentContractInputs')
|
|
}
|
|
}
|
|
lane('repositoryContractTest') {
|
|
tag = 'repository-contract'
|
|
description = 'Holds the composition to the build, configuration and workflow files it does not own.'
|
|
systemProperty 'ca.repository.root', repositoryRootForContractTests.absolutePath
|
|
customize { Test task ->
|
|
task.inputs.files(repositoryContractInputs)
|
|
.withPathSensitivity(PathSensitivity.RELATIVE)
|
|
.withPropertyName('repositoryContractInputs')
|
|
}
|
|
}
|
|
}
|
|
tasks.named('test', Test) {
|
|
useJUnitPlatform { excludeTags 'repository-contract' }
|
|
}
|
|
tasks.named('check') {
|
|
dependsOn 'repositoryContractTest'
|
|
}
|
|
|
|
// The other suites find the repository themselves and read what Gradle cannot otherwise see: the
|
|
// architecture suite scans every leaf's production sources and its own rule sources as text, the
|
|
// opt-in classpath contract reads this build script, and the Compose characterization reads the
|
|
// Compose files.
|
|
tasks.named('architectureTest', Test) {
|
|
inputs.files(fileTree(rootProject.projectDir) {
|
|
include '**/src/main/java/**/*.java', 'app-bootstrap/src/architectureTest/java/**'
|
|
exclude repositoryContractExcludes
|
|
}).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('scannedSources')
|
|
}
|
|
tasks.named('conditionalTransportBuildContractTest', Test) {
|
|
inputs.file('build.gradle').withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('buildScript')
|
|
}
|
|
tasks.named('integrationTest', Test) {
|
|
inputs.files(fileTree(repositoryRootForContractTests) {
|
|
include 'compose.yaml', 'compose/**', 'scripts/*compose*.sh', 'src/app-bootstrap/compose-lanes/**'
|
|
exclude repositoryContractExcludes
|
|
}).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('composeFiles')
|
|
}
|
|
|
|
// Fast developer test lane. Whole-repository ArchUnit graphs and full composition-root boot
|
|
// characterizations have their own source sets, so the ordinary lane does not compile or execute
|
|
// them. CI still runs both through architectureCheck / qualificationCheck.
|
|
tasks.named('test', Test) {
|
|
// Two forks are the measured sweet spot after moving whole-repository ArchUnit and full boot
|
|
// composition tests out of the fast lane. More forks duplicate Spring contexts for little gain.
|
|
maxParallelForks = 2
|
|
}
|
|
|
|
|
|
bootJar {
|
|
mainClass = 'dev.caskeleton.bootstrap.CaSkeletonApplication'
|
|
}
|
|
|
|
// The deployable artifact names the release and the commit it was built from in
|
|
// META-INF/build-info.properties (review BUILD-O3-5: provenance through Spring Boot's build info
|
|
// rather than a revision in every leaf's jar name). `time` is excluded so an unchanged commit still
|
|
// produces an unchanged resource and cached tasks stay cached.
|
|
springBoot {
|
|
buildInfo {
|
|
excludes = ['time']
|
|
properties {
|
|
additional = ['revision': project.sourceRevision] // set by ca.java-conventions
|
|
}
|
|
}
|
|
}
|
|
|
|
// The deny-by-default public path baseline (docs/security/public-paths-snapshot.txt) is an approval
|
|
// test beside the security configuration it pins, not a build-logic plugin (review BUILD-O3-5). The
|
|
// root `verifyPublicPathSnapshot` names this lane; `-PapprovePublicPathChange` rewrites the baseline
|
|
// after review instead of comparing it.
|
|
strictTestLanes {
|
|
lane('publicPathSnapshotTest') {
|
|
tag = 'public-path-snapshot'
|
|
description = 'Compares the shipped public path default with the reviewed baseline.'
|
|
rejectSkipped = true
|
|
mainStage()
|
|
systemProperty 'publicpath.snapshot.write', project.hasProperty('approvePublicPathChange') ? 'true' : 'false'
|
|
}
|
|
}
|
|
|
|
tasks.register('stageDockerJar', Sync) {
|
|
dependsOn tasks.named('bootJar')
|
|
from(tasks.named('bootJar').flatMap { it.archiveFile })
|
|
into(layout.buildDirectory.dir('docker'))
|
|
rename { 'application.jar' }
|
|
}
|
|
|
|
// A runtime classpath of this composition plus extra leaves, resolved the way Boot resolves
|
|
// runtimeClasspath. Used by the H2 convenience below and by the qualification artifact.
|
|
def compositionRuntimeClasspath = { String name ->
|
|
configurations.create(name) {
|
|
canBeConsumed = false
|
|
canBeResolved = true
|
|
extendsFrom configurations.implementation, configurations.runtimeOnly
|
|
attributes {
|
|
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
|
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.LIBRARY))
|
|
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
|
|
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
|
|
}
|
|
}
|
|
}
|
|
|
|
// The qualification artifact: this composition with every capability on the classpath. It is what
|
|
// the Compose lanes (compose-lanes/compose-profile-contracts.json) boot, because a lane that turns
|
|
// JPA or Kafka on needs the module in the image, and `bootJar` — the default composition a service
|
|
// ships — carries none of them. It is never released: `release.yml` builds `stageDockerJar`.
|
|
// Each capability is on while present, so a lane switches off what it is not about.
|
|
def qualificationClasspath = compositionRuntimeClasspath('qualificationRuntimeClasspath')
|
|
dependencies {
|
|
capabilityProjects.each { qualificationRuntimeClasspath project(it) }
|
|
}
|
|
// The environment contract reads every selectable capability's configuration metadata from this
|
|
// classpath, so a module that ships typed settings is checked because it can be selected, and the
|
|
// task names no leaf (review 2026-11-03 RR-06-10).
|
|
tasks.named('verifyEnvKeys') {
|
|
metadataClasspath.from(qualificationClasspath)
|
|
}
|
|
def qualificationBootJar = tasks.register('qualificationBootJar', org.springframework.boot.gradle.tasks.bundling.BootJar) {
|
|
group = 'build'
|
|
description = 'Assembles the Compose qualification jar: the default composition plus every capability.'
|
|
mainClass = 'dev.caskeleton.bootstrap.CaSkeletonApplication'
|
|
classpath = sourceSets.main.output + qualificationClasspath
|
|
resolvedArtifacts(qualificationClasspath.incoming.artifacts.resolvedArtifacts)
|
|
targetJavaVersion = java.targetCompatibility
|
|
archiveClassifier = 'qualification'
|
|
}
|
|
// Same staging path as stageDockerJar, so src/Dockerfile's extract step is one path; its
|
|
// COMPOSITION build argument picks which of the two tasks writes it.
|
|
tasks.register('stageQualificationDockerJar', Sync) {
|
|
dependsOn qualificationBootJar
|
|
from(qualificationBootJar.flatMap { it.archiveFile })
|
|
into(layout.buildDirectory.dir('docker'))
|
|
rename { 'application.jar' }
|
|
}
|
|
|
|
// `ca.bootrun-dotenv` owns root working-directory and .env injection for bootRun.
|
|
// Boot 4 initializes profiles/logging before spring-dotenv can reliably contribute these values.
|
|
|
|
// JPA-INT-003 — the H2 developer convenience, which now has to be asked for by name.
|
|
//
|
|
// `local` used to default to H2, so "it works locally" was a statement about a different database
|
|
// from the one every other environment runs: Flyway never applied, ddl-auto wrote the schema from
|
|
// the entities, and a mapping that disagreed with the migration tree could not be discovered until a
|
|
// real PostgreSQL saw it. It was not discovered, twice, until a Compose lane did — fs_cleanup_item
|
|
// and idempotency_record.request_hash.
|
|
//
|
|
// So local now defaults to the Compose PostgreSQL and this task is the opt-out. It is deliberately a
|
|
// separate, named task rather than a property: choosing a datastore whose schema comes from
|
|
// somewhere else should look like a choice in the command somebody typed. It is not part of `check`,
|
|
// `build`, or any release lane.
|
|
//
|
|
// H2 needs relational persistence, which this composition does not ship, so the task adds the
|
|
// module to its own classpath. The artifact is unchanged; choosing H2 is still a choice in the
|
|
// command somebody typed.
|
|
def h2RunClasspath = compositionRuntimeClasspath('bootRunH2Classpath')
|
|
dependencies {
|
|
bootRunH2Classpath project(':adapter:outbound:persistence-jpa')
|
|
// The driver is not a runtime dependency of persistence-jpa (review 09-09), so the task that
|
|
// chose H2 brings it.
|
|
bootRunH2Classpath 'com.h2database:h2'
|
|
}
|
|
tasks.register('bootRunH2', org.springframework.boot.gradle.tasks.run.BootRun) {
|
|
group = 'application'
|
|
description = 'Runs the application on an in-memory H2, for development without a container. ' +
|
|
'Not a release lane: H2 has no migration tree and Hibernate owns its schema.'
|
|
classpath = sourceSets.main.output + h2RunClasspath
|
|
mainClass = 'dev.caskeleton.bootstrap.CaSkeletonApplication'
|
|
workingDir = rootProject.projectDir
|
|
environment 'SPRING_PROFILES_ACTIVE', 'local'
|
|
// A .env copied before the module became opt-in may still say false.
|
|
environment 'APP_PERSISTENCE_JPA_ENABLED', 'true'
|
|
environment 'APP_PERSISTENCE_VENDOR', 'h2'
|
|
environment 'APP_DATASOURCE_URL',
|
|
'jdbc:h2:mem:ca_skeleton;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1'
|
|
environment 'APP_DATASOURCE_USERNAME', 'sa'
|
|
environment 'APP_DATASOURCE_PASSWORD', ''
|
|
environment 'APP_DATASOURCE_DRIVER', 'org.h2.Driver'
|
|
// Both are load-bearing for H2 and wrong everywhere else: the migration tree is PostgreSQL DDL,
|
|
// and DB_CLOSE_DELAY=-1 above is what keeps the in-memory schema alive when the pool goes idle.
|
|
environment 'APP_FLYWAY_ENABLED', 'false'
|
|
environment 'APP_DATASOURCE_DDL_AUTO', 'create-drop'
|
|
// The PostgreSQL idempotency store refuses H2, and a .env copied from .env.example may select it.
|
|
environment 'APP_IDEMPOTENCY_PROVIDER', 'disabled'
|
|
}
|