build-your-own-sqlite icon indicating copy to clipboard operation
build-your-own-sqlite copied to clipboard

Add scala support

Open cheerio-pixel opened this issue 8 months ago • 4 comments

Summary by CodeRabbit

  • New Features

    • Introduced a Scala-based command-line application for basic SQLite database inspection.
    • Added automation to compile, run locally, and deploy via containerized environments.
    • Enabled downloading of sample databases for testing.
  • Documentation

    • Added comprehensive README files with challenge instructions, usage guidelines, and configuration details.
    • Included new configuration files to support project setup and user customization.
  • Chores

    • Enhanced project setup with refined build configurations and dependency management to streamline development workflows.
    • Implemented .gitignore and .gitattributes files to manage version control effectively.

cheerio-pixel avatar Mar 27 '25 23:03 cheerio-pixel

Walkthrough

This update establishes a standardized project structure for a SQLite challenge in Scala across multiple directories. New shell scripts are added for compiling, running, and downloading databases, while SBT build configurations, Dockerfile, Git settings, and YAML configuration files are introduced. The main Scala application now processes command-line arguments to extract database information. README and explanation documents provide guidance for users. These changes are implemented consistently in the compiled starters, solutions, and starter templates for the CodeCrafters platform.

Changes

File(s) Affected Change Summary
compiled_starters/scala/.codecrafters/{compile.sh, run.sh},
solutions/scala/01-dr6/code/.codecrafters/{compile.sh, run.sh},
starter_templates/scala/code/.codecrafters/{compile.sh, run.sh}
Added shell scripts to compile Scala projects (using sbt assembly) and execute the resulting JAR file on the CodeCrafters platform.
compiled_starters/scala/{your_program.sh, download_sample_databases.sh},
solutions/scala/01-dr6/code/{your_program.sh, download_sample_databases.sh}
Introduced local execution and database download scripts for running the program and fetching sample SQLite databases.
dockerfiles/scala-3.3.5.Dockerfile Added a Dockerfile for Scala 3.3.5 based on a Maven image with Eclipse Temurin 23 for dependency management and build caching.
compiled_starters/scala/README.md,
solutions/scala/01-dr6/code/README.md
Created README files outlining the SQLite challenge objective, relevant usage instructions, and configuration details.
compiled_starters/scala/build.sbt,
solutions/scala/01-dr6/code/build.sbt,
starter_templates/scala/code/build.sbt
Added SBT build files specifying Scala version, project organization, assembly settings, and basic project metadata.
compiled_starters/scala/project/{build.properties, plugins.sbt},
solutions/scala/01-dr6/code/project/{build.properties, plugins.sbt},
starter_templates/scala/code/project/{build.properties, plugins.sbt}
Introduced SBT project configuration files setting the SBT version (1.10.7) and adding the sbt-assembly plugin for building fat JARs.
compiled_starters/scala/{.gitattributes, .gitignore},
solutions/scala/01-dr6/code/{.gitattributes, .gitignore},
starter_templates/scala/code/.gitignore
Added Git configuration files to normalize text files and ignore build and IDE-specific directories/files.
compiled_starters/scala/codecrafters.yml,
solutions/scala/01-dr6/code/codecrafters.yml,
starter_templates/scala/config.yml
Introduced YAML configuration files for setting the Scala language pack and debug options in the CodeCrafters environment.
compiled_starters/scala/src/main/scala/Main.scala,
solutions/scala/01-dr6/code/src/main/scala/Main.scala,
starter_templates/scala/code/src/main/scala/Main.scala,
solutions/scala/01-dr6/diff/src/main/scala/Main.scala.diff
Added a new Scala main application that processes command-line arguments (e.g., the .dbinfo command) to read and print database page size.
solutions/scala/01-dr6/explanation.md Created an explanation document providing usage guidance and commit instructions for the SQLite challenge.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant CS as compile.sh (CodeCrafters)
    participant SBT as sbt assembly
    participant RS as run.sh / your_program.sh
    participant App as Main (Scala App)

    User->>CS: Executes compile.sh
    CS->>SBT: Run "sbt assembly" command
    SBT-->>CS: Compiled JAR returned
    User->>RS: Executes run.sh/your_program.sh with args
    RS->>App: Launches the JAR (java -jar sqlite.jar)
    App-->>User: Outputs database info or error messages

