Merge pull request #585 from LoryPelli/scala-3.2.2

Updated to `Scala 3.2.2`
This commit is contained in:
Thomas Hobson 2023-04-11 01:09:52 +12:00 committed by GitHub
commit 9a93c804bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 0 deletions

11
packages/scala/3.2.2/build.sh vendored Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Download and extract JDK8
curl -L "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz" -o jdk.tar.gz
tar xzf jdk.tar.gz --strip-components=1
rm jdk.tar.gz
# Download and extract Scala 3
curl -L "https://github.com/lampepfl/dotty/releases/download/3.2.2/scala3-3.2.2.tar.gz" -o scala.tar.gz
tar -xzf scala.tar.gz --strip-components=1
rm scala.tar.gz

14
packages/scala/3.2.2/compile vendored Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Compile scala classes into a jar file
scalac "$@" -d out.jar
# Create the Manifest and include scala lib jars:
# NOTE: - entry point will only consider @main and App traits from the main file
# - scala lib jars will be added to the class path in order to run the jar properly
echo "Main-Class: $(grep -oP '\@main\s+def\s+\K[a-zA-Z][a-zA-Z0-9]*|object\s+\K[a-zA-Z][a-zA-Z0-9]*(?=\s+extends\s+App)' $1)
Class-Path: $(echo $JAVA_HOME/lib/*.jar | sed 's/\s/\n /g')
" > manifest.txt
# Update the jar with the manifest
jar ufm out.jar manifest.txt

5
packages/scala/3.2.2/environment vendored Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Scala requires JAVA_HOME to be set
export JAVA_HOME=$PWD
export PATH=$PWD/bin:$PATH

5
packages/scala/3.2.2/metadata.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"language": "scala",
"version": "3.2.2",
"aliases": ["sc"]
}

5
packages/scala/3.2.2/run vendored Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Run jar file
shift
java -jar out.jar "$@"

3
packages/scala/3.2.2/test.scala vendored Normal file
View File

@ -0,0 +1,3 @@
@main def run(): Unit = {
println("OK")
}