-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
73 lines (62 loc) · 2.09 KB
/
build.gradle.kts
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
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
plugins {
base
`java-library`
scala
idea
id("com.github.johnrengelman.shadow") version "7.0.0"
id("com.bmuschko.docker-remote-api") version "7.0.0"
}
val scalaVersion = "2.12.10"
group = "pl.touk.nussknacker"
var nussknackerVersion: String by extra
ext {
val versionFromEnv = System.getenv()["NUSSKNACKER_VERSION"]
if (versionFromEnv.isNullOrBlank()) {
nussknackerVersion = File("./nussknacker.version").readText(Charsets.UTF_8).trim()
} else {
nussknackerVersion = versionFromEnv
}
}
println("Nussknacker version: $nussknackerVersion")
repositories {
maven("https://oss.sonatype.org/content/groups/public/")
mavenCentral()
maven("https://packages.confluent.io/maven")
}
dependencies {
implementation(platform("pl.touk.nussknacker:nussknacker-bom_2.12:${nussknackerVersion}"))
compileOnly("org.scala-lang:scala-library")
testImplementation("org.scala-lang:scala-library")
compileOnly("pl.touk.nussknacker:nussknacker-extensions-api_2.12")
}
tasks.register<Copy>("copyFatJarToDockerDir") {
dependsOn(tasks.shadowJar)
from(tasks.shadowJar.flatMap { it.archiveFile }.get().asFile.absolutePath)
rename { "customModel.jar" }
into(file("docker"))
}
fun commonDockerAction(from: String, target: String, task: DockerBuildImage) {
with(task) {
dependsOn("copyFatJarToDockerDir")
inputDir.set(file("docker"))
images.add("$target:latest")
buildArgs.putAll(
mapOf(
"NU_IMAGE" to "$from:${nussknackerVersion}_scala-2.12"
)
)
}
}
tasks.create("buildDesignerImage", DockerBuildImage::class) {
commonDockerAction("touk/nussknacker", rootProject.name, this)
}
tasks.create("buildLiteRuntimeAppImage", DockerBuildImage::class) {
commonDockerAction("touk/nussknacker-lite-runtime-app", "${rootProject.name}-lite-runtime-app", this)
}
tasks.create("buildImages", DefaultTask::class) {
dependsOn("buildDesignerImage", "buildLiteRuntimeAppImage")
}
tasks.test {
useJUnitPlatform()
}