Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMLABSBRN-960 BE: update Spring, Kotlin to latest #2143

Merged
merged 1 commit into from Jan 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
181 changes: 0 additions & 181 deletions build.gradle

This file was deleted.

193 changes: 193 additions & 0 deletions build.gradle.kts
@@ -0,0 +1,193 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val kotestAssertionsVerstion: String by properties
val kotlinVersion: String by properties
val flywayVersion: String by properties
val log4jApiKotlinVersion: String by properties
val jsonVersoin: String by properties
val junitVersion: String by properties
val mockkVersion: String by properties
val testContainersVersion: String by properties
val kotlinxCoroutinesCoreVersion: String by properties

val ktlint by configurations.creating

plugins {
id("org.springframework.boot")
id("io.spring.dependency-management")
kotlin("jvm")
kotlin("plugin.spring")
kotlin("plugin.jpa")
id("org.jetbrains.kotlin.plugin.allopen")
jacoco
id("org.sonarqube") version "3.0"
}

allOpen {
annotation("javax.persistence.Entity")
annotation("javax.persistence.MappedSuperclass")
annotation("javax.persistence.Embeddable")
}

repositories {
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
ElenaSpb marked this conversation as resolved.
Show resolved Hide resolved
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-batch")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.security:spring-security-test")
implementation("org.springframework.boot:spring-boot-devtools")
implementation("org.postgresql:postgresql")
implementation("org.flywaydb:flyway-core:$flywayVersion")

implementation("com.google.firebase:firebase-admin:7.3.0")

implementation("com.auth0:java-jwt:3.10.3")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-csv")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesCoreVersion")
implementation("org.apache.logging.log4j:log4j-api-kotlin:$log4jApiKotlinVersion")

implementation("io.springfox:springfox-swagger-ui:2.10.5")
implementation("io.springfox:springfox-swagger2:2.9.2")

implementation("com.amazonaws:aws-java-sdk:1.11.808")
implementation("com.google.cloud:google-cloud-storage:1.110.0")

implementation("org.json:json:$jsonVersoin")
implementation("net.bramp.ffmpeg:ffmpeg:0.6.2")

testImplementation("org.springframework.boot:spring-boot-starter-webflux")
testImplementation("org.amshove.kluent:kluent:1.68") //should be deleted after kotest move all of it
testImplementation("org.jetbrains.kotlin:kotlin-test:1.3.72") //should be deleted after kotest move all of it
testImplementation("io.kotest:kotest-assertions:$kotestAssertionsVerstion")
testImplementation("io.kotest:kotest-assertions-core:$kotestAssertionsVerstion")

testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude("junit")
}
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-params:$junitVersion")

testImplementation("org.testcontainers:testcontainers")
testImplementation("com.natpryce:hamkrest:1.8.0.1")
testImplementation("org.testcontainers:junit-jupiter:$testContainersVersion")
testImplementation("org.testcontainers:postgresql:$testContainersVersion")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}

// --- ktlint - kotlin code style plugin ---
configurations {
ktlint
}

dependencies {
ktlint("com.pinterest:ktlint:0.38.0")
}

tasks.register("ktlintFormat", JavaExec::class.java) {
description = "Fix Kotlin code style deviations."
group = "formatting"
classpath = ktlint
main = "com.pinterest.ktlint.Main"
args = listOf("-F", "src/**/*.kt")
}

tasks.register("ktlint", JavaExec::class.java) {
group = "verification"
description = "Runs ktlint."
main = "com.pinterest.ktlint.Main"
classpath = ktlint
args = listOf(
"--reporter=plain",
"--reporter=checkstyle,output=${project.buildDir}/reports/ktlint/ktlint-checkstyle-report.xml",
"src/**/*.kt"
)
}

project.exec {
commandLine = "git config core.hooksPath .githooks".split(" ")
}

tasks.named("compileKotlin") { dependsOn("ktlint") }

tasks.withType<Test> {
useJUnitPlatform {
excludeTags("integration-test")
}
}

tasks.test {
finalizedBy("jacocoTestReport")
}

tasks.withType<JacocoReport> {
dependsOn("test")

reports {
xml.required.set(true)
html.required.set(true)
xml.outputLocation.set(file("${buildDir}/jacoco/coverage.xml"))
csv.required.set(false)
html.outputLocation.set(file("${buildDir}/jacoco/html"))
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.map {
fileTree(it).apply {
exclude(
"com/epam/brn/dto/**",
"com/epam/brn/model/**",
"com/epam/brn/config/**",
"com/epam/brn/exception/**",
"com/epam/brn/Application*"
)
}
}))
}
executionData.setFrom("$buildDir/jacoco/test.exec")
}

task<Test>("integrationTest") {
useJUnitPlatform { includeTags("integration-test") }
mustRunAfter(tasks["test"])
group = "Verification"
description = "Runs the integration tests on Postgres Test Container."
}

sonarqube {
properties {
// Root project information
property("sonar.projectKey", "Brain-up_brn")
property("sonar.organization", "brain-up")
property("sonar.host.url", "https://sonarcloud.io")

property("sonar.coverage.jacoco.xmlReportPaths", "./build/jacoco/coverage.xml")
property("sonar.language", "kotlin")
property("sonar.java.coveragePlugin", "jacoco")
property("sonar.working.directory", "./build/sonar")
property(
"sonar.coverage.exclusions", "**/com/epam/brn/dto/**," +
"**/com/epam/brn/model/**," +
"**/com/epam/brn/config/**," +
"**/com/epam/brn/exception/**," +
"**/com/epam/brn/Application*," +
"**/com/epam/brn/service/load/InitialDataLoader*," +
"**/com/epam/brn/service/load/FirebaseUserDataLoader*"
)
}
}
7 changes: 4 additions & 3 deletions gradle.properties
@@ -1,11 +1,12 @@
kotlin.code.style=official

springBootVersion=2.4.3
springBootVersion=2.5.9
springDependencyVersion=1.0.11.RELEASE
kotlinVersion=1.4.20
kotlinVersion=1.6.10
kotlinxCoroutinesCoreVersion=1.6.0
flywayVersion=6.5.5
junitVersion=5.3.1
mockkVersion=1.12.0
mockkVersion=1.12.2
kotestAssertionsVerstion=4.0.7
jsonVersoin=20210307
log4jApiKotlinVersion=1.1.0
Expand Down