- 결정 4: JPA evidence·qualification manifest 폐기 → persistence-jpa 테스트, build-tools included build 비움(verifyEnvKeys는 app-bootstrap 태스크, 구현은 build-logic `ca.config-contract`), gRPC release gate 삭제 - 결정 20: API surface 검사를 leaf `check`로, JPA adopter 검사를 `ca.api-surface`로 합침(구현 하나) - 레인 단계 정리(문서 대조 레인은 `mainStage()`), integrationCheck가 입력 없는 레인을 이름과 함께 제외 → 로컬 통과(NEW-16) - release workflow 통합, releaseCheck는 tag 전용, build-logic 비핵심 플러그인 정리, sample을 ArchUnit 대상에 - 보류 4행(B3 변경 모듈만 실행, C 이미지 서명, messaging 카드 검증 이동 2행 — 결정 필요), 남음 2행(O3-5 나머지) - 통합: P17이 옮긴 gRPC release gate 사본 삭제, `grpc-proto-buf`를 release-gate needs에(P17-new-3) 검증: ./gradlew ci verifyDependencyLocks --warning-mode=fail 통과(685 task), mainCheck 통과(268 task), -p optional-platforms ci 통과, -p build-logic test 78건 통과(손상된 TestKit 캐시 삭제 후) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
446 lines
26 KiB
Groovy
446 lines
26 KiB
Groovy
plugins {
|
|
id 'ca.spring-library'
|
|
id 'ca.spring-config'
|
|
id 'org.springframework.boot'
|
|
id 'ca.config-contract'
|
|
id 'ca.auxiliary-source-set'
|
|
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.
|
|
auxiliarySourceSets {
|
|
sourceSet('integrationTest') {
|
|
compilesAgainst 'main'
|
|
inherits 'implementation', 'compileOnly', 'runtimeOnly', 'annotationProcessor'
|
|
}
|
|
sourceSet('architectureTest') {
|
|
compilesAgainst 'main', 'test'
|
|
inherits 'implementation', 'compileOnly', 'runtimeOnly', 'annotationProcessor'
|
|
runtimeFrom 'test'
|
|
}
|
|
// No `runtimeFrom 'test'` and no inherited test dependencies: the full-boot lane runs on the
|
|
// composition bootJar packages (see the configurations block below).
|
|
sourceSet('systemTest') {
|
|
compilesAgainst 'main', 'test'
|
|
inherits 'annotationProcessor'
|
|
}
|
|
}
|
|
|
|
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'
|
|
jvmArgs '-Duser.timezone=UTC'
|
|
shouldRunAfter 'test'
|
|
}
|
|
lane('systemTest') {
|
|
system()
|
|
description = 'Runs full-application startup and shipped-profile characterization tests.'
|
|
sourceSet = 'systemTest'
|
|
maxHeapSize = '1g'
|
|
jvmArgs '-Duser.timezone=UTC'
|
|
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
|
|
jvmArgs '-Duser.timezone=UTC'
|
|
shouldRunAfter 'test'
|
|
}
|
|
}
|
|
|
|
tasks.named('check') {
|
|
dependsOn tasks.named('systemTestLaneCheck')
|
|
}
|
|
|
|
// architectureTest runs on the `test` runtime (runtimeFrom above) 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.
|
|
sourceSets.architectureTest.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'
|
|
}
|
|
|
|
// architectureTest compiles against test fixtures but intentionally mirrors the ordinary test
|
|
// runtime rather than its compile classpath. `runtimeFrom 'test'` above keeps testCompileOnly
|
|
// analysis dependencies out of that lane.
|
|
|
|
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.
|
|
// Two consumers read it: the whole-repository ArchUnit import (spec §7: the architecture suite sees
|
|
// every module of this build and the sample, 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). Neither 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 줄도 함께 푼다)
|
|
|
|
capabilityProjects.each { architectureTestRuntimeOnly project(it) }
|
|
// The sample is the reference adopters copy, so the whole-repository rules read it too (review
|
|
// BUILD-중복-8). Architecture-test runtime only: no production configuration reaches 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 optional-platforms ci` runs
|
|
// verifyCleanArchitectureDependencies), which is the whole of what the owner decided it needs.
|
|
architectureTestRuntimeOnly project(':sample-portfolio')
|
|
|
|
// 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')
|
|
|
|
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')))
|
|
// 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'
|
|
|
|
// OTel/Micrometer tracer runtime (exporter stays off until an OTLP endpoint is set). See README.
|
|
implementation 'io.micrometer:micrometer-tracing-bridge-otel'
|
|
implementation 'io.opentelemetry:opentelemetry-exporter-otlp'
|
|
|
|
// Actuator + Prometheus registry (health/info/prometheus/loggers endpoints).
|
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
|
implementation 'io.micrometer:micrometer-registry-prometheus'
|
|
// Security types for ManagementSecurityConfig (not reachable via adapter-web's implementation dep). 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 checked-in Messaging capability registries for the fail-closed drift gate.
|
|
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'
|
|
// 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'
|
|
}
|
|
|
|
// The contract tests here read the repository itself — docs/registries and docs/runbooks, the
|
|
// module registry and the rest of src/config, build scripts, Dockerfiles, Compose files, workflows,
|
|
// src/.env.example, the root guidance documents. Every one of those is an input, or Gradle calls
|
|
// the lane up to date after exactly the edit the test exists to catch.
|
|
def repositoryRootForContractTests = rootProject.projectDir.parentFile
|
|
def repositoryContractInputs = files(
|
|
fileTree(repositoryRootForContractTests) {
|
|
include 'docs/**', '.github/**', 'infra/**', 'scripts/**', '*.md', '*.yml', '*.example'
|
|
},
|
|
fileTree(rootProject.projectDir) {
|
|
include 'config/**', '**/*.gradle', 'gradle/*.toml', 'Dockerfile*', '.env*', '**/*.md'
|
|
exclude '**/build/**', '**/.gradle/**'
|
|
})
|
|
tasks.withType(Test).configureEach {
|
|
systemProperty 'ca.repository.root', repositoryRootForContractTests.absolutePath
|
|
inputs.files(repositoryContractInputs)
|
|
.withPathSensitivity(PathSensitivity.RELATIVE)
|
|
.withPropertyName('repositoryContractInputs')
|
|
}
|
|
|
|
// 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
|
|
// Pin UTC for the TEST JVM so timestamp tests are host-locale-independent (production UTC is
|
|
// owned elsewhere).
|
|
jvmArgs '-Duser.timezone=UTC'
|
|
}
|
|
|
|
|
|
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': rootProject.releaseProvenance.sourceRevision]
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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 (config/runtime/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) }
|
|
}
|
|
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')
|
|
}
|
|
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'
|
|
}
|