-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
75 lines (58 loc) · 1.9 KB
/
build.gradle.kts
File metadata and controls
75 lines (58 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
plugins {
kotlin("jvm") version "2.3.10"
id("com.google.cloud.tools.jib") version "3.5.2"
}
group = "net.perfectdreams.yadls"
version = "0.0.2-SNAPSHOT"
kotlin {
jvmToolchain(21)
}
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.oshai:kotlin-logging-jvm:7.0.3")
implementation("ch.qos.logback:logback-classic:1.5.27")
implementation("io.ktor:ktor-server-core:3.4.0")
implementation("io.ktor:ktor-server-netty:3.4.0")
implementation("io.ktor:ktor-server-auto-head-response:3.4.0")
implementation("org.yaml:snakeyaml:2.5")
}
jib {
container {
mainClass = "net.perfectdreams.yetanothersimplemavenrepo.YetAnotherSimpleMavenRepoLauncher"
}
to {
image = "ghcr.io/perfectdreams/yasmr"
auth {
username = System.getProperty("DOCKER_USERNAME") ?: System.getenv("DOCKER_USERNAME")
password = System.getProperty("DOCKER_PASSWORD") ?: System.getenv("DOCKER_PASSWORD")
}
}
from {
image = "eclipse-temurin:25-noble"
}
}
tasks {
val fatJar = task("fatJar", type = Jar::class) {
println("Building fat jar for ${project.name}...")
archiveBaseName.set("${project.name}-fat")
manifest {
attributes["Main-Class"] = "net.perfectdreams.yetanothersimplemavenrepo.YetAnotherSimpleMavenRepoLauncher"
attributes["Class-Path"] = configurations.runtimeClasspath.get().joinToString(" ", transform = { "libs/" + it.name })
}
val libs = File(rootProject.projectDir, "libs")
// libs.deleteRecursively()
libs.mkdirs()
from(configurations.runtimeClasspath.get().mapNotNull {
val output = File(libs, it.name)
if (!output.exists())
it.copyTo(output, true)
null
})
with(jar.get() as CopySpec)
}
named("build") {
dependsOn(fatJar)
}
}