Skip to content

Commit

Permalink
add support for JDK 21 on various distributions
Browse files Browse the repository at this point in the history
This also updates the deps, scala-cli script, and scalafmt
  • Loading branch information
ckipp01 committed Sep 22, 2023
1 parent 41d9c5a commit a5b1c73
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.7.4
version = 3.7.14
project.git = true

align.preset = more
Expand All @@ -13,7 +13,7 @@ newlines.beforeMultiline = keep
newlines.afterCurlyLambdaParams = keep
newlines.alwaysBeforeElseAfterCurlyIf = true

runner.dialect = scala213
runner.dialect = scala3

rewrite.rules = [
RedundantBraces
Expand Down
10 changes: 8 additions & 2 deletions scala-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

set -eu

SCALA_CLI_VERSION="0.1.19"
SCALA_CLI_VERSION="1.0.4"

GH_ORG="VirtusLab"
GH_NAME="scala-cli"
Expand All @@ -19,7 +19,13 @@ else
fi

if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" == "Linux" ]; then
SCALA_CLI_URL="https://github.com/$GH_ORG/$GH_NAME/releases/download/$TAG/scala-cli-x86_64-pc-linux.gz"
arch=$(uname -m)
if [[ "$arch" == "aarch64" ]] || [[ "$arch" == "x86_64" ]]; then
SCALA_CLI_URL="https://github.com/$GH_ORG/$GH_NAME/releases/download/$TAG/scala-cli-${arch}-pc-linux.gz"
else
echoerr "scala-cli is not supported on $arch"
exit 2
fi
CACHE_BASE="$HOME/.cache/coursier/v1"
elif [ "$(uname)" == "Darwin" ]; then
SCALA_CLI_URL="https://github.com/$GH_ORG/$GH_NAME/releases/download/$TAG/scala-cli-x86_64-apple-darwin.gz"
Expand Down
8 changes: 4 additions & 4 deletions src/Corretto.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sttp.client3.quick._

/*
- Latest Corretto binaries are listed at https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html
- This gives latest versions only!
- Latest Corretto binaries are listed at https://docs.aws.amazon.com/corretto/
- Previous tags for various JDK versions are in GitHub
- See all Corretto JDK versions: https://github.com/orgs/corretto/repositories?q=corretto,
- See all tag names for a given JDK version: e.g. https://github.com/corretto/corretto-17/releases
Expand Down Expand Up @@ -54,8 +53,9 @@ object Corretto {
val correttoJdk17Index0 = index(ghToken, "17")
val correttoJdk18Index0 = index(ghToken, "18") // public archive, 3 tags
val correttoJdk19Index0 = index(ghToken, "19")
val correttoJdk20Index0 = index(ghToken, "20") // pre-release at this time, filtered out
correttoIndex0 + correttoJdk11Index0 + correttoJdk17Index0 + correttoJdk18Index0 + correttoJdk19Index0 + correttoJdk20Index0
val correttoJdk20Index0 = index(ghToken, "20")
val correttoJdk21Index0 = index(ghToken, "21")
correttoIndex0 + correttoJdk11Index0 + correttoJdk17Index0 + correttoJdk18Index0 + correttoJdk19Index0 + correttoJdk20Index0 + correttoJdk21Index0
}

def index(
Expand Down
12 changes: 6 additions & 6 deletions src/GenerateIndex.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//> using scala "2.13"
//> using lib "com.softwaremill.sttp.client3::core:3.8.15"
//> using lib "com.lihaoyi::ujson:3.1.0"
//> using lib "com.lihaoyi::os-lib:0.9.1"
//> using option "-deprecation"
//> using option "-Ywarn-unused"
//> using scala 3
//> using dep com.softwaremill.sttp.client3::core:3.9.0
//> using dep com.lihaoyi::ujson:3.1.3
//> using dep com.lihaoyi::os-lib:0.9.1
//> using options -Wunused:all -deprecation

object GenerateIndex {

Expand All @@ -20,6 +19,7 @@ object GenerateIndex {

val json =
(graalvmLegacyIndex0 + graalvmIndex0 + adoptIndex0 + zuluIndex0 + libericaIndex0 + correttoIndex0).json

val dest = os.Path(output, os.pwd)
os.write.over(dest, json)
System.err.println(s"Wrote $dest")
Expand Down
3 changes: 2 additions & 1 deletion src/Graalvm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ object Graalvm {
def fullIndex(ghToken: String): Index = {
val graalvmJdk17Index0 = index(ghToken, "17")
val graalvmJdk20Index0 = index(ghToken, "20")
graalvmJdk17Index0 + graalvmJdk20Index0
val graalvmJdk21Index0 = index(ghToken, "21")
graalvmJdk17Index0 + graalvmJdk20Index0 + graalvmJdk21Index0
}

def index(
Expand Down
2 changes: 1 addition & 1 deletion src/Temurin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ object Temurin {

def fullIndex(ghToken: String): Index = {
val adoptIndices = (8 to 16).map(ver => ver -> index(ghToken, ver, adopt = true))
val temurinIndices = Seq(8, 11, 16, 17, 18, 19, 20)
val temurinIndices = Seq(8, 11, 16, 17, 18, 19, 20, 21)
.map(ver => ver -> index(ghToken, ver, adopt = false))

val adoptiumIndices = (adoptIndices.toMap ++ temurinIndices)
Expand Down

0 comments on commit a5b1c73

Please sign in to comment.