mirror of
https://github.com/zap-proto/scala.git
synced 2026-10-30 15:03:46 +00:00
The build used sbt-0.13-era, Bintray-only plugins (sbt-scalajs 0.6.33, sbt-assembly 0.14.10) that no longer resolve since Bintray shut down. Relocate to current Maven-Central releases, staying within Scala 2.11: - sbt 0.13.18 -> 1.10.7 - sbt-scalajs 0.6.33 -> 1.12.0 (last Scala.js supporting Scala 2.11) - + sbt-scalajs-crossproject 1.3.2 (crossProject moved out of sbt-scalajs) - sbt-assembly 0.14.10 -> 2.3.1 build.sbt: migrate 0.13 syntax to sbt 1.x - crossProject -> crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Full) - scoping: 'X in Y' -> 'Y / X' Tests: scalatest 3.0.9 -> 3.2.19 (3.0.9 has no Scala.js-1 artifact); update the four specs to the 3.2 package layout (AnyFlatSpec, should.Matchers). MultifileSpec: replace UUID.randomUUID() with the deterministic two-long UUID constructor — randomUUID is not linkable under Scala.js (it references java.security.SecureRandom, absent from the Scala.js java library). sbt test is green on all four targets: runtimeJVM, runtimeJS, compilerTestJVM, compilerTestJS (9 tests, both platforms).
79 lines
2.6 KiB
Scala
79 lines
2.6 KiB
Scala
name := "zap"
|
|
|
|
ThisBuild / scalaVersion := "2.11.12"
|
|
|
|
lazy val root = project.in(file(".")).
|
|
aggregate(runtimeJS, runtimeJVM, zapcScala, compilerTestJS, compilerTestJVM).
|
|
settings(
|
|
publish := {},
|
|
publishLocal := {}
|
|
)
|
|
|
|
lazy val runtime = crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Full).in(file("./runtime")).
|
|
settings(
|
|
name := "zap",
|
|
version := "0.1-SNAPSHOT",
|
|
libraryDependencies += "org.scalactic" %%% "scalactic" % "3.2.19",
|
|
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.19" % "test"
|
|
)
|
|
|
|
lazy val runtimeJVM = runtime.jvm
|
|
lazy val runtimeJS = runtime.js
|
|
|
|
lazy val zapcScala = project.in(file("./compiler")).dependsOn(runtimeJVM)
|
|
zapcScala / mainClass := Some("org.katis.zap.compiler.Compiler")
|
|
|
|
lazy val sample = project.in(file("./example"))
|
|
.aggregate(exampleJS, exampleJVM)
|
|
|
|
lazy val compilerTest = crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Full).in(file("./compilerTest"))
|
|
.settings(
|
|
libraryDependencies += "org.scalactic" %%% "scalactic" % "3.2.19",
|
|
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.19" % "test"
|
|
)
|
|
|
|
lazy val compilerTestJS = compilerTest.js.dependsOn(runtimeJS)
|
|
lazy val compilerTestJVM = compilerTest.jvm.dependsOn(runtimeJVM)
|
|
|
|
lazy val example = crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Full).in(file("./example"))
|
|
.settings(
|
|
name := "ZAP example",
|
|
version := "0.1-SNAPSHOT",
|
|
libraryDependencies += "org.scala-lang.modules" %% "scala-async" % "0.9.7"
|
|
).jvmSettings(
|
|
libraryDependencies += "com.typesafe.akka" %% "akka-http-experimental" % "2.4.11"
|
|
)
|
|
.jsSettings(
|
|
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.8",
|
|
libraryDependencies += "io.monix" %%% "monix" % "2.3.3"
|
|
)
|
|
|
|
lazy val exampleJS = example.js.dependsOn(runtimeJS)
|
|
lazy val exampleJVM = example.jvm.dependsOn(runtimeJVM)
|
|
|
|
lazy val testschemas = taskKey[Unit]("Compiles test zap files")
|
|
|
|
testschemas := {
|
|
val v = (zapcScala / assembly).value
|
|
|
|
def listFiles(f: File): Seq[String] = f match {
|
|
case dir if dir.isDirectory =>
|
|
dir.listFiles().flatMap(listFiles)
|
|
case file if file.getAbsolutePath.endsWith(".zap") =>
|
|
Seq(file.getAbsolutePath)
|
|
case _ =>
|
|
Seq.empty
|
|
}
|
|
|
|
val d = new File("compilerTest/shared/src/test/scala-2.11/org/katis/zap/compiler")
|
|
if (d.exists() && d.isDirectory) {
|
|
val files = listFiles(d)
|
|
val args = Seq("java", "-jar", v.getAbsolutePath) ++ files
|
|
val compiler = new java.lang.ProcessBuilder(args:_*)
|
|
compiler.redirectOutput(ProcessBuilder.Redirect.INHERIT)
|
|
compiler.redirectError(ProcessBuilder.Redirect.INHERIT)
|
|
val p = compiler.start()
|
|
p.waitFor()
|
|
}
|
|
}
|