These are chat archives for ThoughtWorksInc/Binding.scala

9th
May 2016
Justin Maat
@jxm262
May 09 2016 16:30
I’m totally stuck on this build file I’m making. I’m trying to integrate my client side app using Binding.scala into a shared Play app (2 main directories - client and server), but can’t seem to get the client to compile
any ideas on an example sbt build file?
so far I have -
import sbt.Project.projectToRef

addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)

lazy val jsProjects = Seq(client)

lazy val jvm = project.settings(
  scalaJSProjects := jsProjects,
  pipelineStages := Seq(scalaJSProd)).
  enablePlugins(PlayScala).
  aggregate(jsProjects.map(projectToRef): _*)

lazy val commonSettings = Seq(
  organization := "com.example",
  version := "0.1.0",
  scalaVersion := "2.11.7"
)

lazy val client = (project in file("client")).
  enablePlugins(ScalaJSPlugin).
  settings(commonSettings: _*).
  settings(
    jsDependencies += RuntimeDOM,
    persistLauncher in Compile := true,
    persistLauncher in Test := false,
    libraryDependencies ++= Seq(
      "com.thoughtworks.binding" %%% "dom" % "4.0.2",
      "com.lihaoyi" %%% "upickle" % "0.3.9",
      "org.singlespaced" %%% "scalajs-d3" % "0.3.3",
      "org.scala-js" %%% "scalajs-dom" % "0.9.0",
      "org.singlespaced" %%% "scalajs-d3" % "0.3.3",
      "com.lihaoyi" %%% "utest" % "0.4.3" % "test"
    )
  )
but running sbt compile gives this -
Main.scala:27: type MetaData is not a member of package xml
[error]     <div className="report">
[error]      ^
it’s like the build isn’t picking up the Binding.scala or something ??
杨博 (Yang Bo)
@Atry
May 09 2016 16:34
I guess you need addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
Justin Maat
@jxm262
May 09 2016 16:35
I think I already have it at the top?
the first line in that build file i posted.
or did i place that in the wrong spot?
杨博 (Yang Bo)
@Atry
May 09 2016 16:36
You need the compiler plugin whenever you have libraryDependencies += "com.thoughtworks.binding" %%% "dom" % "latest.release"
Justin Maat
@jxm262
May 09 2016 16:37
right, but maybe i’m misunderstanding..
I have this
import sbt.Project.projectToRef

addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)

lazy val jsProjects = Seq(client)
...
杨博 (Yang Bo)
@Atry
May 09 2016 16:37
They are different projects
You added the compiler plugin for the current project, maybe a Play project on JVM
While, the Scala.js project, which need the plugin, did not depend on the plugin.
Justin Maat
@jxm262
May 09 2016 16:43
ahh, i think i see ?
i moved it down into the settings section of the client build, so it looks like this
  settings(
    addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
    jsDependencies += RuntimeDOM,
    persistLauncher in Compile := true,
    persistLauncher in Test := false,
    libraryDependencies ++= Seq(
      "com.thoughtworks.binding" %%% "dom" % "4.0.2",
      "com.lihaoyi" %%% "upickle" % "0.3.9",
      "org.singlespaced" %%% "scalajs-d3" % "0.3.3",
      "org.scala-js" %%% "scalajs-dom" % "0.9.0",
      "org.singlespaced" %%% "scalajs-d3" % "0.3.3",
      "com.lihaoyi" %%% "utest" % "0.4.3" % "test"
    )
  )
i didn’t realize it could be loaded dynamically (sorry new to sbt in general)
杨博 (Yang Bo)
@Atry
May 09 2016 16:45
It does not. Try reload command in your sbt shell.
Justin Maat
@jxm262
May 09 2016 16:45
just tried..
it seems to work when i move it down there for some reason
as opposed to placing it at the top of the build file
杨博 (Yang Bo)
@Atry
May 09 2016 16:46
:clap:
Justin Maat
@jxm262
May 09 2016 16:46
thank you friend :)
杨博 (Yang Bo)
@Atry
May 09 2016 16:46
Enjoy it!