Actions
Architecture #11781
closedsealerate should be scoped "provided"
Status:
Released
Priority:
N/A
Assignee:
Category:
Architecture - Dependencies
Target version:
Fix check:
Regression:
Description
I just tested with the following source:
object Main { def main(args: Array[String]): Unit = { println(s"Hello! Direction are: ${Direction.values.map(_.name).mkString(",")}") } sealed trait Direction { def name: String } object Direction { final case object East extends Direction { val name = "Est" } final case object South extends Direction { val name = "Sud" } final case object West extends Direction { val name = "Ouest" } final case object North extends Direction { val name = "Nord" } def values = ca.mrvisser.sealerate.values[Direction] } }
And the runtime exec is the same, but with a BIG difference in package size:
% mvn package -q % ls -lah target ... -rw-r--r-- 1 fanf fanf 5.1M Nov 24 14:56 test-0.0.1-SNAPSHOT-jar-with-dependencies.jar % java -jar target/test-0.0.1-SNAPSHOT-jar-with-dependencies.jar Hello! Direction are: Est,Sud,Ouest,Nord % sed -i -e "s/provided/compile/" pom.xml % mvn clean package -q % ls -lah target ... -rw-r--r-- 1 fanf fanf 19M Nov 24 14:57 test-0.0.1-SNAPSHOT-jar-with-dependencies.jar % java -jar target/test-0.0.1-SNAPSHOT-jar-with-dependencies.jar Hello! Direction are: Est,Sud,Ouest,Nord
This is normal, as sealerate is just a compile time macro. But it hold a "compile" dependency toward scala-reflect/compiler, which accounts for ~12Mo.
We won't get the size reduction until all transitive dep toward scala-compiler are removed, but this one is a easy one to break.
Actions