|
| 1 | +import org.gradle.api.tasks.testing.logging.TestExceptionFormat |
| 2 | +import org.gradle.api.tasks.testing.logging.TestLogEvent |
| 3 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 4 | + |
| 5 | +val jdkVersion = JavaVersion.VERSION_17 |
| 6 | +val jacksonVersion = "2.14.0" |
| 7 | +val jacksonDatabindVersion = "2.14.0" |
| 8 | +val jacksonDataFormatVersion = "2.14.0" |
| 9 | +val vavrVersion = "0.10.2" |
| 10 | +val sqliteVersion = "3.43.0.0" |
| 11 | +val hibernateCommunityDialectsVersion = "6.1.6.Final" |
| 12 | +val mapstructVersion = "1.5.3.Final" |
| 13 | +val caffeineVersion = "3.1.6" |
| 14 | +val kotlinLoggingVersion = "4.0.0-beta-22" |
| 15 | +val kotestVersion = "5.6.2" |
| 16 | +val junitPioneerVersion = "2.0.1" |
| 17 | +val springmockkVersion = "4.0.2" |
| 18 | +val mockkVersion = "1.13.7" |
| 19 | +val springRetryVersion = "2.0.0" |
| 20 | +val jsonApiVersion = "1.10.1" |
| 21 | +val logstashLogbackEncoderVersion = "7.3" |
| 22 | +val okhttp3Version = "4.11.0" |
| 23 | +val awaitilityVersion = "4.2.0" |
| 24 | +val nativeImageConfigPath = "$projectDir/src/main/resources/META-INF/native-image" |
| 25 | +val nativeImageAccessFilterConfigPath = "./src/test/resources/native/access-filter.json" |
| 26 | + |
| 27 | +plugins { |
| 28 | + val springBootVersion = "3.1.3" |
| 29 | + val kotlinVersion = "1.9.0" |
| 30 | + val testLoggerPluginVersion = "3.2.0" |
| 31 | + val springBootDependencyManagementPluginVersion = "1.1.0" |
| 32 | + val buildToolsNativeVersion = "0.9.21" |
| 33 | + |
| 34 | + kotlin("jvm") version kotlinVersion |
| 35 | + kotlin("kapt") version kotlinVersion |
| 36 | + kotlin("plugin.spring") version kotlinVersion |
| 37 | + kotlin("plugin.jpa") version kotlinVersion |
| 38 | + id("org.jetbrains.kotlin.plugin.allopen") version kotlinVersion |
| 39 | + id("org.springframework.boot") version springBootVersion |
| 40 | + id("io.spring.dependency-management") version springBootDependencyManagementPluginVersion |
| 41 | + id("com.adarshr.test-logger").version(testLoggerPluginVersion) |
| 42 | + id("org.graalvm.buildtools.native") version buildToolsNativeVersion |
| 43 | +} |
| 44 | + |
| 45 | +graalvmNative { |
| 46 | + binaries { |
| 47 | + named("main") { |
| 48 | + buildArgs( |
| 49 | + "-H:+ReportExceptionStackTraces", |
| 50 | + "-H:EnableURLProtocols=http,https", |
| 51 | + ) |
| 52 | + } |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +group = "com.app" |
| 57 | +version = "1.0.0" |
| 58 | +java.sourceCompatibility = jdkVersion |
| 59 | + |
| 60 | +repositories { |
| 61 | + mavenCentral() |
| 62 | + maven { url = uri("https://repo.spring.io/milestone") } |
| 63 | + mavenLocal() |
| 64 | +} |
| 65 | + |
| 66 | +java { |
| 67 | + sourceCompatibility = jdkVersion |
| 68 | + targetCompatibility = jdkVersion |
| 69 | + |
| 70 | + withJavadocJar() |
| 71 | + withSourcesJar() |
| 72 | +} |
| 73 | + |
| 74 | +dependencies { |
| 75 | + implementation("org.springframework.boot:spring-boot-starter") |
| 76 | + implementation("org.springframework.boot:spring-boot-starter-data-jpa") |
| 77 | + implementation("org.springframework.boot:spring-boot-starter-web") |
| 78 | + implementation("org.springframework.boot:spring-boot-starter-websocket") |
| 79 | + implementation("org.springframework.boot:spring-boot-starter-cache") |
| 80 | + implementation("org.jetbrains.kotlin:kotlin-reflect") |
| 81 | + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") |
| 82 | + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") |
| 83 | + implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion") |
| 84 | + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion") |
| 85 | + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion") |
| 86 | + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonDataFormatVersion") |
| 87 | + implementation("io.vavr:vavr-kotlin:$vavrVersion") |
| 88 | + implementation("org.flywaydb:flyway-core") |
| 89 | + implementation("org.xerial:sqlite-jdbc:$sqliteVersion") |
| 90 | + implementation("org.hibernate.orm:hibernate-community-dialects:$hibernateCommunityDialectsVersion") |
| 91 | + implementation("org.mapstruct:mapstruct:$mapstructVersion") |
| 92 | + implementation("com.github.ben-manes.caffeine:caffeine:$caffeineVersion") |
| 93 | + implementation("io.github.oshai:kotlin-logging-jvm:$kotlinLoggingVersion") |
| 94 | + implementation("org.springframework.retry:spring-retry:$springRetryVersion") |
| 95 | + implementation("net.logstash.logback:logstash-logback-encoder:$logstashLogbackEncoderVersion") |
| 96 | + implementation("com.squareup.okhttp3:okhttp:$okhttp3Version") |
| 97 | + implementation("com.slm-dev:jsonapi-simple:$jsonApiVersion") |
| 98 | + |
| 99 | + kapt("org.mapstruct:mapstruct-processor:$mapstructVersion") |
| 100 | + |
| 101 | + implementation("org.springframework.boot:spring-boot-starter-test") |
| 102 | + implementation("io.kotest:kotest-runner-junit5:$kotestVersion") |
| 103 | + implementation("io.kotest:kotest-assertions-core:$kotestVersion") |
| 104 | + implementation("io.kotest:kotest-property:$kotestVersion") |
| 105 | + implementation("io.kotest:kotest-assertions-json:$kotestVersion") |
| 106 | + implementation("org.junit-pioneer:junit-pioneer:$junitPioneerVersion") |
| 107 | + implementation("com.ninja-squad:springmockk:$springmockkVersion") |
| 108 | + testImplementation("org.awaitility:awaitility:$awaitilityVersion") |
| 109 | + testImplementation("io.mockk:mockk:$mockkVersion") |
| 110 | +} |
| 111 | + |
| 112 | +allOpen { |
| 113 | + annotations("javax.persistence.Entity", "javax.persistence.MappedSuperclass", "javax.persistence.Embeddable") |
| 114 | +} |
| 115 | + |
| 116 | +kapt { |
| 117 | + arguments { |
| 118 | + arg("mapstruct.defaultComponentModel", "spring") |
| 119 | + arg("mapstruct.unmappedTargetPolicy", "ERROR") |
| 120 | + } |
| 121 | +} |
| 122 | + |
| 123 | +buildscript { |
| 124 | + repositories { |
| 125 | + maven { |
| 126 | + setUrl("https://plugins.gradle.org/m2/") |
| 127 | + } |
| 128 | + } |
| 129 | +} |
| 130 | + |
| 131 | +tasks.withType<KotlinCompile> { |
| 132 | + kotlinOptions { |
| 133 | + freeCompilerArgs = listOf("-Xjsr305=strict") |
| 134 | + jvmTarget = jdkVersion.toString() |
| 135 | + } |
| 136 | +} |
| 137 | + |
| 138 | +tasks.withType<Test> { |
| 139 | + useJUnitPlatform() |
| 140 | + |
| 141 | + jvmArgs = listOf( |
| 142 | + "-agentlib:native-image-agent=access-filter-file=$nativeImageAccessFilterConfigPath,config-merge-dir=$nativeImageConfigPath" |
| 143 | + ) |
| 144 | + testlogger { |
| 145 | + setTheme("mocha") |
| 146 | + } |
| 147 | + testLogging { |
| 148 | + events = setOf( |
| 149 | + TestLogEvent.STARTED, |
| 150 | + TestLogEvent.FAILED, |
| 151 | + TestLogEvent.PASSED, |
| 152 | + TestLogEvent.SKIPPED, |
| 153 | + TestLogEvent.STANDARD_ERROR, |
| 154 | + TestLogEvent.STANDARD_OUT |
| 155 | + ) |
| 156 | + exceptionFormat = TestExceptionFormat.FULL |
| 157 | + showStandardStreams = false |
| 158 | + showCauses = true |
| 159 | + showExceptions = true |
| 160 | + showStackTraces = true |
| 161 | + } |
| 162 | +} |
| 163 | + |
| 164 | +kapt { |
| 165 | + arguments { |
| 166 | + arg("mapstruct.defaultComponentModel", "spring") |
| 167 | + arg("mapstruct.unmappedTargetPolicy", "ERROR") |
| 168 | + } |
| 169 | +} |
| 170 | + |
| 171 | +springBoot { |
| 172 | + buildInfo() |
| 173 | +} |
0 commit comments