Project

General

Profile

Architecture #11781

sealerate should be scoped "provided"

Added by François ARMAND 11 months ago. Updated 10 months ago.

Status:
Released
Priority:
N/A
Category:
Architecture - Dependencies
Target version:
Target version (plugin):
Effort required:

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.

Associated revisions

Revision d89203df (diff)
Added by François ARMAND 11 months ago

Fixes #11781: sealerate should be scoped \"provided\"

History

#1 Updated by François ARMAND 11 months ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from François ARMAND to Vincent MEMBRÉ
  • Pull Request set to https://github.com/Normation/rudder-parent-pom/pull/49

#2 Updated by François ARMAND 11 months ago

  • Status changed from Pending technical review to Pending release

#3 Updated by Vincent MEMBRÉ 10 months ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 4.1.9 and 4.2.3 which were released today.

Also available in: Atom PDF