Skip to content

Commit 599dacd

Browse files
authored
Merge pull request #148 from codecrafters-io/andy/kotlin
[SQLite] [CC-1966] [Kotlin] Use gradle and upgrade to 2.2
2 parents c0b5f86 + 25ce411 commit 599dacd

File tree

35 files changed

+707
-33
lines changed

35 files changed

+707
-33
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ concurrency:
1212
jobs:
1313
test_course_definition:
1414
uses: codecrafters-io/course-sdk/.github/workflows/test-course-definition.yml@main
15+
with:
16+
sdkRef: main
17+
permissions:
18+
contents: read
19+
checks: write
20+
pull-requests: write
21+
secrets: inherit

compiled_starters/kotlin/.codecrafters/compile.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88

99
set -e # Exit on failure
1010

11-
mvn -B package -Ddir=/tmp/codecrafters-build-dir
11+
gradle distTar
12+
cd /tmp/codecrafters-build-sqlite-kotlin/distributions
13+
rm -rf app
14+
tar -xvf app.tar

compiled_starters/kotlin/.codecrafters/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
set -e # Exit on failure
1010

11-
exec java -jar /tmp/codecrafters-build-dir/build-your-own-sqlite.jar "$@"
11+
exec /tmp/codecrafters-build-sqlite-kotlin/distributions/app/bin/app "$@"
Lines changed: 153 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,156 @@
11
# Database files used for testing
22
*.db
33

4-
target/
5-
.idea/
4+
# Ignore Gradle project-specific cache directory
5+
.gradle
6+
.kotlin
7+
8+
# Ignore Gradle build output directory
9+
**/build
10+
11+
### Windows template
12+
# Windows thumbnail cache files
13+
Thumbs.db
14+
Thumbs.db:encryptable
15+
ehthumbs.db
16+
ehthumbs_vista.db
17+
18+
# Dump file
19+
*.stackdump
20+
21+
# Folder config file
22+
[Dd]esktop.ini
23+
24+
# Recycle Bin used on file shares
25+
$RECYCLE.BIN/
26+
27+
# Windows Installer files
28+
*.cab
29+
*.msi
30+
*.msix
31+
*.msm
32+
*.msp
33+
34+
# Windows shortcuts
35+
*.lnk
36+
37+
### macOS template
38+
# General
39+
.DS_Store
40+
.AppleDouble
41+
.LSOverride
42+
43+
# Icon must end with two \r
44+
Icon
45+
46+
# Thumbnails
47+
._*
48+
49+
# Files that might appear in the root of a volume
50+
.DocumentRevisions-V100
51+
.fseventsd
52+
.Spotlight-V100
53+
.TemporaryItems
54+
.Trashes
55+
.VolumeIcon.icns
56+
.com.apple.timemachine.donotpresent
57+
58+
# Directories potentially created on remote AFP share
59+
.AppleDB
60+
.AppleDesktop
61+
Network Trash Folder
62+
Temporary Items
63+
.apdisk
64+
65+
### Linux template
66+
*~
67+
68+
# temporary files which can be created if a process still has a handle open of a deleted file
69+
.fuse_hidden*
70+
71+
# KDE directory preferences
72+
.directory
73+
74+
# Linux trash folder which might appear on any partition or disk
75+
.Trash-*
76+
77+
# .nfs files are created when an open file is removed but is still being accessed
78+
.nfs*
79+
80+
### JetBrains template
81+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
82+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
83+
84+
*.iml
85+
*.ipr
86+
*.iws
87+
/.idea/*
88+
89+
# Exclude non-user-specific stuff
90+
!.idea/.name
91+
!.idea/codeInsightSettings.xml
92+
!.idea/codeStyles/
93+
!.idea/copyright/
94+
!.idea/dataSources.xml
95+
!.idea/detekt.xml
96+
!.idea/encodings.xml
97+
!.idea/externalDependencies.xml
98+
!.idea/file.template.settings.xml
99+
!.idea/fileTemplates/
100+
!.idea/icon.svg
101+
!.idea/inspectionProfiles/
102+
!.idea/runConfigurations/
103+
!.idea/scopes/
104+
!.idea/vcs.xml
105+
106+
### Kotlin template
107+
# Compiled class file
108+
*.class
109+
110+
# Log file
111+
*.log
112+
113+
# Package Files #
114+
*.jar
115+
*.war
116+
*.nar
117+
*.ear
118+
*.zip
119+
*.tar.gz
120+
*.rar
121+
122+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
123+
hs_err_pid*
124+
125+
### Gradle template
126+
.gradle
127+
128+
# Note that you may need to exclude by hand other folders
129+
# named build if necessary (e.g., in src/)
130+
**/build/
131+
132+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
133+
!gradle/wrapper/gradle-wrapper.jar
134+
135+
# Cache of project
136+
.gradletasknamecache
137+
.gitignore-android
138+
### Android-specific stuff
139+
# Built application files
140+
*.apk
141+
*.ap_
142+
*.aab
143+
*.apks
144+
145+
# Files for the Dalvik VM
146+
*.dex
147+
148+
# Generated files
149+
bin/
150+
gen/
151+
152+
# Local configuration file (sdk path, etc)
153+
local.properties
154+
155+
# Google/Firebase secrets
156+
google-services.json

