lihaoyi / hands-on-scala-js

Better documentation for Scala.js
142 stars 52 forks source link

crossBuilds/clientServer2 built with latest dependencies - Possible problem with uPickle #56

Open rdc247 opened 6 years ago

rdc247 commented 6 years ago

This is an issue with crossBuilds/clientServer2. At first sight this appears to be a problem with uPickle.

I've been updating the project dependencies of everything I could find to the latest versions :-


/ build.sbt / val app = crossProject.settings( unmanagedSourceDirectories in Compile += baseDirectory.value / "shared" / "main" / "scala", libraryDependencies ++= Seq( "com.lihaoyi" %%% "scalatags" % "0.6.7", "com.lihaoyi" %%% "upickle" % "0.5.1", "com.lihaoyi" %%% "autowire" % "0.2.6" ), scalaVersion := "2.12.4" ).jsSettings( libraryDependencies ++= Seq( "org.scala-js" %%% "scalajs-dom" % "0.9.4" ) ).jvmSettings( libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-http" % "10.0.11", "org.webjars" % "bootstrap" % "3.3.5" ) )

lazy val appJS = app.js lazy val appJVM = app.jvm.settings( (resources in Compile) += (fastOptJS in (appJS, Compile)).value.data )


// project/build.properties sbt.version=1.0.4


/project/build.sbt/ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.21")

addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")


The project source code is unchanged - and is taken directly from your hands-on-scala-js project.

I get the following compilation errors when running appJVM/reStart :-

[error] /home/torquay/Documents/tmp/hands-on-scala-js-master/examples/crossBuilds/clientserver2/app/js/src/main/scala/simple/Client.scala:27:57: uPickle does not know how to read [Seq[simple.FileData]]s; define an implicit Reader[Seq[simple.FileData]] to teach it how [error] def update() = Ajaxer[Api].list(inputBox.value).call().foreach{ data => [error] ^ [error] one error found [error] /home/torquay/Documents/tmp/hands-on-scala-js-master/examples/crossBuilds/clientserver2/app/jvm/src/main/scala/simple/Server.scala:40:34: uPickle does not know how to write [Seq[simple.FileData]]s; define an implicit Writer[Seq[simple.FileData]] to teach it how [error] Router.routeApi( [error] ^ [error] one error found

If I change the version of uPickle to 0.4.4, then the application compiles and runs as expected. The problem first manifests itself in version 0.5.0 of uPickle.

Thank you very much for your many good contributions to the Scala Community. I've enjoyed watching your presentations, and find your documentation and software both concise and clear.