1
0
mirror of https://github.com/chylex/Advent-of-Code.git synced 2025-05-29 21:34:06 +02:00

Restructure project configuration (2021)

This commit is contained in:
chylex 2022-12-02 23:34:23 +01:00
parent 59db6f9c82
commit 9e3e084c76
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548
23 changed files with 210 additions and 63 deletions

3
.gitignore vendored
View File

@ -1,6 +1,3 @@
/.gradle/
/build/
/.idea/compiler.xml
/.idea/dictionaries
/.idea/encodings.xml

View File

@ -1,11 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2021 - Day 01" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="MainKt" />
<module name="Advent_of_Code.2021-01" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/01" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,11 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2021 - Day 02" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="MainKt" />
<module name="Advent_of_Code.2021-02" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/02" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,11 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2021 - Day 03" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="MainKt" />
<module name="Advent_of_Code.2021-03" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/03" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,11 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="2021 - Day 04" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="MainKt" />
<module name="Advent_of_Code.2021-04" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/04" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

5
2021/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/.idea/*
!/.idea/runConfigurations
/.gradle/
/build/

View File

@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 01" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="01" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 02" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="02" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 03" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="03" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 04" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="04" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 05" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="05" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 06" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="06" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 07" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="07" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Day 08" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--quiet" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="08" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@ -1,10 +1,12 @@
@file:Suppress("ConvertLambdaToReference")
plugins {
kotlin("jvm") version "1.6.0"
idea
}
group = "com.chylex.adventofcode"
version = "1.0-SNAPSHOT"
version = "1.0"
repositories {
mavenCentral()
@ -19,16 +21,14 @@ idea {
file(".gradle"),
file("build"),
file("gradle"),
file("2015"),
file("2020")
))
}
sourceSets {
fun make(year: Int, day: Int) {
fun make(day: Int) {
val paddedDay = day.toString().padStart(2, '0')
val sourceFolder = file("$year/$paddedDay")
val sourceFolder = file(paddedDay)
val resourceFolder = sourceFolder.resolve("input")
if (!sourceFolder.exists()) {
@ -38,18 +38,21 @@ sourceSets {
resourceFolder.resolve("1.txt").writeText("")
}
create("$year-$paddedDay") {
create(paddedDay) {
java.setSrcDirs(listOf(sourceFolder))
resources.setSrcDirs(listOf(resourceFolder))
}
tasks.register<JavaExec>(paddedDay) {
group = "run"
mainClass.set("MainKt")
workingDir = sourceFolder
classpath = sourceSets[paddedDay].runtimeClasspath
}
}
make(2021, 1)
make(2021, 2)
make(2021, 3)
make(2021, 4)
make(2021, 5)
make(2021, 6)
make(2021, 7)
make(2021, 8)
for (day in 1..8) {
make(day)
}
}

View File

View File

1
2021/settings.gradle.kts Normal file
View File

@ -0,0 +1 @@
rootProject.name = "2021"

View File

@ -8,7 +8,9 @@ I have included Run Configurations for JetBrains IDEs, so if you use the appropr
## \[2021\] Kotlin
The repository contains a Gradle project (`build.gradle.kts`) that sets up every day as a module. You should be able to load the Gradle project into [IntelliJ IDEA](https://www.jetbrains.com/idea/).
The repository contains a Gradle project (`2021/build.gradle.kts`) that sets up every day as a source root and a task that can be launched with `gradlew <day>`, for ex. `gradlew 01`.
You should be able to load the Gradle project into [IntelliJ IDEA](https://www.jetbrains.com/idea/).
The source code is in `main.kt`. The run configuration executes the `main()` method in this file.

View File

@ -1 +0,0 @@
rootProject.name = "Advent of Code"