-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy pathbuild.gradle.kts
52 lines (45 loc) · 1.12 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
plugins {
kotlin("jvm") version "1.7.22"
}
repositories {
mavenCentral()
}
tasks {
sourceSets {
main {
java.srcDirs("src")
}
}
wrapper {
gradleVersion = "7.6"
}
task("generateNextDay") {
doLast {
val prevDayNum = fileTree("$projectDir/src").matching {
include("Day*.kt")
}.maxOf {
val (prevDayNum) = Regex("Day(\\d\\d)").find(it.name)!!.destructured
prevDayNum.toInt()
}
val newDayNum = String.format("%02d", prevDayNum + 1)
File("$projectDir/src", "Day$newDayNum.kt").writeText(
"""
fun main() {
fun part1(input: List<String>): Int {
return 0
}
fun part2(input: List<String>): Int {
return 0
}
// test if implementation meets criteria from the description, like:
val testInput = readInput("resources/Day${newDayNum}_test")
check(part1(testInput) == 0)
val input = readInput("resources/Day$newDayNum")
println(part1(input))
println(part2(input))
}
"""
)
}
}
}