Poem

I'm a rabbit in a code garden, hopping with delight,
New scripts compile and run in the crisp morning light.
Scala jars and Docker dreams set my pace,
Readmes guide us gently through every case.
With each line and commit, I skip with cheer,
CodeRabbit's burrow is now ever so clear!
Happy hops to our refined code frontier!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Mar 27 '25 23:03 coderabbitai[bot]

This pull request introduces a new Scala starter template for the "Build Your Own SQLite" challenge, including all necessary configuration, build, and helper files to streamline development and testing both locally and in the CodeCrafters environment. The changes provide a ready-to-use project structure with scripts for compilation, running, and downloading sample databases, as well as documentation and environment configuration.

Project scaffolding and configuration:

  • Added a complete Scala project structure with build.sbt, project/build.properties, and project/plugins.sbt for SBT-based builds, including the sbt-assembly plugin for packaging the application as a JAR. [1] [2] [3]
  • Included .gitignore and .gitattributes files to manage repository cleanliness and handle text file normalization. [1] [2]
  • Added codecrafters.yml to configure debug settings and specify the Scala language pack for the CodeCrafters platform.

Build and execution scripts:

  • Provided .codecrafters/compile.sh and .codecrafters/run.sh scripts for compiling and running the project in the CodeCrafters environment, along with a your_program.sh script for local development that mirrors the remote execution flow. [1] [2] [3]

Documentation and developer guidance:

  • Added a comprehensive README.md explaining the challenge, project structure, local development steps, and how to use sample databases for testing.
  • Included download_sample_databases.sh to easily fetch large sample databases required for advanced testing stages.

Starter implementation:

  • Introduced a basic Main.scala file with initial logic for handling command-line arguments and reading database page size, serving as the entry point for the SQLite implementation.

Docker support:

  • Added a scala-3.3.5.Dockerfile for building and running the Scala project in a containerized environment, ensuring consistency across development and CI.

JohnDaWalka avatar Sep 02 '25 02:09 JohnDaWalka

This pull request introduces a new Scala starter template for the "Build Your Own SQLite" challenge, providing all the necessary configuration, build scripts, documentation, and a sample implementation scaffold. The changes set up the project structure, automate compilation and execution, configure the Scala build environment, and provide helpful documentation and scripts for working with sample databases.

Key changes include:

Project Structure & Configuration

  • Added .gitignore and .gitattributes files to handle repository-specific settings and ignore build artifacts and IDE files. [1] [2]
  • Added build.sbt and project/build.properties to define the Scala project, set the Scala version to 3.3.5, and configure the sbt-assembly plugin for building fat jars. [1] [2] [3]
  • Added codecrafters.yml to specify the language pack and debug settings for the CodeCrafters platform.

Build & Run Automation

  • Added .codecrafters/compile.sh and .codecrafters/run.sh scripts to automate compilation and execution on the CodeCrafters platform, and a your_program.sh script for running the program locally. [1] [2] [3]

Documentation & Sample Data

  • Added a detailed README.md with instructions for getting started, progressing through the challenge, and using sample databases.
  • Added a download_sample_databases.sh script to fetch large sample databases for local testing.

Sample Implementation

  • Added a starter Main.scala file with code to read the SQLite database page size and handle the .dbinfo command, serving as a scaffold for the challenge solution.

Docker Support

  • Added a scala-3.3.5.Dockerfile to provide a reproducible build environment with sbt and all necessary dependencies.

JohnDaWalka avatar Sep 02 '25 02:09 JohnDaWalka

all set!

JohnDaWalka avatar Sep 02 '25 02:09 JohnDaWalka