Contents

Scala and sbt

Overview

Scala combines a lot of excellent features (functional-style pattern matching, an expressive type system, closures, etc.) with JVM compatibility and a very interesting developer ecosystem. Fedora has included a package for Scala itself for some time (although the Fedora Scala package is currently broken). However, Fedora doesn't include any of the Scala ecosystem projects. The main obstacle to having Scala ecosystem projects in Fedora is that many projects use sbt, the Simple Build Tool, but there is no native Fedora sbt package. If sbt were available on Fedora, it would greatly facilitate packaging other Scala packages for Fedora. We are taking steps to make Scala and sbt available in Fedora; see here for more background.

Building Scala

The latest stable release of the Scala language is 2.10. It isn't possible to build 2.9 on Fedora 19 or later. Some interesting ecosystem projects don't officially support 2.10, although 2.10 is mostly source-compatible with version 2.9. (Since version 0.9.0, Spark supports Scala 2.10.)

A revised Scala package for F19 and up is available from Fedora testing repositories.

Challenges

We had to overcome several challenges in order to build Scala for Fedora:

The upstream build uses ant and relies on maven-ant-tasks in order to pull down dependencies. For a variety of reasons, maven-ant-tasks is a poor fit for Fedora, but patching ant build.xml files is tedious and brittle. In the future, it would be best to have a more automated approach to ant build patching (a la the functionality available to packagers via maven pom macros). Another possibility is to maintain a separate, leaner build file for Fedora. Gil Cattaneo developed such a script (currently missing documentation generation and some POM files); Will made a first pass at using it for packaging.

Scala depends on a forked version of JLine that is roughly API-compatible with JLine 2.5. In prior Fedora releases, it was possible to simply replace references to the Scala JLine with references to the system JLine. However, the Scala JLine API is incompatible with stock JLine 2.7 and up, so Scala requires a more involved patch in order to work with Fedora 19 and later.

The test suite and scala-partest artifact have missing dependencies in Fedora; getting them to run locally (viz., outside of a build) required some pruning to remove spurious failures (e.g. here, here, and here). (In particular, the binary-compatibility test checked files compiled by an optimizing scalac against files compiled by our scalac; since we need the optimizer turned off, this exposed a problem like this one.)

Limitations

We'd like to have the test suite and scala-partest artifact in a build and run the former as part of %check.

Missing dependencies

These are immediate dependencies for the Scala test suite (there may be other transitive dependencies). We anticipate that getting the Scala test suite running under mock will be a nontrivial effort.

version 0.1.5 (needs Scala to build; used for binary-compatibility testing)

Other Scala projects to package

These are immediate build and test dependencies for other projects that use Scala and sbt. In some cases, we've been able to work around their omission, but having these available would make it possible to package more Scala projects and would bring the packages we have available more in line with the upstream builds.

We need to build sbt 0.13.x — and not sbt 0.12.x — because we use Scala 2.10, and we need to build sbt 0.13.1 in particular because sbt's bootstrap process depends on a particular version of the Scala compiler and 0.13.1 is the first version that works with (and requires) Scala 2.10.3. As a consequence, Scala and sbt in Fedora should necessarily move more slowly than other packages; we'll need to ensure that everything we want to build will work with a new compiler or sbt before upgrading any pieces.