compiled_starters/kotlin/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ and more.
1515

1616
# Passing the first stage
1717

18-
The entry point for your SQLite implementation is in `src/main/kotlin/Main.kt`.
19-
Study and uncomment the relevant code, and push your changes to pass the first
20-
stage:
18+
The entry point for your SQLite implementation is in
19+
`app/src/main/kotlin/App.kt`. Study and uncomment the relevant code, and push
20+
your changes to pass the first stage:
2121

2222
```sh
2323
git commit -am "pass 1st stage" # any msg
@@ -30,9 +30,9 @@ Time to move on to the next stage!
3030

3131
Note: This section is for stages 2 and beyond.
3232

33-
1. Ensure you have `kotlin (>=2.0)` installed locally
33+
1. Ensure you have `gradle (9.1.0)` installed locally
3434
1. Run `./your_program.sh` to run your program, which is implemented in
35-
`src/main/kotlin/Main.kt`.
35+
`app/src/main/kotlin/App.kt`.
3636
1. Commit your changes and run `git push origin master` to submit your solution
3737
to CodeCrafters. Test output will be streamed to your terminal.
3838

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*
4+
* This generated file contains a sample Kotlin application project to get you started.
5+
* 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.
6+
*/
7+
8+
layout.buildDirectory.set(file("/tmp/codecrafters-build-sqlite-kotlin"))
9+
10+
plugins {
11+
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
12+
alias(libs.plugins.kotlin.jvm)
13+
14+
// Apply the application plugin to add support for building a CLI application in Java.
15+
application
16+
}
17+
18+
repositories {
19+
// Use Maven Central for resolving dependencies.
20+
mavenCentral()
21+
}
22+
23+
dependencies {
24+
}
25+
26+
// Apply a specific Java toolchain to ease working on different environments.
27+
java {
28+
toolchain {
29+
languageVersion = JavaLanguageVersion.of(24)
30+
}
31+
}
32+
33+
application {
34+
// Define the main class for the application.
35+
mainClass.set("AppKt")
36+
}

compiled_starters/kotlin/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the Kotlin version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: kotlin-2.0
11-
buildpack: kotlin-2.0
10+
# Available versions: kotlin-2.2
11+
buildpack: kotlin-2.2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
3+
4+
org.gradle.caching=true
5+
org.gradle.configuration-cache=true
6+
org.gradle.daemon=false
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was generated by the Gradle 'init' task.
2+
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
3+
4+
[plugins]
5+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version = "2.2.0" }

0 commit comments

Comments
 (0)