initial commit
This commit is contained in:
@@ -0,0 +1,232 @@
|
||||
import com.google.protobuf.gradle.id
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import org.springframework.boot.gradle.tasks.bundling.BootJar
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "2.1.20"
|
||||
kotlin("plugin.spring") version "2.1.20"
|
||||
id("org.springframework.boot") version "3.4.3"
|
||||
id("io.spring.dependency-management") version "1.1.7"
|
||||
id("com.google.protobuf") version "0.9.6"
|
||||
// alias(libs.plugins.ktlint)
|
||||
// alias(libs.plugins.detekt)
|
||||
jacoco
|
||||
}
|
||||
|
||||
apply(from = "$rootDir/gradle/docker.gradle.kts")
|
||||
|
||||
group = "com.project"
|
||||
version = "0.0.1"
|
||||
description = "MovieNight project"
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
configurations {
|
||||
compileOnly {
|
||||
extendsFrom(configurations.annotationProcessor.get())
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
extra["sentryVersion"] = "8.27.0"
|
||||
extra["springGrpcVersion"] = "1.0.1"
|
||||
|
||||
dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
implementation("org.springframework.boot:spring-boot-h2console")
|
||||
implementation("org.springframework.boot:spring-boot-micrometer-tracing-brave")
|
||||
implementation("org.springframework.boot:spring-boot-starter-actuator")
|
||||
implementation("org.springframework.boot:spring-boot-starter-cache")
|
||||
implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
|
||||
implementation("org.springframework.boot:spring-boot-starter-flyway")
|
||||
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||
implementation("org.springframework.boot:spring-boot-starter-validation")
|
||||
implementation("io.grpc:grpc-services")
|
||||
implementation("io.micrometer:micrometer-tracing-bridge-brave")
|
||||
implementation("io.sentry:sentry-spring-boot-4-starter")
|
||||
implementation("net.ttddyy.observation:datasource-micrometer-spring-boot:2.0.1")
|
||||
implementation("org.flywaydb:flyway-database-postgresql")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||
implementation("org.springframework.grpc:spring-grpc-spring-boot-starter")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
|
||||
implementation(libs.emailverifier.kt)
|
||||
|
||||
compileOnly("org.projectlombok:lombok")
|
||||
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
||||
runtimeOnly("com.h2database:h2")
|
||||
runtimeOnly("io.micrometer:micrometer-registry-prometheus")
|
||||
runtimeOnly("org.postgresql:postgresql")
|
||||
annotationProcessor("org.projectlombok:lombok")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-micrometer-tracing-test")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-actuator-test")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-cache-test")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-data-jdbc-test")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-flyway-test")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-security-test")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-validation-test")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
|
||||
testImplementation("org.springframework.grpc:spring-grpc-test")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.set(
|
||||
listOf(
|
||||
"-Xjsr305=strict",
|
||||
"-Xjvm-default=all",
|
||||
"-opt-in=kotlin.RequiresOptIn",
|
||||
"-opt-in=kotlin.ExperimentalStdlibApi",
|
||||
),
|
||||
)
|
||||
jvmTarget.set(JvmTarget.JVM_21)
|
||||
allWarningsAsErrors.set(false)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
sourceCompatibility = "21"
|
||||
targetCompatibility = "21"
|
||||
options.encoding = "UTF-8"
|
||||
options.isIncremental = true
|
||||
}
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom("io.sentry:sentry-bom:${property("sentryVersion")}")
|
||||
mavenBom("org.springframework.grpc:spring-grpc-dependencies:${property("springGrpcVersion")}")
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.addAll("-Xjsr305=strict", "-Xannotation-default-target=param-property")
|
||||
}
|
||||
}
|
||||
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = "com.google.protobuf:protoc:3.25.1"
|
||||
}
|
||||
plugins {
|
||||
id("grpc") {
|
||||
artifact = "io.grpc:protoc-gen-grpc-java:1.60.0"
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
all().forEach {
|
||||
it.plugins {
|
||||
id("grpc") {
|
||||
option("@generated=omit")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
events("passed", "skipped", "failed")
|
||||
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
|
||||
showStandardStreams = false
|
||||
}
|
||||
maxParallelForks = maxOf(1, Runtime.getRuntime().availableProcessors() / 2)
|
||||
minHeapSize = "512m"
|
||||
maxHeapSize = "2048m"
|
||||
systemProperty("spring.profiles.active", "test")
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
filesMatching("**/application.y{a,}ml") {
|
||||
filter { line ->
|
||||
line.replace("\${project.version}", project.version.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<BootJar>("bootJar") {
|
||||
archiveFileName.set("${project.name}-${project.version}.jar")
|
||||
layered {
|
||||
enabled.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
ktlint {
|
||||
version.set(libs.versions.ktlint.get())
|
||||
debug.set(false)
|
||||
verbose.set(true)
|
||||
android.set(false)
|
||||
outputToConsole.set(true)
|
||||
ignoreFailures.set(false)
|
||||
enableExperimentalRules.set(true)
|
||||
filter {
|
||||
exclude("**/build/**")
|
||||
exclude("**/generated/**")
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
detekt {
|
||||
buildUponDefaultConfig = true
|
||||
allRules = false
|
||||
config.setFrom("$projectDir/config/detekt/detekt.yaml")
|
||||
baseline = file("$projectDir/config/detekt/baseline.xml")
|
||||
}
|
||||
*/
|
||||
|
||||
jacoco {
|
||||
toolVersion = "0.8.11"
|
||||
}
|
||||
|
||||
tasks.jacocoTestReport {
|
||||
dependsOn(tasks.test)
|
||||
reports {
|
||||
xml.required.set(true)
|
||||
html.required.set(true)
|
||||
csv.required.set(false)
|
||||
}
|
||||
finalizedBy(tasks.jacocoTestCoverageVerification)
|
||||
}
|
||||
|
||||
tasks.jacocoTestCoverageVerification {
|
||||
violationRules {
|
||||
rule {
|
||||
limit {
|
||||
minimum = "0.60".toBigDecimal()
|
||||
}
|
||||
}
|
||||
rule {
|
||||
element = "CLASS"
|
||||
excludes =
|
||||
listOf(
|
||||
"*.config.*",
|
||||
"*.dto.*",
|
||||
"*.entity.*",
|
||||
)
|
||||
limit {
|
||||
counter = "LINE"
|
||||
value = "COVEREDRATIO"
|
||||
minimum = "0.60".toBigDecimal()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.check {
|
||||
dependsOn(tasks.ktlintCheck)
|
||||
// dependsOn(tasks.detekt)
|
||||
dependsOn(tasks.jacocoTestReport)
|
||||
}
|
||||
Reference in New Issue
Block a user