Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions scala/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# sbt build output
target/

# Metals / builds
.bloop
.bsp
metals.sbt

# Temp install of sbt
sbt/
*.zip
2 changes: 2 additions & 0 deletions scala/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
java corretto-21
sbt 1
28 changes: 19 additions & 9 deletions scala/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

Skeleton project for Scala.

## Prerequisites

The toolchain this project needs is declared in [`.tool-versions`](./.tool-versions):

```
java corretto-21
sbt 1
```

Install those however you prefer, as long as they end up on your `PATH`. The quickest route is
[mise](https://mise.jdx.dev/), which reads the file for you:

```sh
mise install
```

## Usage
- `./script/setup` to install dependencies
- `./script/test` to run the tests

## Usage (on Windows)
- Make sure JDK version 8 or above is installed and JAVA_HOME environment variable is set
- Use Powershell to execute the below commands
- `PowerShell.exe -ExecutionPolicy UnRestricted -File .\script\setup.ps1` to download and extract portable sbt
- (If this script fails you can do this manually by visiting https://github.com/sbt/sbt/releases ,downloading the latest sbt zip and extracting it to ./coding-exercise-project/scala/sbt)
- `.\sbt\sbt\bin\sbt test` to run tests
- `./script/setup` to fetch dependencies
- `./script/test` to run the tests, or `./script/test --watch` to re-run them on every change
- `./script/start` to run the app

## Structure
- Code located in [`Main.scala`](./src/main/scala/gu/com/Main.scala)
Expand Down
6 changes: 4 additions & 2 deletions scala/script/setup
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

brew install --cask "guardian/devtools/gu-scala"
cd "$(dirname "${BASH_SOURCE[0]}")/.."

sbt update
15 changes: 0 additions & 15 deletions scala/script/setup.ps1

This file was deleted.

7 changes: 7 additions & 0 deletions scala/script/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

sbt run
Loading