Skip to content

Commit 362f57c

Browse files
committed
Compile scala using course-sdk
1 parent 9241bf4 commit 362f57c

File tree

10 files changed

+31
-21
lines changed

10 files changed

+31
-21
lines changed

compiled_starters/scala/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Database files used for testing
2+
*.db
3+
14
**/target
25
/.bloop/
36
/.bsp/

compiled_starters/scala/README.md

+4-4
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/scala/Main.scala`.
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+
`src/main/scala/Main.scala`. 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,7 +30,7 @@ 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 `mvn` installed locally
33+
1. Ensure you have `sbt (1.10.7)` installed locally
3434
1. Run `./your_program.sh` to run your program, which is implemented in
3535
`src/main/scala/Main.scala`.
3636
1. Commit your changes and run `git push origin master` to submit your solution

compiled_starters/scala/codecrafters.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# unless you really need them.
55
debug: false
66

7-
# Use this to change the Java version used to run your code
7+
# Use this to change the Scala version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: java-23
11-
language_pack: java-17
10+
# Available versions: scala-3.3.5
11+
language_pack: scala-3.3.5

compiled_starters/scala/src/main/scala/Main.scala

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ object Main extends App {
1919
databaseFile.read(pageSizeBytes)
2020
val pageSizeSigned = ByteBuffer.wrap(pageSizeBytes).getShort()
2121
val pageSize = pageSizeSigned & 0xFFFF
22-
println("database page size: " + pageSize)
22+
23+
// You can use print statements as follows for debugging, they'll be visible when running tests.
24+
System.err.println("Logs from your program will appear here!")
25+
26+
// Uncomment this block to pass the first stage
27+
// println("database page size: " + pageSize)
2328
}
2429
case _ => println("Missing or invalid command passed: " + command)
2530
}

solutions/scala/01-dr6/code/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Database files used for testing
2+
*.db
3+
14
**/target
25
/.bloop/
36
/.bsp/

solutions/scala/01-dr6/code/README.md

+4-4
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/scala/Main.scala`.
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+
`src/main/scala/Main.scala`. 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,7 +30,7 @@ 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 `mvn` installed locally
33+
1. Ensure you have `sbt (1.10.7)` installed locally
3434
1. Run `./your_program.sh` to run your program, which is implemented in
3535
`src/main/scala/Main.scala`.
3636
1. Commit your changes and run `git push origin master` to submit your solution

solutions/scala/01-dr6/code/codecrafters.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# unless you really need them.
55
debug: false
66

7-
# Use this to change the Java version used to run your code
7+
# Use this to change the Scala version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: java-23
11-
language_pack: java-17
10+
# Available versions: scala-3.3.5
11+
language_pack: scala-3.3.5

solutions/scala/01-dr6/code/src/main/scala/Main.scala

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ object Main extends App {
1919
databaseFile.read(pageSizeBytes)
2020
val pageSizeSigned = ByteBuffer.wrap(pageSizeBytes).getShort()
2121
val pageSize = pageSizeSigned & 0xFFFF
22+
2223
println("database page size: " + pageSize)
2324
}
2425
case _ => println("Missing or invalid command passed: " + command)

solutions/scala/01-dr6/diff/src/main/scala/Main.scala.diff

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
--- starter_templates/scala/code/src/main/scala/Main.scala 2025-03-27 19:30:51.374671531 -0400
2-
+++ solutions/scala/01-dr6/code/src/main/scala/Main.scala 2025-03-27 19:22:20.930550947 -0400
3-
@@ -1,31 +1,26 @@
1+
@@ -1,31 +1,27 @@
42
import java.io.File
53
import java.io.FileInputStream
64
import java.io.IOException
75
import java.nio.ByteBuffer
8-
6+
97
object Main extends App {
108
if args.length < 2
119
then {
@@ -22,7 +20,7 @@
2220
databaseFile.read(pageSizeBytes)
2321
val pageSizeSigned = ByteBuffer.wrap(pageSizeBytes).getShort()
2422
val pageSize = pageSizeSigned & 0xFFFF
25-
-
23+
2624
- // You can use print statements as follows for debugging, they'll be visible when running tests.
2725
- System.err.println("Logs from your program will appear here!")
2826
-

solutions/scala/01-dr6/explanation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Study and uncomment the relevant code:
44

55
```scala
66
// Uncomment this block to pass the first stage
7-
println("database page size: " + pageSize);
7+
println("database page size: " + pageSize)
88
```
99

1010
Push your changes to pass the first stage:

0 commit comments

Comments
 (0)