Files
iiko-connector/build.gradle.kts
2026-04-10 15:26:51 +03:00

112 lines
3.3 KiB
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
plugins {
java
application
id("com.gradleup.shadow") version "9.2.2"
}
group = "com.example"
version = "1.0.0-SNAPSHOT"
repositories {
mavenCentral()
}
val vertxVersion = "5.0.10"
val mainVerticleName = "su.xserver.iikocon.MainVerticle"
val launcherClassName = "io.vertx.launcher.application.VertxApplication"
application {
mainClass.set(launcherClassName)
}
dependencies {
implementation(platform("io.vertx:vertx-stack-depchain:$vertxVersion"))
implementation("io.vertx:vertx-launcher-application")
implementation("io.vertx:vertx-web-client")
implementation("io.vertx:vertx-config")
implementation("io.vertx:vertx-sql-client-templates")
implementation("io.vertx:vertx-health-check")
implementation("io.vertx:vertx-web")
implementation("io.vertx:vertx-mysql-client")
implementation("io.vertx:vertx-redis-client")
implementation("io.vertx:vertx-web-sstore-redis")
implementation("io.vertx:vertx-mail-client")
// https://mvnrepository.com/artifact/org.mindrot/jbcrypt
implementation("org.mindrot:jbcrypt:0.4")
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
implementation("org.slf4j:slf4j-api:2.0.17")
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.25.3")
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
implementation("org.apache.logging.log4j:log4j-core:2.25.3")
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api
implementation("org.apache.logging.log4j:log4j-api:2.25.3")
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType<ShadowJar> {
archiveClassifier.set("fat")
manifest {
attributes(mapOf("Main-Verticle" to mainVerticleName))
}
mergeServiceFiles()
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events = setOf(PASSED, SKIPPED, FAILED)
}
}
tasks.withType<JavaExec> {
args = listOf(mainVerticleName)
}
tasks.register("collectAllDependencies") {
group = "project"
description = "Сбор всех зависимостей для офлайн работы"
doLast {
val outDir = File("${rootDir}/libs")
outDir.mkdirs()
val allArtifacts = configurations
.filter { it.isCanBeResolved }
.flatMap { config ->
config.resolvedConfiguration.lenientConfiguration.allModuleDependencies.flatMap { dep ->
dep.allModuleArtifacts
}
}
// ❗ Исключаем артефакты локальных проектов (например, :library)
.filterNot { artifact ->
artifact.id.componentIdentifier.displayName.startsWith("project ")
}
.distinctBy { it.file.name }
allArtifacts.forEach { artifact ->
val outFile = outDir.resolve(artifact.file.name)
if (!outFile.exists() && artifact.file.exists()) {
println("⬇️ Copying ${artifact.moduleVersion.id.group}:${artifact.name}:${artifact.moduleVersion.id.version} ...")
artifact.file.inputStream().use { input ->
outFile.outputStream().use { output ->
input.copyTo(output)
}
}
}
}
println("✅ All dependencies are collected in \"libs\"")
}
}