-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle.kts
64 lines (56 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
plugins {
java
kotlin("jvm") version "1.5.31"
}
repositories {
jcenter()
}
sourceSets {
this.main {
java {
srcDir("src")
}
}
this.test {
java {
srcDir("test")
}
}
}
buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31")
}
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.5.31")
implementation("org.jetbrains.kotlin:kotlin-test:1.5.31")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.31")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")!!
.because("For writing tests for assertion methods")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.5.31")!!
.because("For writing tests for assertion methods")
}
tasks.getByName<Test>("test") {
useJUnitPlatform()
}
tasks.create("execClass", type = JavaExec::class) {
val javaExec = this
javaExec.isIgnoreExitValue = true
sourceSets.main {
javaExec.classpath = runtimeClasspath
}
jvmArgs = listOf("-ea")
main = project.properties["mainClass"].toString()
doLast {
if (executionResult.get().exitValue != 0) {
println(">>> Execution failed")
val logs = File("jvm-logs.txt")
if (!logs.exists()) {
logs.createNewFile()
}
logs.appendText("Execution failed ${project.properties["mainClass"].toString()}\n")
executionResult.get().rethrowFailure()
}
}
}