Skip to content

Commit ea3ee3d

Browse files
committed
Update to the latest Kotlin and Gradle versions
1 parent 97b7bb6 commit ea3ee3d

21 files changed

+176
-136
lines changed

build.gradle.kts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
plugins {
4+
kotlin("jvm") version "1.7.10"
25
application
3-
kotlin("jvm") version "1.4.20"
4-
}
5-
6-
application {
7-
mainClassName = "AdventOfCodeKt"
86
}
97

108
group = "de.zordid"
@@ -14,22 +12,26 @@ repositories {
1412
mavenCentral()
1513
}
1614

17-
tasks.withType<Test> {
18-
useJUnitPlatform()
19-
}
20-
2115
dependencies {
2216
implementation(kotlin("stdlib-jdk8"))
23-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1")
17+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
2418
implementation("org.reflections", "reflections", "0.9.12")
25-
implementation("guru.nidi:graphviz-kotlin:0.17.1")
19+
implementation("guru.nidi:graphviz-kotlin:0.18.1")
2620
//implementation("ch.qos.logback", "logback-classic", "1.2.3")
2721

28-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2")
29-
testImplementation("org.junit.jupiter:junit-jupiter-params:5.4.2")
30-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.2")
22+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
23+
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.0")
24+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
3125
}
3226

33-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
34-
kotlinOptions.jvmTarget = "1.8"
27+
tasks.test {
28+
useJUnitPlatform()
29+
}
30+
31+
tasks.withType<KotlinCompile> {
32+
kotlinOptions.jvmTarget = "17"
33+
}
34+
35+
application {
36+
mainClass.set("AdventOfCodeKt")
3537
}

gradle/gng.cfg

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Configuration file of gng
2+
# 1. key/value pair is separated using '='
3+
# 2. Line starts with '#' will be ignored.
4+
# 3. Empty line is ignored
5+
# 4. Variable Substitution based on envsubst. 'envsubst' is from GNU gettext utilities.
6+
# Please visit https://command-not-found.com/envsubst to find out how to install it
7+
# 5. 'envsubst' is strongly recommended. But it is not mandatory. You can still configure 'gng' using plain values.
8+
9+
# https://github.com/ddimtirov/gwo-agent
10+
#gwo_agent_jar=~/.gradle/gwo-agent.jar
11+
#GRADLE_OPTS=-javaagent:${gwo_agent_jar}=distributionUrl~=@https://services.gradle.org/distributions@https://mymirror/gradle/@
12+

gradle/wrapper/gradle-wrapper.jar

293 Bytes
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Generated by GNG
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

gradlew

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fi
130130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133-
133+
134134
JAVACMD=`cygpath --unix "$JAVACMD"`
135135

136136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
5454
set JAVA_HOME=%JAVA_HOME:"=%
5555
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,29 +64,14 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

8570
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8671

8772

8873
@rem Execute Gradle
89-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
9075

9176
:end
9277
@rem End local scope for the variables with windows NT shell

src/main/kotlin/Day04_PassportProcessing.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Day04 : Day(4, title = "Password Processing") {
2323
}
2424

2525
private fun String.toMap(kvpDelimiter: String, kvDelimiter: String) =
26-
split(kvpDelimiter).map { it.split(kvDelimiter, limit = 2).let { (k, v) -> k to v } }.toMap()
26+
split(kvpDelimiter).associate { it.split(kvDelimiter, limit = 2).let { (k, v) -> k to v } }
2727

2828
}
2929

src/main/kotlin/Day06_CustomCustoms.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class Day06 : Day(6, title = "Custom Customs") {
55
.map { it.split(" ").map(String::toSet) }
66
.show("Customs answers groups")
77

8-
override fun part1() = customsAnswers.map { it.reduce(Set<Char>::union) }.sumBy { it.size }
8+
override fun part1() = customsAnswers.map { it.reduce(Set<Char>::union) }.sumOf { it.size }
99

10-
override fun part2() = customsAnswers.map { it.reduce(Set<Char>::intersect) }.sumBy { it.size }
10+
override fun part2() = customsAnswers.map { it.reduce(Set<Char>::intersect) }.sumOf { it.size }
1111

1212
}
1313

src/main/kotlin/Day07_HandyHaversacks.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Day07 : Day(7, title = "Handy Haversacks") {
1616
override fun part2() = "shiny gold".countContains()
1717

1818
private fun String.countContains(): Int =
19-
rules[this]?.entries?.sumBy { (color, count) -> count + count * color.countContains() } ?: 0
19+
rules[this]?.entries?.sumOf { (color, count) -> count + count * color.countContains() } ?: 0
2020

2121
}
2222

src/main/kotlin/Day15_RambunctiousRecitation.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Day15 : Day(15, title = "Rambunctious Recitation") {
2727
val firstSpoken = startNumbers[0]
2828
var lastSpoken = startNumbers[lastIndex]
2929
for (index in lastIndex until n - 1) {
30-
val lastSeen = stats[lastSpoken].also { stats[lastSpoken] = index}
30+
val lastSeen = stats[lastSpoken].also { stats[lastSpoken] = index }
3131
lastSpoken = if (lastSeen > 0 || lastSpoken == firstSpoken) {
3232
index - lastSeen
3333
} else {

0 commit comments

Comments
 (0)