diff --git a/advents/build.gradle.kts b/advents/build.gradle.kts index 27c6799..d3b5c2b 100644 --- a/advents/build.gradle.kts +++ b/advents/build.gradle.kts @@ -83,6 +83,11 @@ tasks { classpath = sourceSets["main"].runtimeClasspath } + register("advent2023", JavaExec::class) { + mainClass.set("net.fish.y2023.AdventOfCode2023") + classpath = sourceSets["main"].runtimeClasspath + } + register("advent2022day12", JavaExec::class) { mainClass.set("net.fish.y2022.Advent2022Day12") classpath = sourceSets["main"].runtimeClasspath @@ -99,14 +104,14 @@ tasks { named("compileKotlin") { kotlinOptions { - jvmTarget = "11" + jvmTarget = "17" javaParameters = true } } named("compileTestKotlin") { kotlinOptions { - jvmTarget = "11" + jvmTarget = "17" javaParameters = true freeCompilerArgs += listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn") } diff --git a/advents/src/main/kotlin/net/fish/y2023/AdventOfCode.kt b/advents/src/main/kotlin/net/fish/y2023/AdventOfCode.kt new file mode 100644 index 0000000..671a9c8 --- /dev/null +++ b/advents/src/main/kotlin/net/fish/y2023/AdventOfCode.kt @@ -0,0 +1,15 @@ +@file:JvmName("AdventOfCode2023") +package net.fish.y2023 + +import net.fish.Reflect +import net.fish.Runner + +object AdventOfCode { + val days = Reflect.getDays(2023) +} + +fun main(args: Array) { + // WindowsAnsi.setup() + val day = if(args.isEmpty()) 0 else args[0].toInt() + Runner.run(2023, AdventOfCode.days, day) +} \ No newline at end of file diff --git a/advents/src/main/kotlin/net/fish/y2023/Day01.kt b/advents/src/main/kotlin/net/fish/y2023/Day01.kt new file mode 100644 index 0000000..bc11b18 --- /dev/null +++ b/advents/src/main/kotlin/net/fish/y2023/Day01.kt @@ -0,0 +1,21 @@ +package net.fish.y2023 + +import net.fish.Day +import net.fish.resourceLines + +object Day01 : Day { + private val data by lazy { resourceLines(2023, 1) } + + override fun part1() = doPart1(data) + override fun part2() = doPart2(data) + + fun doPart1(data: List): Int = data.size + fun doPart2(data: List): Int = data.size + + @JvmStatic + fun main(args: Array) { + println(part1()) + println(part2()) + } + +} \ No newline at end of file diff --git a/advents/src/main/kotlin/net/fish/y2023/DayTemplate.kt b/advents/src/main/kotlin/net/fish/y2023/DayTemplate.kt new file mode 100644 index 0000000..d63676b --- /dev/null +++ b/advents/src/main/kotlin/net/fish/y2023/DayTemplate.kt @@ -0,0 +1,21 @@ +package net.fish.y2023 + +import net.fish.Day +import net.fish.resourceLines + +object DayTemplate : Day { + private val data by lazy { resourceLines(2023, 0) } + + override fun part1() = doPart1(data) + override fun part2() = doPart2(data) + + fun doPart1(data: List): Int = data.size + fun doPart2(data: List): Int = data.size + + @JvmStatic + fun main(args: Array) { + println(part1()) + println(part2()) + } + +} \ No newline at end of file diff --git a/advents/src/main/resources/2023/day01.txt b/advents/src/main/resources/2023/day01.txt new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/advents/src/main/resources/2023/day01.txt @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index d350a15..0a77357 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { tasks { getByName("wrapper") { - gradleVersion = "7.6" + gradleVersion = "8.4" distributionType = Wrapper.DistributionType.ALL } } diff --git a/gradle.properties b/gradle.properties index 8fc2bd4..f709437 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,24 +1,24 @@ -kotlinVersion=1.7.21 -kotlinxCoroutineVersion=1.6.4 +kotlinVersion=1.8.20 +kotlinxCoroutineVersion=1.7.3 kotlinxSerializationRuntime=1.7.20 -shadowVersion=7.1.2 +shadowVersion=8.1.1 mathsToolKitVersion=1.0.3 -reflectionsVersion=0.9.12 -mordantVersion=2.0.0-beta9 +reflectionsVersion=0.10.2 +mordantVersion=2.2.0 orToolsVersion=9.5.2237 -kEvalVersion=0.8.0 +kEvalVersion=0.9.0 lwjglVersion=3.3.2 jomlVersion=1.10.5 # see https://github.com/kotlin-graphics/mary/tree/master/kotlin/graphics for the subdirs and their versions -glmVersion=0.9.9.1-5 -glnVersion=0.5.31 -unoVersion=0.7.9+52 +glmVersion=0.9.9.1-11 +glnVersion=0.5.32 +unoVersion=0.7.21 -logbackClassicVersion=1.2.3 -logbackEncoderVersion=6.4 +logbackClassicVersion=1.2.9 +logbackEncoderVersion=7.4 kotlinLoggingVersion=2.0.3 junitJupiterEngineVersion=5.9.1 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..7f93135 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2b22d05..8838ba9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \