search term:

reducing scaladoc file size with sbt-salad-days

A few days ago, Maven Central Repository has introduced Maven Central Publishing Limits. As of this writing, the monthly soft limit for the file size is 80 MB.

This event has triggered many of the Scala library maintainers to realize that on Scala 3, Scaladoc file is often the largest file per module. Looking at the unzip -l shows that the Scaladoc JAR includes fonts and scripts/inkuire.js, totalling over 2.5 MB:

   203030  01-01-2010 00:00   webfonts/fa-solid-900.eot
   309828  01-01-2010 00:00   fonts/Inter-Regular.ttf
   314712  01-01-2010 00:00   fonts/Inter-Medium.ttf
   315756  01-01-2010 00:00   fonts/Inter-SemiBold.ttf
   316100  01-01-2010 00:00   fonts/Inter-Bold.ttf
   370523  01-01-2010 00:00   scripts/scaladoc-scalajs.js
   747545  01-01-2010 00:00   webfonts/fa-brands-400.svg
   918991  01-01-2010 00:00   webfonts/fa-solid-900.svg
   939517  01-01-2010 00:00   scripts/inkuire.js

As a quick workaround, I’ve created an sbt plugin that removes all fonts and scripts/inkuire.js for both sbt 1.x and 2.x:

addSbtPlugin("com.eed3si9n" % "sbt-salad-days" % "0.1.0")

This reduces the near-empty Scaladoc to 420 KB.

$ ls -lh /private/tmp/aaa/target/scala-3.3.8/aaa_3-0.1.0-SNAPSHOT-javadoc.jar
420K /private/tmp/aaa/target/scala-3.3.8/aaa_3-0.1.0-SNAPSHOT-javadoc.jar

The Scaladoc for https://repo1.maven.org/maven2/com/eed3si9n/sbt-salad-days_sbt2_3/0.1.0/ is also 420 KB.

Reference