summaryrefslogblamecommitdiff
path: root/build.sbt
blob: cb6b97d391d9c54db6413f769e96e2b5ef7997bf (plain) (tree)
1
2
3
4
5


                                              
                                                      
                                 



















                                                                                  



                        
                                 
           
                           





                                                                    


                                                          














                                                                             

   
 
                                               
import scala.scalajs.sbtplugin.ScalaJSPlugin._
import ScalaJSKeys._

lazy val scalatexApi = project.in(file("scalatexApi"))
                       .settings(
  scalaVersion := "2.11.2",
  libraryDependencies ++= Seq(
    "com.lihaoyi" %% "utest" % "0.2.4",
    "com.scalatags" %% "scalatags" % "0.4.2",
    "org.scala-lang" % "scala-reflect" % scalaVersion.value,
    "com.lihaoyi" %% "acyclic" % "0.1.2" % "provided"
  ),
  addCompilerPlugin("com.lihaoyi" %% "acyclic" % "0.1.2"),
  testFrameworks += new TestFramework("utest.runner.JvmFramework")
)

lazy val scalatexPlugin = Project(
  id   = "scalatexPlugin",
  base = file("scalatexPlugin"),
  dependencies = Seq(scalatexApi)
) settings (
  scalaVersion := "2.11.2",
  libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
  publishArtifact in Compile := false
)

lazy val book = Project(
  id = "book",
  base = file("book"),
  dependencies = Seq(scalatexApi)
).settings(
  scalaVersion := "2.11.2",
  libraryDependencies ++= Seq(
    "org.webjars" % "highlightjs" % "8.2-1",
    "org.scala-lang" % "scala-reflect" % scalaVersion.value,
    "org.scala-lang" % "scala-compiler" % scalaVersion.value,
    "org.eclipse.jgit" % "org.eclipse.jgit" % "3.5.1.201410131835-r"
  ),
  (resources in Compile) += {
    (fastOptJS in (examples, Compile)).value
    (artifactPath in (examples, Compile, fastOptJS)).value
  },
  scalacOptions in Compile ++= {
    val jar = (Keys.`package` in (scalatexPlugin, Compile)).value
    val addPlugin = "-Xplugin:" + jar.getAbsolutePath
    // add plugin timestamp to compiler options to trigger recompile of
    // main after editing the plugin. (Otherwise a 'clean' is needed.)
    val dummy = "-Jdummy=" + jar.lastModified
    val options = "-P:scalatex-options:" + sourceDirectory.value / "scalatex"
    Seq(addPlugin, dummy)
  },
  watchSources ++= {
    ((sourceDirectory in Compile).value / "scalatex" ** "*.scalatex").get
  },
  (watchSources in Test) ++= {
    ((sourceDirectory in Test).value / "scalatex" ** "*.scalatex").get
  }
)

lazy val examples = project.in(file("examples"))