-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
executable file
·84 lines (53 loc) · 1.53 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
74
75
76
77
78
79
80
81
82
83
84
plugins {
java
application
kotlin("jvm") version "1.7.0-Beta"
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(16))
}
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation(fileTree("./lib/") { include ("*.jar")})
implementation(fileTree("./libkotlin/"){include ("*.jar")})
}
application {
mainClassName = "kotlinLabExec.kotlinLab.kotlinLab"
}
sourceSets {
main {
java.srcDir("src/")
}
}
tasks.register<Jar>("uberJar") {
archiveClassifier.set("uber")
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from( {
configurations.runtimeClasspath.get().filter {
it.name.endsWith("jar")}.map{ zipTree(it) }
})
}
var libpathfiles= StringBuilder();
File("./lib").walk().forEach { e ->
if (e.toString().trim().endsWith(".jar"))
libpathfiles.append(e.toString().replaceFirst("./", "").trim()).append(" ")
}
var kotlinlibpathfiles= StringBuilder();
File("./libkotlin").walk().forEach {
e-> if (e.toString().trim().endsWith(".jar"))
kotlinlibpathfiles.append(e.toString().replaceFirst("./","").trim()).append(" ")
}
var allClassPath = libpathfiles.toString().trim()+ " "+kotlinlibpathfiles.toString().trim()
tasks.jar {
baseName = "kotlinLab"
manifest {
attributes["Class-Path"] = allClassPath.trim()
attributes["Main-Class"] = "kotlinLabExec.kotlinLab.kotlinLab"
}
}