-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
45 lines (37 loc) · 1012 Bytes
/
build.gradle
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
plugins {
id "java"
}
group = "com.martinvana.aoc2024"
version = "1.0-SNAPSHOT"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
testImplementation platform("org.junit:junit-bom:5.11.3")
testImplementation "org.junit.jupiter:junit-jupiter"
}
tasks.named('test') {
useJUnitPlatform()
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ['--enable-preview']
}
tasks.withType(JavaExec).configureEach {
jvmArgs += '--enable-preview'
jvmArgs += '-ea'
}
tasks.withType(JavaExec).configureEach { javaExecTask ->
javaExecTask.doFirst {
javaExecTask.extensions.extraProperties["startTime"] = System.nanoTime()
}
javaExecTask.doLast {
def startTime = javaExecTask.extensions.extraProperties["startTime"]
def durationMillis = (System.nanoTime() - startTime) / 1_000_000
println "Task ${javaExecTask.path} took ${durationMillis} ms"
}
}