125 lines
3.9 KiB
Groovy
125 lines
3.9 KiB
Groovy
plugins {
|
|
id "java"
|
|
id "org.jetbrains.kotlin.jvm" version "1.4.0"
|
|
id "org.jetbrains.kotlin.kapt" version "1.4.0"
|
|
id "application"
|
|
id "com.github.johnrengelman.shadow" version "5.2.0"
|
|
id "com.diffplug.spotless" version "5.2.0"
|
|
id "dev.afanasev.sekret" version "0.0.7"
|
|
}
|
|
|
|
group = "com.mangadex"
|
|
version = "git describe --tags --dirty".execute().text.trim()
|
|
mainClassName = "mdnet.base.Main"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
jcenter()
|
|
}
|
|
|
|
configurations {
|
|
runtime.exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-core"
|
|
runtime.exclude group: "com.sun.mail", module: "javax.mail"
|
|
}
|
|
|
|
dependencies {
|
|
compileOnly group: "dev.afanasev", name: "sekret-annotation", version: "0.0.7"
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
|
implementation "org.jetbrains.kotlin:kotlin-reflect"
|
|
|
|
implementation group: "commons-io", name: "commons-io", version: "2.7"
|
|
|
|
implementation group: "org.http4k", name: "http4k-core", version: "$http_4k_version"
|
|
implementation group: "org.http4k", name: "http4k-format-jackson", version: "$http_4k_version"
|
|
implementation group: "com.fasterxml.jackson.datatype", name: "jackson-datatype-jsr310", version: "2.11.1"
|
|
implementation group: "org.http4k", name: "http4k-client-apache4", version: "$http_4k_version"
|
|
implementation group: "org.http4k", name: "http4k-server-netty", version: "$http_4k_version"
|
|
runtimeOnly group: "io.netty", name: "netty-tcnative-boringssl-static", version: "2.0.34.Final"
|
|
|
|
implementation group: "ch.qos.logback", name: "logback-classic", version: "1.3.0-alpha4"
|
|
implementation group: "org.jetbrains.exposed", name: "exposed-core", version: "$exposed_version"
|
|
implementation group: "org.jetbrains.exposed", name: "exposed-dao", version: "$exposed_version"
|
|
implementation group: "org.jetbrains.exposed", name: "exposed-jdbc", version: "$exposed_version"
|
|
|
|
implementation group: "org.xerial", name: "sqlite-jdbc", version: "3.32.3.2"
|
|
|
|
implementation "info.picocli:picocli:4.5.0"
|
|
kapt "info.picocli:picocli-codegen:4.5.0"
|
|
}
|
|
|
|
kapt {
|
|
arguments {
|
|
arg("project", "${project.group}/${project.name}")
|
|
}
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
spotless {
|
|
lineEndings 'UNIX'
|
|
java {
|
|
targetExclude("build/generated/**/*")
|
|
eclipse()
|
|
removeUnusedImports()
|
|
trimTrailingWhitespace()
|
|
endWithNewline()
|
|
}
|
|
kotlin {
|
|
ktlint()
|
|
trimTrailingWhitespace()
|
|
endWithNewline()
|
|
}
|
|
}
|
|
|
|
tasks.register("generateVersion", Copy) {
|
|
def templateContext = [version: version]
|
|
inputs.properties templateContext
|
|
from "src/template/java"
|
|
into "$buildDir/generated/java"
|
|
expand templateContext
|
|
}
|
|
|
|
sourceSets.main.java.srcDir generateVersion.outputs.files
|
|
|
|
tasks.register("depsize") {
|
|
description = 'Prints dependencies for "default" configuration'
|
|
doLast() {
|
|
listConfigurationDependencies(configurations.default)
|
|
}
|
|
}
|
|
|
|
tasks.register("depsize-all-configurations") {
|
|
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 {
|
|
out << 'No dependencies found';
|
|
}
|
|
println(out)
|
|
}
|