diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8276b7f..2c96b79 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,3 +12,10 @@ concurrency: jobs: test_course_definition: uses: codecrafters-io/course-sdk/.github/workflows/test-course-definition.yml@main + with: + sdkRef: main + permissions: + contents: read + checks: write + pull-requests: write + secrets: inherit diff --git a/compiled_starters/kotlin/.codecrafters/compile.sh b/compiled_starters/kotlin/.codecrafters/compile.sh index 5157150..9256e87 100755 --- a/compiled_starters/kotlin/.codecrafters/compile.sh +++ b/compiled_starters/kotlin/.codecrafters/compile.sh @@ -8,4 +8,7 @@ set -e # Exit on failure -mvn -B package -Ddir=/tmp/codecrafters-build-dir +gradle distTar +cd /tmp/codecrafters-build-sqlite-kotlin/distributions +rm -rf app +tar -xvf app.tar diff --git a/compiled_starters/kotlin/.codecrafters/run.sh b/compiled_starters/kotlin/.codecrafters/run.sh index 99e3fb4..40cd6b5 100755 --- a/compiled_starters/kotlin/.codecrafters/run.sh +++ b/compiled_starters/kotlin/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec java -jar /tmp/codecrafters-build-dir/build-your-own-sqlite.jar "$@" +exec /tmp/codecrafters-build-sqlite-kotlin/distributions/app/bin/app "$@" diff --git a/compiled_starters/kotlin/.gitignore b/compiled_starters/kotlin/.gitignore index 779f0b9..641a7c2 100644 --- a/compiled_starters/kotlin/.gitignore +++ b/compiled_starters/kotlin/.gitignore @@ -1,5 +1,156 @@ # Database files used for testing *.db -target/ -.idea/ \ No newline at end of file +# Ignore Gradle project-specific cache directory +.gradle +.kotlin + +# Ignore Gradle build output directory +**/build + +### Windows template +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +*.iml +*.ipr +*.iws +/.idea/* + +# Exclude non-user-specific stuff +!.idea/.name +!.idea/codeInsightSettings.xml +!.idea/codeStyles/ +!.idea/copyright/ +!.idea/dataSources.xml +!.idea/detekt.xml +!.idea/encodings.xml +!.idea/externalDependencies.xml +!.idea/file.template.settings.xml +!.idea/fileTemplates/ +!.idea/icon.svg +!.idea/inspectionProfiles/ +!.idea/runConfigurations/ +!.idea/scopes/ +!.idea/vcs.xml + +### Kotlin template +# Compiled class file +*.class + +# Log file +*.log + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Gradle template +.gradle + +# Note that you may need to exclude by hand other folders +# named build if necessary (e.g., in src/) +**/build/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle/wrapper/gradle-wrapper.jar + +# Cache of project +.gradletasknamecache +.gitignore-android +### Android-specific stuff +# Built application files +*.apk +*.ap_ +*.aab +*.apks + +# Files for the Dalvik VM +*.dex + +# Generated files +bin/ +gen/ + +# Local configuration file (sdk path, etc) +local.properties + +# Google/Firebase secrets +google-services.json \ No newline at end of file diff --git a/compiled_starters/kotlin/README.md b/compiled_starters/kotlin/README.md index d23bc52..3562885 100644 --- a/compiled_starters/kotlin/README.md +++ b/compiled_starters/kotlin/README.md @@ -15,9 +15,9 @@ and more. # Passing the first stage -The entry point for your SQLite implementation is in `src/main/kotlin/Main.kt`. -Study and uncomment the relevant code, and push your changes to pass the first -stage: +The entry point for your SQLite implementation is in +`app/src/main/kotlin/App.kt`. Study and uncomment the relevant code, and push +your changes to pass the first stage: ```sh git commit -am "pass 1st stage" # any msg @@ -30,9 +30,9 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. -1. Ensure you have `kotlin (>=2.0)` installed locally +1. Ensure you have `gradle (9.1.0)` installed locally 1. Run `./your_program.sh` to run your program, which is implemented in - `src/main/kotlin/Main.kt`. + `app/src/main/kotlin/App.kt`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/compiled_starters/kotlin/app/build.gradle.kts b/compiled_starters/kotlin/app/build.gradle.kts new file mode 100644 index 0000000..dc0bbb3 --- /dev/null +++ b/compiled_starters/kotlin/app/build.gradle.kts @@ -0,0 +1,36 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * This generated file contains a sample Kotlin application project to get you started. + * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/9.1.0/userguide/building_java_projects.html in the Gradle documentation. + */ + +layout.buildDirectory.set(file("/tmp/codecrafters-build-sqlite-kotlin")) + +plugins { + // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. + alias(libs.plugins.kotlin.jvm) + + // Apply the application plugin to add support for building a CLI application in Java. + application +} + +repositories { + // Use Maven Central for resolving dependencies. + mavenCentral() +} + +dependencies { +} + +// Apply a specific Java toolchain to ease working on different environments. +java { + toolchain { + languageVersion = JavaLanguageVersion.of(24) + } +} + +application { + // Define the main class for the application. + mainClass.set("AppKt") +} diff --git a/compiled_starters/kotlin/src/main/kotlin/Main.kt b/compiled_starters/kotlin/app/src/main/kotlin/App.kt similarity index 100% rename from compiled_starters/kotlin/src/main/kotlin/Main.kt rename to compiled_starters/kotlin/app/src/main/kotlin/App.kt diff --git a/compiled_starters/kotlin/codecrafters.yml b/compiled_starters/kotlin/codecrafters.yml index 1f83330..d39b8e8 100644 --- a/compiled_starters/kotlin/codecrafters.yml +++ b/compiled_starters/kotlin/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Kotlin version used to run your code # on Codecrafters. # -# Available versions: kotlin-2.0 -buildpack: kotlin-2.0 +# Available versions: kotlin-2.2 +buildpack: kotlin-2.2 diff --git a/compiled_starters/kotlin/gradle.properties b/compiled_starters/kotlin/gradle.properties new file mode 100644 index 0000000..a8ab6d8 --- /dev/null +++ b/compiled_starters/kotlin/gradle.properties @@ -0,0 +1,6 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties + +org.gradle.caching=true +org.gradle.configuration-cache=true +org.gradle.daemon=false \ No newline at end of file diff --git a/compiled_starters/kotlin/gradle/libs.versions.toml b/compiled_starters/kotlin/gradle/libs.versions.toml new file mode 100644 index 0000000..9d32779 --- /dev/null +++ b/compiled_starters/kotlin/gradle/libs.versions.toml @@ -0,0 +1,5 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format + +[plugins] +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.2.0" } diff --git a/compiled_starters/kotlin/settings.gradle.kts b/compiled_starters/kotlin/settings.gradle.kts new file mode 100644 index 0000000..a5c40a4 --- /dev/null +++ b/compiled_starters/kotlin/settings.gradle.kts @@ -0,0 +1,14 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/9.1.0/userguide/multi_project_builds.html in the Gradle documentation. + */ + +plugins { + // Apply the foojay-resolver plugin to allow automatic download of JDKs + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +rootProject.name = "codecrafters-sqlite" +include("app") diff --git a/compiled_starters/kotlin/your_program.sh b/compiled_starters/kotlin/your_program.sh index f4ccdad..942368f 100755 --- a/compiled_starters/kotlin/your_program.sh +++ b/compiled_starters/kotlin/your_program.sh @@ -14,11 +14,14 @@ set -e # Exit early if any commands fail # - Edit .codecrafters/compile.sh to change how your program compiles remotely ( cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory - mvn -B package -Ddir=/tmp/codecrafters-build-dir + gradle distTar + cd /tmp/codecrafters-build-sqlite-kotlin/distributions + rm -rf app + tar -xvf app.tar ) # Copied from .codecrafters/run.sh # # - Edit this to change how your program runs locally # - Edit .codecrafters/run.sh to change how your program runs remotely -exec java -jar /tmp/codecrafters-build-dir/build-your-own-sqlite.jar "$@" +exec /tmp/codecrafters-build-sqlite-kotlin/distributions/app/bin/app "$@" diff --git a/dockerfiles/kotlin-2.2.Dockerfile b/dockerfiles/kotlin-2.2.Dockerfile new file mode 100644 index 0000000..82f55c2 --- /dev/null +++ b/dockerfiles/kotlin-2.2.Dockerfile @@ -0,0 +1,16 @@ +# syntax=docker/dockerfile:1.7-labs +FROM gradle:jdk24-alpine + +# Ensures the container is re-built if pom.xml changes +ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="settings.gradle.kts,app/build.gradle.kts,gradle/libs.versions.toml" + +WORKDIR /app + +# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses +COPY --exclude=.git --exclude=README.md . /app + +# Install language-specific dependencies +RUN .codecrafters/compile.sh + +RUN mkdir -p /app-cached +RUN if [ -d "/app/.gradle" ]; then mv /app/.gradle /app-cached; fi diff --git a/solutions/kotlin/01-dr6/code/.codecrafters/compile.sh b/solutions/kotlin/01-dr6/code/.codecrafters/compile.sh index 5157150..9256e87 100755 --- a/solutions/kotlin/01-dr6/code/.codecrafters/compile.sh +++ b/solutions/kotlin/01-dr6/code/.codecrafters/compile.sh @@ -8,4 +8,7 @@ set -e # Exit on failure -mvn -B package -Ddir=/tmp/codecrafters-build-dir +gradle distTar +cd /tmp/codecrafters-build-sqlite-kotlin/distributions +rm -rf app +tar -xvf app.tar diff --git a/solutions/kotlin/01-dr6/code/.codecrafters/run.sh b/solutions/kotlin/01-dr6/code/.codecrafters/run.sh index 99e3fb4..40cd6b5 100755 --- a/solutions/kotlin/01-dr6/code/.codecrafters/run.sh +++ b/solutions/kotlin/01-dr6/code/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec java -jar /tmp/codecrafters-build-dir/build-your-own-sqlite.jar "$@" +exec /tmp/codecrafters-build-sqlite-kotlin/distributions/app/bin/app "$@" diff --git a/solutions/kotlin/01-dr6/code/.gitignore b/solutions/kotlin/01-dr6/code/.gitignore index 779f0b9..641a7c2 100644 --- a/solutions/kotlin/01-dr6/code/.gitignore +++ b/solutions/kotlin/01-dr6/code/.gitignore @@ -1,5 +1,156 @@ # Database files used for testing *.db -target/ -.idea/ \ No newline at end of file +# Ignore Gradle project-specific cache directory +.gradle +.kotlin + +# Ignore Gradle build output directory +**/build + +### Windows template +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +*.iml +*.ipr +*.iws +/.idea/* + +# Exclude non-user-specific stuff +!.idea/.name +!.idea/codeInsightSettings.xml +!.idea/codeStyles/ +!.idea/copyright/ +!.idea/dataSources.xml +!.idea/detekt.xml +!.idea/encodings.xml +!.idea/externalDependencies.xml +!.idea/file.template.settings.xml +!.idea/fileTemplates/ +!.idea/icon.svg +!.idea/inspectionProfiles/ +!.idea/runConfigurations/ +!.idea/scopes/ +!.idea/vcs.xml + +### Kotlin template +# Compiled class file +*.class + +# Log file +*.log + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Gradle template +.gradle + +# Note that you may need to exclude by hand other folders +# named build if necessary (e.g., in src/) +**/build/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle/wrapper/gradle-wrapper.jar + +# Cache of project +.gradletasknamecache +.gitignore-android +### Android-specific stuff +# Built application files +*.apk +*.ap_ +*.aab +*.apks + +# Files for the Dalvik VM +*.dex + +# Generated files +bin/ +gen/ + +# Local configuration file (sdk path, etc) +local.properties + +# Google/Firebase secrets +google-services.json \ No newline at end of file diff --git a/solutions/kotlin/01-dr6/code/README.md b/solutions/kotlin/01-dr6/code/README.md index d23bc52..3562885 100644 --- a/solutions/kotlin/01-dr6/code/README.md +++ b/solutions/kotlin/01-dr6/code/README.md @@ -15,9 +15,9 @@ and more. # Passing the first stage -The entry point for your SQLite implementation is in `src/main/kotlin/Main.kt`. -Study and uncomment the relevant code, and push your changes to pass the first -stage: +The entry point for your SQLite implementation is in +`app/src/main/kotlin/App.kt`. Study and uncomment the relevant code, and push +your changes to pass the first stage: ```sh git commit -am "pass 1st stage" # any msg @@ -30,9 +30,9 @@ Time to move on to the next stage! Note: This section is for stages 2 and beyond. -1. Ensure you have `kotlin (>=2.0)` installed locally +1. Ensure you have `gradle (9.1.0)` installed locally 1. Run `./your_program.sh` to run your program, which is implemented in - `src/main/kotlin/Main.kt`. + `app/src/main/kotlin/App.kt`. 1. Commit your changes and run `git push origin master` to submit your solution to CodeCrafters. Test output will be streamed to your terminal. diff --git a/solutions/kotlin/01-dr6/code/app/build.gradle.kts b/solutions/kotlin/01-dr6/code/app/build.gradle.kts new file mode 100644 index 0000000..dc0bbb3 --- /dev/null +++ b/solutions/kotlin/01-dr6/code/app/build.gradle.kts @@ -0,0 +1,36 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * This generated file contains a sample Kotlin application project to get you started. + * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/9.1.0/userguide/building_java_projects.html in the Gradle documentation. + */ + +layout.buildDirectory.set(file("/tmp/codecrafters-build-sqlite-kotlin")) + +plugins { + // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. + alias(libs.plugins.kotlin.jvm) + + // Apply the application plugin to add support for building a CLI application in Java. + application +} + +repositories { + // Use Maven Central for resolving dependencies. + mavenCentral() +} + +dependencies { +} + +// Apply a specific Java toolchain to ease working on different environments. +java { + toolchain { + languageVersion = JavaLanguageVersion.of(24) + } +} + +application { + // Define the main class for the application. + mainClass.set("AppKt") +} diff --git a/solutions/kotlin/01-dr6/code/src/main/kotlin/Main.kt b/solutions/kotlin/01-dr6/code/app/src/main/kotlin/App.kt similarity index 100% rename from solutions/kotlin/01-dr6/code/src/main/kotlin/Main.kt rename to solutions/kotlin/01-dr6/code/app/src/main/kotlin/App.kt diff --git a/solutions/kotlin/01-dr6/code/codecrafters.yml b/solutions/kotlin/01-dr6/code/codecrafters.yml index 1f83330..d39b8e8 100644 --- a/solutions/kotlin/01-dr6/code/codecrafters.yml +++ b/solutions/kotlin/01-dr6/code/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the Kotlin version used to run your code # on Codecrafters. # -# Available versions: kotlin-2.0 -buildpack: kotlin-2.0 +# Available versions: kotlin-2.2 +buildpack: kotlin-2.2 diff --git a/solutions/kotlin/01-dr6/code/gradle.properties b/solutions/kotlin/01-dr6/code/gradle.properties new file mode 100644 index 0000000..a8ab6d8 --- /dev/null +++ b/solutions/kotlin/01-dr6/code/gradle.properties @@ -0,0 +1,6 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties + +org.gradle.caching=true +org.gradle.configuration-cache=true +org.gradle.daemon=false \ No newline at end of file diff --git a/solutions/kotlin/01-dr6/code/gradle/libs.versions.toml b/solutions/kotlin/01-dr6/code/gradle/libs.versions.toml new file mode 100644 index 0000000..9d32779 --- /dev/null +++ b/solutions/kotlin/01-dr6/code/gradle/libs.versions.toml @@ -0,0 +1,5 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format + +[plugins] +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.2.0" } diff --git a/solutions/kotlin/01-dr6/code/settings.gradle.kts b/solutions/kotlin/01-dr6/code/settings.gradle.kts new file mode 100644 index 0000000..a5c40a4 --- /dev/null +++ b/solutions/kotlin/01-dr6/code/settings.gradle.kts @@ -0,0 +1,14 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/9.1.0/userguide/multi_project_builds.html in the Gradle documentation. + */ + +plugins { + // Apply the foojay-resolver plugin to allow automatic download of JDKs + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +rootProject.name = "codecrafters-sqlite" +include("app") diff --git a/solutions/kotlin/01-dr6/code/your_program.sh b/solutions/kotlin/01-dr6/code/your_program.sh index f4ccdad..942368f 100755 --- a/solutions/kotlin/01-dr6/code/your_program.sh +++ b/solutions/kotlin/01-dr6/code/your_program.sh @@ -14,11 +14,14 @@ set -e # Exit early if any commands fail # - Edit .codecrafters/compile.sh to change how your program compiles remotely ( cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory - mvn -B package -Ddir=/tmp/codecrafters-build-dir + gradle distTar + cd /tmp/codecrafters-build-sqlite-kotlin/distributions + rm -rf app + tar -xvf app.tar ) # Copied from .codecrafters/run.sh # # - Edit this to change how your program runs locally # - Edit .codecrafters/run.sh to change how your program runs remotely -exec java -jar /tmp/codecrafters-build-dir/build-your-own-sqlite.jar "$@" +exec /tmp/codecrafters-build-sqlite-kotlin/distributions/app/bin/app "$@" diff --git a/solutions/kotlin/01-dr6/diff/src/main/kotlin/Main.kt.diff b/solutions/kotlin/01-dr6/diff/app/src/main/kotlin/App.kt.diff similarity index 100% rename from solutions/kotlin/01-dr6/diff/src/main/kotlin/Main.kt.diff rename to solutions/kotlin/01-dr6/diff/app/src/main/kotlin/App.kt.diff diff --git a/solutions/kotlin/01-dr6/explanation.md b/solutions/kotlin/01-dr6/explanation.md index 29dab85..b2aa4b6 100644 --- a/solutions/kotlin/01-dr6/explanation.md +++ b/solutions/kotlin/01-dr6/explanation.md @@ -1,4 +1,4 @@ -The entry point for your SQLite implementation is in `src/main/kotlin/Main.kt`. +The entry point for your SQLite implementation is in `app/src/main/kotlin/App.kt`. Study and uncomment the relevant code: diff --git a/starter_templates/kotlin/code/.codecrafters/compile.sh b/starter_templates/kotlin/code/.codecrafters/compile.sh index 5157150..9256e87 100755 --- a/starter_templates/kotlin/code/.codecrafters/compile.sh +++ b/starter_templates/kotlin/code/.codecrafters/compile.sh @@ -8,4 +8,7 @@ set -e # Exit on failure -mvn -B package -Ddir=/tmp/codecrafters-build-dir +gradle distTar +cd /tmp/codecrafters-build-sqlite-kotlin/distributions +rm -rf app +tar -xvf app.tar diff --git a/starter_templates/kotlin/code/.codecrafters/run.sh b/starter_templates/kotlin/code/.codecrafters/run.sh index 99e3fb4..40cd6b5 100755 --- a/starter_templates/kotlin/code/.codecrafters/run.sh +++ b/starter_templates/kotlin/code/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec java -jar /tmp/codecrafters-build-dir/build-your-own-sqlite.jar "$@" +exec /tmp/codecrafters-build-sqlite-kotlin/distributions/app/bin/app "$@" diff --git a/starter_templates/kotlin/code/.gitignore b/starter_templates/kotlin/code/.gitignore index 07827cc..f115df0 100644 --- a/starter_templates/kotlin/code/.gitignore +++ b/starter_templates/kotlin/code/.gitignore @@ -1,2 +1,153 @@ -target/ -.idea/ \ No newline at end of file +# Ignore Gradle project-specific cache directory +.gradle +.kotlin + +# Ignore Gradle build output directory +**/build + +### Windows template +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### macOS template +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +*.iml +*.ipr +*.iws +/.idea/* + +# Exclude non-user-specific stuff +!.idea/.name +!.idea/codeInsightSettings.xml +!.idea/codeStyles/ +!.idea/copyright/ +!.idea/dataSources.xml +!.idea/detekt.xml +!.idea/encodings.xml +!.idea/externalDependencies.xml +!.idea/file.template.settings.xml +!.idea/fileTemplates/ +!.idea/icon.svg +!.idea/inspectionProfiles/ +!.idea/runConfigurations/ +!.idea/scopes/ +!.idea/vcs.xml + +### Kotlin template +# Compiled class file +*.class + +# Log file +*.log + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Gradle template +.gradle + +# Note that you may need to exclude by hand other folders +# named build if necessary (e.g., in src/) +**/build/ + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle/wrapper/gradle-wrapper.jar + +# Cache of project +.gradletasknamecache +.gitignore-android +### Android-specific stuff +# Built application files +*.apk +*.ap_ +*.aab +*.apks + +# Files for the Dalvik VM +*.dex + +# Generated files +bin/ +gen/ + +# Local configuration file (sdk path, etc) +local.properties + +# Google/Firebase secrets +google-services.json \ No newline at end of file diff --git a/starter_templates/kotlin/code/app/build.gradle.kts b/starter_templates/kotlin/code/app/build.gradle.kts new file mode 100644 index 0000000..dc0bbb3 --- /dev/null +++ b/starter_templates/kotlin/code/app/build.gradle.kts @@ -0,0 +1,36 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * This generated file contains a sample Kotlin application project to get you started. + * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/9.1.0/userguide/building_java_projects.html in the Gradle documentation. + */ + +layout.buildDirectory.set(file("/tmp/codecrafters-build-sqlite-kotlin")) + +plugins { + // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. + alias(libs.plugins.kotlin.jvm) + + // Apply the application plugin to add support for building a CLI application in Java. + application +} + +repositories { + // Use Maven Central for resolving dependencies. + mavenCentral() +} + +dependencies { +} + +// Apply a specific Java toolchain to ease working on different environments. +java { + toolchain { + languageVersion = JavaLanguageVersion.of(24) + } +} + +application { + // Define the main class for the application. + mainClass.set("AppKt") +} diff --git a/starter_templates/kotlin/code/src/main/kotlin/Main.kt b/starter_templates/kotlin/code/app/src/main/kotlin/App.kt similarity index 100% rename from starter_templates/kotlin/code/src/main/kotlin/Main.kt rename to starter_templates/kotlin/code/app/src/main/kotlin/App.kt diff --git a/starter_templates/kotlin/code/gradle.properties b/starter_templates/kotlin/code/gradle.properties new file mode 100644 index 0000000..a8ab6d8 --- /dev/null +++ b/starter_templates/kotlin/code/gradle.properties @@ -0,0 +1,6 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties + +org.gradle.caching=true +org.gradle.configuration-cache=true +org.gradle.daemon=false \ No newline at end of file diff --git a/starter_templates/kotlin/code/gradle/libs.versions.toml b/starter_templates/kotlin/code/gradle/libs.versions.toml new file mode 100644 index 0000000..9d32779 --- /dev/null +++ b/starter_templates/kotlin/code/gradle/libs.versions.toml @@ -0,0 +1,5 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format + +[plugins] +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.2.0" } diff --git a/starter_templates/kotlin/code/settings.gradle.kts b/starter_templates/kotlin/code/settings.gradle.kts new file mode 100644 index 0000000..a5c40a4 --- /dev/null +++ b/starter_templates/kotlin/code/settings.gradle.kts @@ -0,0 +1,14 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/9.1.0/userguide/multi_project_builds.html in the Gradle documentation. + */ + +plugins { + // Apply the foojay-resolver plugin to allow automatic download of JDKs + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +rootProject.name = "codecrafters-sqlite" +include("app") diff --git a/starter_templates/kotlin/config.yml b/starter_templates/kotlin/config.yml index e1bd5fb..6b6eefa 100644 --- a/starter_templates/kotlin/config.yml +++ b/starter_templates/kotlin/config.yml @@ -1,3 +1,3 @@ attributes: - required_executable: "kotlin (>=2.0)" - user_editable_file: src/main/kotlin/Main.kt + required_executable: "gradle (9.1.0)" + user_editable_file: app/src/main/kotlin/App.kt