com-lihaoyi / upickle

uPickle: a simple, fast, dependency-free JSON & Binary (MessagePack) serialization library for Scala
https://com-lihaoyi.github.io/upickle
MIT License
719 stars 165 forks source link

Upickle 4.0.0 breaks binary compatibility with mill/ammonite repl. #616

Open megri opened 3 months ago

megri commented 3 months ago

With a build roughly defined as

import mill._
import scalalib._

object core extends ScalaModule {
  def scalaVersion = "3.4.2"
  def ivyDeps = Agg(ivy"com.lihaoyi::upickle:4.0.0")
}

With this setup mill -i core.repl becomes unstable.

[46/53] core.resolvedAmmoniteReplIvyDeps 
Resolving Ammonite Repl 3.0.0-M2-15-9bed9700 for Scala 3.4.2 ...
If you encounter dependency resolution failures, please review/override `def ammoniteVersion` to select a compatible release.
[53/53] core.repl 
Loading...
Welcome to the Ammonite Repl 3.0.0-M2-15-9bed9700 (Scala 3.4.2 Java 17.0.11)
@ repl.load 
Exception in thread "main" java.lang.NoSuchMethodError: 'geny.Writable upickle.default$.stream(java.lang.Object, int, boolean, upickle.core.Types$Writer)'
        at ammonite.runtime.Storage$Folder$$anon$23.update(Storage.scala:225)
        at ammonite.runtime.Storage$Folder$$anon$23.update(Storage.scala:222)
        at ammonite.repl.Repl.action$$anonfun$2$$anonfun$2$$anonfun$2(Repl.scala:203)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at ammonite.repl.AmmoniteFrontEnd.action(AmmoniteFrontEnd.scala:33)
        at ammonite.repl.Repl.action$$anonfun$2$$anonfun$2(Repl.scala:205)
        at ammonite.repl.Scoped.flatMap$$anonfun$1(Signaller.scala:45)
        at ammonite.repl.Signaller.apply(Signaller.scala:28)
        at ammonite.repl.Scoped.flatMap(Signaller.scala:45)
        at ammonite.repl.Scoped.flatMap$(Signaller.scala:42)
        at ammonite.repl.Signaller.flatMap(Signaller.scala:16)
        at ammonite.repl.Repl.action$$anonfun$2(Repl.scala:211)
        at ammonite.util.Res$Success.flatMap(Res.scala:58)
        at ammonite.repl.Repl.action(Repl.scala:211)
        at ammonite.repl.Repl.loop$1(Repl.scala:218)
        at ammonite.repl.Repl.run(Repl.scala:233)
        at ammonite.Main.run(Main.scala:249)
        at ammonite.MainRunner.runRepl$$anonfun$1(MainRunner.scala:76)
        at ammonite.MainRunner.watchLoop(MainRunner.scala:57)
        at ammonite.MainRunner.runRepl(MainRunner.scala:76)
        at ammonite.AmmoniteMain$.main0(AmmoniteMain.scala:98)
        at ammonite.AmmoniteMain$.main(AmmoniteMain.scala:31)
        at ammonite.AmmoniteMain.main(AmmoniteMain.scala)
1 targets failed
core.repl java.lang.Exception: Interactive Subprocess Failed (exit code 1)
    mill.util.Jvm$.runSubprocess(Jvm.scala:188)
    mill.util.Jvm$.runSubprocessWithBackgroundOutputs(Jvm.scala:152)
    mill.util.Jvm$.runSubprocess(Jvm.scala:88)
    mill.scalalib.ScalaModule.$anonfun$repl$2(ScalaModule.scala:507)
    scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    mill.api.SystemStreams$.$anonfun$withStreams$5(SystemStreams.scala:78)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    mill.api.SystemStreams$.$anonfun$withStreams$4(SystemStreams.scala:77)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    mill.api.SystemStreams$.$anonfun$withStreams$3(SystemStreams.scala:76)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    scala.Console$.withErr(Console.scala:193)
    mill.api.SystemStreams$.$anonfun$withStreams$2(SystemStreams.scala:75)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    scala.Console$.withOut(Console.scala:164)
    mill.api.SystemStreams$.$anonfun$withStreams$1(SystemStreams.scala:74)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:59)
    scala.Console$.withIn(Console.scala:227)
    mill.api.SystemStreams$.withStreams(SystemStreams.scala:73)
    mill.scalalib.ScalaModule.$anonfun$repl$1(ScalaModule.scala:514)
    mill.define.Task$TraverseCtx.evaluate(Task.scala:71)

edit: seems like Ammonite had its geny version updated recently but that no artifact has been published for it: https://github.com/com-lihaoyi/Ammonite/commit/951bbc1e57326bff0a967d24826b605eaff71a63

lihaoyi commented 3 months ago

upickle 4.0.0 is binary incompatible. It will need a corresponding new release of Ammonite to work

megri commented 3 months ago

How do we make that happen? :)

lihaoyi commented 3 months ago

@megri we'd need to get Ammonite onto Mill 0.11.11 first, because Sonatype publishing is broken for older versions of Mill (they changed their URL parsing behavior). If you have some time to get Ammonite onto Mill 0.11.11, then cutting a release for uPickle 4.0.0 should be straightforward