plugins { id 'application' // 3.5 is the last line that still targets Java 17, which is what the // managed webspaces run (see options.release below). id 'org.springframework.boot' version '3.5.16' // the demo of werkcrappit's charts: PIT over werkprobe.shop, Mutation-CRAP, the code city id 'info.solidsoft.pitest' version '1.19.0' id 'de.javagil.werkcrappit' version '0.26.0' } repositories { mavenLocal() mavenCentral() // werkcrappit-pit, and nothing else from there maven { url = 'https://git.javagil.de/api/packages/mi/maven' content { includeGroup 'de.javagil.werkcrappit' } } } // Compiled with Temurin 25, the JDK of all werk repositories (werkregie ADR 0001), // but emitting Java 17 bytecode: 17 is what the Hostsharing managed webspaces // run, and tools/deploy.sh sends the result to one of them. java { toolchain { languageVersion = JavaLanguageVersion.of(25) vendor = JvmVendorSpec.ADOPTIUM } } tasks.withType(JavaCompile).configureEach { options.release = 17 } dependencies { // The BOM that belongs to the Spring Boot plugin applied above. implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES) implementation 'org.springframework.boot:spring-boot-starter-jdbc' // No version: the BOM above decides it. Werkdock's API subset was // measured against Testcontainers 1.19.3 (werkdock // docs/testcontainers-api.md) and is exercised here with whatever // Spring Boot manages — 1.21.4 at the time of writing. That the two // agree is part of what this repository reports. implementation 'org.testcontainers:postgresql' implementation 'org.postgresql:postgresql' // The other two databases werkdock's quirk table claims to know. They // are here because it was wrong about both, and a claim nothing // exercises is how it stayed wrong. implementation 'org.testcontainers:mariadb' implementation 'org.mariadb.jdbc:mariadb-java-client' implementation 'org.testcontainers:mysql' implementation 'com.mysql:mysql-connector-j' // Messaging, because a queue server asks werkdock the same question // a database does and the answers turned out to differ. implementation 'org.testcontainers:rabbitmq' implementation 'com.rabbitmq:amqp-client' implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5' implementation 'org.slf4j:slf4j-simple' modules { // slf4j-simple and Spring Boot's logback starter are two bindings // for one API; keep the one the standalone Probe prints through. module('ch.qos.logback:logback-classic') { replacedBy('org.slf4j:slf4j-simple', 'one slf4j binding is enough') } } testImplementation 'org.testcontainers:junit-jupiter' testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'ch.qos.logback' } testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } // Two programs, one source set: the plain Probe that a host without a // build tool runs (tools/run-probe.sh), and the Spring Boot application // that reads its jdbc:tc URL from application.yml. application { mainClass = 'werkprobe.Probe' } springBoot { mainClass = 'werkprobe.WerkprobeApplication' } tasks.named('test') { useJUnitPlatform() testLogging { showStandardStreams = true; events 'passed', 'failed' } // Testcontainers reads these; a run against werkdock needs both. environment 'DOCKER_HOST', System.getenv('DOCKER_HOST') ?: '' environment 'TESTCONTAINERS_RYUK_DISABLED', 'true' } // dist collects the program and every jar it needs into one directory, // so it can be copied to a host that has a JVM and no build tool — // which is the case on a managed webspace (tools/deploy.sh). It takes // the plain jar (werkprobe-plain.jar, as the Spring Boot plugin names // it) and not the boot jar: on a flat classpath either main class runs, // and the libraries are there but once. tasks.register('dist', Copy) { from configurations.runtimeClasspath from tasks.jar into layout.buildDirectory.dir('dist') } // The demo of werkcrappit's charts (src/main/java/werkprobe/shop): PIT mutates the shop only and // runs its unit tests only, never the container tests; the nightly build `mutation` in .werkator.yml // writes the code city with its structure page and matrix. pitest { pitestVersion = '1.30.0' junit5PluginVersion = '1.2.3' targetClasses = ['werkprobe.shop.*'] targetTests = ['werkprobe.shop.*'] timestampedReports = false } werkcrappit { // sets the colours: red from 90 % of it, 9, yellow from half of that, 4.5; // the demo is red on purpose, so no build runs the gate mutationCrapCheck maxMutationCrap = 10 codeCharta { sourceLinkTemplate = 'https://git.javagil.de/mi/werkprobe/src/commit/{commit}/{path}#L{line}' } }