2023-08-07 22:09:31 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
|
2020-07-12 23:23:16 +00:00
|
|
|
plugins {
|
2021-01-24 04:55:11 +00:00
|
|
|
id "jacoco"
|
2020-07-12 23:23:16 +00:00
|
|
|
id "java"
|
2023-08-07 22:09:31 +00:00
|
|
|
id "org.jetbrains.kotlin.jvm" version "1.8.0"
|
|
|
|
id "org.jetbrains.kotlin.kapt" version "1.8.0"
|
2020-07-12 23:23:16 +00:00
|
|
|
id "application"
|
2021-10-02 03:54:09 +00:00
|
|
|
id "com.github.johnrengelman.shadow" version "7.0.0"
|
2021-01-24 04:55:11 +00:00
|
|
|
id "com.diffplug.spotless" version "5.8.2"
|
2023-08-07 22:09:31 +00:00
|
|
|
id "net.afanasev.sekret" version "0.1.1-RC3"
|
2021-10-02 03:54:09 +00:00
|
|
|
id "com.palantir.git-version" version "0.12.3"
|
2020-07-12 23:23:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
group = "com.mangadex"
|
2021-10-02 03:54:09 +00:00
|
|
|
version = System.getenv("VERSION") ?: gitVersion()
|
|
|
|
|
|
|
|
application {
|
|
|
|
mainClass = "mdnet.MainKt"
|
|
|
|
}
|
2020-07-12 23:23:16 +00:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
runtime.exclude group: "com.sun.mail", module: "javax.mail"
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-07-06 17:12:37 +00:00
|
|
|
implementation "org.jetbrains.kotlin:kotlin-reflect"
|
|
|
|
|
2022-02-18 03:02:37 +00:00
|
|
|
implementation group: "commons-io", name: "commons-io", version: "2.11.0"
|
2023-08-07 22:09:31 +00:00
|
|
|
implementation group: "org.apache.commons", name: "commons-compress", version: "1.22"
|
|
|
|
implementation group: "ch.qos.logback", name: "logback-classic", version: "1.3.6"
|
2021-01-24 04:55:11 +00:00
|
|
|
|
2022-02-18 03:02:37 +00:00
|
|
|
implementation group: "io.micrometer", name: "micrometer-registry-prometheus", version: "1.8.3"
|
2023-08-07 22:09:31 +00:00
|
|
|
implementation group: "com.maxmind.geoip2", name: "geoip2", version: "2.16.1"
|
2020-07-12 23:23:16 +00:00
|
|
|
|
2023-08-07 22:09:31 +00:00
|
|
|
implementation platform(group: "org.http4k", name: "http4k-bom", version: "4.41.3.0")
|
|
|
|
implementation platform(group: "com.fasterxml.jackson", name: "jackson-bom", version: "2.14.2")
|
|
|
|
implementation platform(group: "io.netty", name: "netty-bom", version: "4.1.91.Final")
|
2021-03-02 18:22:24 +00:00
|
|
|
|
|
|
|
implementation group: "org.http4k", name: "http4k-core"
|
|
|
|
implementation group: "org.http4k", name: "http4k-resilience4j"
|
2022-02-18 03:02:37 +00:00
|
|
|
implementation group: "io.github.resilience4j", name: "resilience4j-micrometer", version: "1.7.1"
|
2021-03-02 18:22:24 +00:00
|
|
|
implementation group: "org.http4k", name: "http4k-format-jackson"
|
2021-03-11 20:09:14 +00:00
|
|
|
implementation group: "com.fasterxml.jackson.dataformat", name: "jackson-dataformat-yaml"
|
|
|
|
implementation group: "com.fasterxml.jackson.datatype", name: "jackson-datatype-jsr310"
|
2021-03-02 18:22:24 +00:00
|
|
|
implementation group: "org.http4k", name: "http4k-client-okhttp"
|
|
|
|
implementation group: "org.http4k", name: "http4k-metrics-micrometer"
|
|
|
|
implementation group: "org.http4k", name: "http4k-server-netty"
|
2021-07-19 16:38:09 +00:00
|
|
|
implementation group: "io.netty", name: "netty-codec-haproxy"
|
2021-03-11 20:09:14 +00:00
|
|
|
implementation group: "io.netty", name: "netty-transport-native-epoll", classifier: "linux-x86_64"
|
2023-08-07 22:09:31 +00:00
|
|
|
implementation group: "io.netty.incubator", name: "netty-incubator-transport-native-io_uring", version: "0.0.19.Final", classifier: "linux-x86_64"
|
2021-03-02 18:22:24 +00:00
|
|
|
testImplementation group: "org.http4k", name: "http4k-testing-kotest"
|
2023-08-07 22:09:31 +00:00
|
|
|
runtimeOnly group: "io.netty", name: "netty-tcnative-boringssl-static", version: "2.0.59.Final"
|
2020-07-12 23:23:16 +00:00
|
|
|
|
2022-02-18 03:02:37 +00:00
|
|
|
implementation group: "com.zaxxer", name: "HikariCP", version: "4.0.3"
|
2023-08-07 22:09:31 +00:00
|
|
|
implementation group: "org.xerial", name: "sqlite-jdbc", version: "3.41.2.1"
|
2021-01-24 04:55:11 +00:00
|
|
|
implementation "org.ktorm:ktorm-core:$ktorm_version"
|
|
|
|
implementation "org.ktorm:ktorm-jackson:$ktorm_version"
|
2020-07-12 23:23:16 +00:00
|
|
|
|
2021-03-11 20:09:14 +00:00
|
|
|
implementation "info.picocli:picocli:$picocli_version"
|
|
|
|
kapt "info.picocli:picocli-codegen:$picocli_version"
|
2021-01-24 04:55:11 +00:00
|
|
|
|
|
|
|
testImplementation "io.kotest:kotest-runner-junit5:$kotest_version"
|
|
|
|
testImplementation "io.kotest:kotest-assertions-core:$kotest_version"
|
2023-08-07 22:09:31 +00:00
|
|
|
testImplementation "io.mockk:mockk:1.13.4"
|
2021-01-24 04:55:11 +00:00
|
|
|
}
|
|
|
|
|
2023-08-07 22:09:31 +00:00
|
|
|
tasks.withType(Test).configureEach {
|
2021-01-24 04:55:11 +00:00
|
|
|
useJUnitPlatform()
|
2021-07-06 17:12:37 +00:00
|
|
|
javaLauncher = javaToolchains.launcherFor {
|
|
|
|
languageVersion = JavaLanguageVersion.of(8)
|
|
|
|
}
|
2020-08-11 19:12:01 +00:00
|
|
|
}
|
2021-07-06 17:12:37 +00:00
|
|
|
tasks.register("testDev", Test) {
|
2021-01-24 04:55:11 +00:00
|
|
|
group = "verification"
|
|
|
|
useJUnitPlatform()
|
|
|
|
filter {
|
|
|
|
excludeTestsMatching '*SlowTest'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-11 19:12:01 +00:00
|
|
|
kapt {
|
|
|
|
arguments {
|
|
|
|
arg("project", "${project.group}/${project.name}")
|
|
|
|
}
|
2020-07-12 23:23:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
java {
|
2023-08-07 22:09:31 +00:00
|
|
|
toolchain {
|
|
|
|
languageVersion.set(JavaLanguageVersion.of(8))
|
|
|
|
}
|
2020-07-12 23:23:16 +00:00
|
|
|
}
|
|
|
|
|
2023-08-07 22:09:31 +00:00
|
|
|
tasks.withType(KotlinCompile).configureEach {
|
|
|
|
compilerOptions {
|
2021-10-01 02:19:58 +00:00
|
|
|
freeCompilerArgs = ["-Xjsr305=strict"]
|
2021-01-24 04:55:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-12 23:23:16 +00:00
|
|
|
spotless {
|
|
|
|
kotlin {
|
2021-01-25 02:25:49 +00:00
|
|
|
ktlint("0.40.0").userData(["disabled_rules": "no-wildcard-imports"])
|
|
|
|
licenseHeaderFile "license_header"
|
2020-07-12 23:23:16 +00:00
|
|
|
trimTrailingWhitespace()
|
|
|
|
endWithNewline()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("generateVersion", Copy) {
|
|
|
|
def templateContext = [version: version]
|
|
|
|
inputs.properties templateContext
|
|
|
|
from "src/template/java"
|
|
|
|
into "$buildDir/generated/java"
|
|
|
|
expand templateContext
|
|
|
|
}
|
2021-07-06 17:12:37 +00:00
|
|
|
compileJava.dependsOn generateVersion
|
|
|
|
sourceSets.main.java.srcDir generateVersion
|
2020-07-12 23:23:16 +00:00
|
|
|
|
2021-07-06 17:12:37 +00:00
|
|
|
// https://gist.github.com/medvedev/968119d7786966d9ed4442ae17aca279
|
2020-08-07 23:20:39 +00:00
|
|
|
tasks.register("depsize") {
|
|
|
|
description = 'Prints dependencies for "default" configuration'
|
|
|
|
doLast() {
|
|
|
|
listConfigurationDependencies(configurations.default)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-24 04:55:11 +00:00
|
|
|
tasks.register("depsizeAll") {
|
2020-08-07 23:20:39 +00:00
|
|
|
description = 'Prints dependencies for all available configurations'
|
|
|
|
doLast() {
|
|
|
|
configurations
|
|
|
|
.findAll { it.isCanBeResolved() }
|
|
|
|
.each { listConfigurationDependencies(it) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def listConfigurationDependencies(Configuration configuration) {
|
|
|
|
def formatStr = "%,10.2f"
|
|
|
|
|
|
|
|
def size = configuration.collect { it.length() / (1024 * 1024) }.sum()
|
|
|
|
|
|
|
|
def out = new StringBuffer()
|
|
|
|
out << "\nConfiguration name: \"${configuration.name}\"\n"
|
|
|
|
if (size) {
|
|
|
|
out << 'Total dependencies size:'.padRight(65)
|
|
|
|
out << "${String.format(formatStr, size)} Mb\n\n"
|
|
|
|
|
|
|
|
configuration.sort { -it.length() }
|
|
|
|
.each {
|
|
|
|
out << "${it.name}".padRight(65)
|
|
|
|
out << "${String.format(formatStr, (it.length() / 1024))} kb\n"
|
|
|
|
}
|
|
|
|
} else {
|
2021-01-24 04:55:11 +00:00
|
|
|
out << 'No dependencies found'
|
2020-08-07 23:20:39 +00:00
|
|
|
}
|
|
|
|
println(out)
|
|
|
|
}
|