Initial commit

This commit is contained in:
2023-07-01 21:49:36 +02:00
commit 05b15e01e3
77 changed files with 4249 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
plugins {
id 'groovy-gradle-plugin'
}
repositories {
gradlePluginPortal()
}
dependencies {
implementation libs.plugin.springboot
implementation libs.plugin.lombok
implementation libs.plugin.nebula.release
implementation libs.plugin.gradle.versions
implementation libs.plugin.version.catalog
}
+9
View File
@@ -0,0 +1,9 @@
rootProject.name = 'twomartens.config'
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
@@ -0,0 +1,6 @@
plugins {
id 'idea'
id 'eclipse'
}
group = projectgroup
@@ -0,0 +1,23 @@
plugins {
id 'checkstyle'
id 'twomartens.java-base'
}
checkstyle {
toolVersion '10.0'
ignoreFailures = false
maxWarnings = 0
configFile rootProject.file('config/checkstyle/checkstyle.xml')
configProperties = ['org.checkstyle.google.suppressionfilter.config': "${project.rootDir}/config/checkstyle/checkstyle-suppressions.xml"]
tasks.withType(Checkstyle).tap {
configureEach {
reports {
xml.required = true
html.required = true
}
}
}
}
@@ -0,0 +1,22 @@
plugins {
id 'java'
id 'java-library'
id 'twomartens.base'
}
sourceCompatibility = projectSourceCompatibility
targetCompatibility = projectSourceCompatibility
repositories {
mavenCentral()
}
tasks.register('buildAll') {
group 'build'
dependsOn(build)
dependsOn(test)
}
clean {
delete 'out'
}
@@ -0,0 +1,15 @@
plugins {
id 'twomartens.java-base'
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += "--enable-preview"
}
tasks.withType(Test).configureEach {
jvmArgs += "--enable-preview"
}
tasks.withType(JavaExec).configureEach {
jvmArgs += '--enable-preview'
}
@@ -0,0 +1,71 @@
import java.text.SimpleDateFormat
plugins {
id 'jacoco'
id 'io.freefair.lombok'
id 'twomartens.java-base'
id 'twomartens.checkstyle'
}
dependencies {
constraints.implementation libs.bundles.logging
implementation libs.slf4j.api
runtimeOnly libs.bundles.logging
testImplementation libs.bundles.test
}
configurations {
configureEach {
exclude group: 'junit', module: 'junit'
// we are using log4j-slf4j2-impl, so we need to suppress spring include of log4j-slf4j-impl
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
}
}
test {
systemProperty 'junit.jupiter.execution.parallel.enabled', true
systemProperty 'junit.jupiter.execution.parallel.mode.default', "concurrent"
useJUnitPlatform()
maxHeapSize = "4g"
workingDir = rootProject.projectDir
finalizedBy jacocoTestReport
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
jacocoTestReport {
dependsOn(test)
reports {
xml.required = true
}
}
jar {
doFirst {
manifest {
attributes 'Implementation-Title': rootProject.name,
'Implementation-Version': archiveVersion.get(),
'Implementation-Vendor': "Jim Martens",
'Build-Timestamp': new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'Created-By': "Gradle ${gradle.gradleVersion}",
'Build-Jdk': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS': "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
}
}
}
normalization.runtimeClasspath.metaInf {
ignoreAttribute("Build-Timestamp")
}
tasks.register('cleanLibs') {
delete("${buildDir}/libs")
}
tasks.build.dependsOn("cleanLibs")
@@ -0,0 +1,16 @@
plugins {
id 'com.netflix.nebula.release'
id 'twomartens.base'
}
nebulaRelease {
addReleaseBranchPattern(/main/)
}
task writeVersionProperties() {
group 'version'
buildDir.mkdirs()
file("$buildDir/version.properties").text = "VERSION=${project.version.toString()}\n"
mustRunAfter("release")
outputs.file("$buildDir/version.properties")
}
@@ -0,0 +1,40 @@
plugins {
id 'twomartens.spring-boot'
}
dependencies {
implementation platform(libs.spring.cloud)
implementation libs.bundles.spring.boot.server
implementation libs.spring.openapi
implementation libs.httpclient
implementation libs.prometheus
}
sourceSets {
"server-test" {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/server-test/java')
}
resources.srcDir file('src/server-test/resources')
}
}
configurations {
serverTestImplementation.extendsFrom testImplementation
}
tasks.register('serverTest', Test) {
outputs.upToDateWhen { false }
systemProperty 'junit.jupiter.execution.parallel.enabled', true
systemProperty 'junit.jupiter.execution.parallel.mode.default', "concurrent"
systemProperty 'junit.jupiter.execution.parallel.mode.classes.default', "concurrent"
useJUnitPlatform()
maxHeapSize = "4g"
group = 'verification'
workingDir = rootProject.projectDir
testClassesDirs = sourceSets."server-test".output.classesDirs
classpath = sourceSets."server-test".runtimeClasspath
}
@@ -0,0 +1,60 @@
plugins {
id 'org.springframework.boot'
id 'twomartens.java'
}
dependencies {
implementation platform(libs.spring.boot)
implementation libs.bundles.spring.boot
testImplementation libs.spring.boot.test
annotationProcessor libs.spring.boot.config
}
sourceSets {
"integration-test" {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
configureEach {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
integrationTestImplementation.extendsFrom testImplementation
}
tasks.register('integrationTest', Test) {
systemProperty 'junit.jupiter.execution.parallel.enabled', true
systemProperty 'junit.jupiter.execution.parallel.mode.default', "concurrent"
systemProperty 'junit.jupiter.execution.parallel.mode.classes.default', "concurrent"
useJUnitPlatform()
maxHeapSize = "4g"
group = 'verification'
workingDir = rootProject.projectDir
testClassesDirs = sourceSets."integration-test".output.classesDirs
classpath = sourceSets."integration-test".runtimeClasspath
}
tasks.named("buildAll").configure() {
dependsOn(integrationTest)
}
springBoot {
buildInfo()
}
bootJar {
enabled = false
}
jar {
enabled = true
archiveClassifier.set("")
}
@@ -0,0 +1,29 @@
plugins {
id "com.github.ben-manes.versions"
id "nl.littlerobots.version-catalog-update"
}
dependencyUpdates {
revision = "release"
gradleReleaseChannel = "current"
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version)
}
}
tasks.named("versionCatalogUpdate").configure {
group 'version'
}
tasks.named("dependencyUpdates").configure {
group 'version'
}