Skip to content

Commit

Permalink
dotty/3.6.2 package update (#36264)
Browse files Browse the repository at this point in the history
- Switched the repository for building Dotty from
https://github.com/lampepfl/dotty to https://github.com/scala/scala3.
because these are just alias
- Refactored the build process to use `sbt dist/Universal/packageBin`
and updated the installation paths.
- Properly Cleaned up unnecessary Windows batch files during the build
process.
- Moved `scala-cli.jar` to the correct directory to resolve issues.
- Add `bash as` runtime dependency as `scala` scripts needs them
- Added multiple tests**:
    - Verify binaries are installed and executable.
    - Compile and run a simple Scala program.
    - Compile and run a Scala program with multiple files.
    - Generate and verify `Scaladoc` documentation.

<p align="center">
<img
src="https://raw.githubusercontent.com/wolfi-dev/.github/b535a42419ce0edb3c144c0edcff55a62b8ec1f8/profile/wolfi-logo-light-mode.svg"
/>
</p>

---------

Signed-off-by: wolfi-bot <121097084+wolfi-bot@users.noreply.github.com>
Signed-off-by: Debasish Biswas <debasishbsws.dev@gmail.com>
Co-authored-by: wolfi-bot <121097084+wolfi-bot@users.noreply.github.com>
Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>
  • Loading branch information
3 people authored Dec 30, 2024
1 parent 0c0bee3 commit b4cb9ee
Showing 1 changed file with 92 additions and 11 deletions.
103 changes: 92 additions & 11 deletions dotty.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package:
name: dotty
version: 3.5.2
version: 3.6.2
epoch: 0
description: The Scala 3 compiler, also known as Dotty.
copyright:
- license: Apache-2.0
dependencies:
runtime:
- bash
provides:
- scala=${{package.full-version}}

Expand All @@ -18,28 +20,107 @@ environment:
- openjdk-11-default-jvm
- openjdk-11-jre
- sbt
- unzip

pipeline:
- uses: git-checkout
with:
repository: https://github.com/lampepfl/dotty
repository: https://github.com/scala/scala3
tag: ${{package.version}}
expected-commit: 52731578d58f51af3501ed348b965e1cfb6fab23
expected-commit: ad3f69867b4600a3550bf9e76a1fc58091cb5eaf

- runs: |
sbt dist/pack
install -dm755 "${{targets.destdir}}"/usr/share/scala/bin
install -dm755 "${{targets.destdir}}"/usr/share/scala/lib
rm -rf build/pack/bin/*.bat
- name: Build Dotty
runs: |
sbt dist/Universal/packageBin
- name: Install Dotty
runs: |
# Create the directories with the correct permissions
mkdir -p ${{targets.destdir}}/usr/bin
install -dm755 "${{targets.destdir}}"/usr/share/scala/
# Extract the zip file
unzip dist/target/universal/scala3-${{package.version}}-bin-SNAPSHOT.zip -d build
# Cleaning and removing windows batch files
rm -rf build/scala3-${{package.version}}-bin-SNAPSHOT/bin/*.bat
rm -rf build/scala3-${{package.version}}-bin-SNAPSHOT/libexec/*.bat
mv build/scala3-${{package.version}}-bin-SNAPSHOT/* ${{targets.destdir}}/usr/share/scala/
mv dist/target/pack/bin/* ${{targets.destdir}}/usr/share/scala/bin/
mv dist/target/pack/lib/* ${{targets.destdir}}/usr/share/scala/lib/
ln -sf /usr/share/scala/bin/scala ${{targets.destdir}}/usr/bin/scala
ln -sf /usr/share/scala/bin/scalac ${{targets.destdir}}/usr/bin/scalac
ln -sf /usr/share/scala/bin/scaladoc ${{targets.destdir}}/usr/bin/scaladoc
# dotty try to find the scala-cli.jar in the bin directory, so we need to move that in scala bin directory
mv ${{targets.destdir}}/usr/share/scala/libexec/scala-cli.jar ${{targets.destdir}}/usr/share/scala/bin/
test:
environment:
contents:
packages:
- openjdk-11-default-jvm
- openjdk-11-jre
pipeline:
- name: Verify that the binaries are installed and executable
runs: |
for bin in scala scalac scaladoc; do
if [ ! -x "/usr/bin/$bin" ]; then
echo "$bin is not installed or not executable"
exit 1
fi
# Run the --version command for each binary
$bin --version
done
- name: "Test Scala compiler"
runs: |
# Create a simple HelloWorld.scala file
echo 'object HelloWorld extends App { println("Hello, World!") }' > HelloWorld.scala
# Compile the HelloWorld.scala file
scalac HelloWorld.scala
# Run the compiled HelloWorld program
scala run -cp . -M HelloWorld
# Clean up
rm -f HelloWorld.scala HelloWorld*.class HelloWorld.tasty
- name: "Test Scala compiler with multiple files"
runs: |
cat > Person.scala << 'EOF'
case class Person(name: String) {
override def toString = s"Person($name)"
}
EOF
cat > Main.scala << 'EOF'
object Main extends App {
val person = Person("Test")
println(person)
}
EOF
scalac Person.scala Main.scala
scala run -cp . -M Main | grep "Person(Test)"
# clean up
rm -f Person.scala Main.scala Person*.class Main*.class Person.tasty Main.tasty
- name: "Test Scaladoc generation"
runs: |
cat > DocTest.scala << 'EOF'
/** Documentation test class */
class DocTest {
/** Test method */
def test(): Unit = ()
}
EOF
scalac DocTest.scala
mkdir -p doc
scaladoc -d doc DocTest.tasty
test -d doc && test -f doc/index.html
# clean up
rm -f DocTest.scala DocTest*.class DocTest.tasty
update:
enabled: true
github:
identifier: lampepfl/dotty
identifier: scala/scala3

0 comments on commit b4cb9ee

Please sign in to comment.