summaryrefslogtreecommitdiff
path: root/examples/crossBuilds/clientserver2
diff options
context:
space:
mode:
Diffstat (limited to 'examples/crossBuilds/clientserver2')
-rw-r--r--examples/crossBuilds/clientserver2/build.sbt28
-rw-r--r--examples/crossBuilds/clientserver2/js/shared/main/scala/simple/Simple.scala7
-rw-r--r--examples/crossBuilds/clientserver2/js/shared/test/scala/simple/SimpleTest.scala13
-rw-r--r--examples/crossBuilds/clientserver2/js/src/main/scala/simple/Platform.scala34
-rw-r--r--examples/crossBuilds/clientserver2/jvm/shared/main/scala/simple/Simple.scala7
-rw-r--r--examples/crossBuilds/clientserver2/jvm/shared/test/scala/simple/SimpleTest.scala13
-rw-r--r--examples/crossBuilds/clientserver2/jvm/src/main/scala/simple/Platform.scala61
-rw-r--r--examples/crossBuilds/clientserver2/project/build.sbt4
8 files changed, 0 insertions, 167 deletions
diff --git a/examples/crossBuilds/clientserver2/build.sbt b/examples/crossBuilds/clientserver2/build.sbt
deleted file mode 100644
index 7e5bddb..0000000
--- a/examples/crossBuilds/clientserver2/build.sbt
+++ /dev/null
@@ -1,28 +0,0 @@
-import utest.jsrunner.JsCrossBuild
-import scala.scalajs.sbtplugin.ScalaJSPlugin._
-import ScalaJSKeys._
-
-val cross = new JsCrossBuild(
- libraryDependencies ++= Seq(
- "com.scalatags" %%% "scalatags" % "0.4.2",
- "com.lihaoyi" %%% "upickle" % "0.2.5"
- )
-)
-
-lazy val js = cross.js.settings(
- libraryDependencies ++= Seq(
- "org.scala-lang.modules.scalajs" %%% "scalajs-dom" % "0.6"
- )
-)
-
-lazy val jvm = cross.jvm.settings(
- libraryDependencies ++= Seq(
- "io.spray" %% "spray-can" % "1.3.2",
- "io.spray" %% "spray-routing" % "1.3.2",
- "com.typesafe.akka" %% "akka-actor" % "2.3.6"
- ),
- (resources in Compile) += {
- (fastOptJS in (js, Compile)).value
- (artifactPath in (js, Compile, fastOptJS)).value
- }
-)
diff --git a/examples/crossBuilds/clientserver2/js/shared/main/scala/simple/Simple.scala b/examples/crossBuilds/clientserver2/js/shared/main/scala/simple/Simple.scala
deleted file mode 100644
index d3b0278..0000000
--- a/examples/crossBuilds/clientserver2/js/shared/main/scala/simple/Simple.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-/*shared/main/scala/simple/Simple.scala*/
-package simple
-object Simple{
- def formatTimes(timestamps: Seq[Long]): String = {
- timestamps.map(Platform.format).mkString("\n")
- }
-} \ No newline at end of file
diff --git a/examples/crossBuilds/clientserver2/js/shared/test/scala/simple/SimpleTest.scala b/examples/crossBuilds/clientserver2/js/shared/test/scala/simple/SimpleTest.scala
deleted file mode 100644
index ec6b29f..0000000
--- a/examples/crossBuilds/clientserver2/js/shared/test/scala/simple/SimpleTest.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-/*js/shared/test/scala/simple/SimpleTest.scala*/
-/*jvm/shared/test/scala/simple/SimpleTest.scala*/
-package simple
-import utest._
-object SimpleTest extends TestSuite{
- val tests = TestSuite{
- 'format{
- 'nil - assert(Simple.formatTimes(Nil) == "")
- 'timeZero - assert(
- Simple.formatTimes(Seq(0)) == "December 31, 1969 4:00:00 PM PST")
- }
- }
-} \ No newline at end of file
diff --git a/examples/crossBuilds/clientserver2/js/src/main/scala/simple/Platform.scala b/examples/crossBuilds/clientserver2/js/src/main/scala/simple/Platform.scala
deleted file mode 100644
index 906329e..0000000
--- a/examples/crossBuilds/clientserver2/js/src/main/scala/simple/Platform.scala
+++ /dev/null
@@ -1,34 +0,0 @@
-//js/src/main/scala/simple/Platform.scala
-package simple
-
-import scala.scalajs.js
-import org.scalajs.dom
-import dom.extensions.Ajax
-import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
-import scala.scalajs.js.annotation.JSExport
-import scalatags.JsDom.all._
-@JSExport
-object Platform extends{
- def format(ts: Long) = {
- new js.Date(ts).toLocaleString()
- }
- @JSExport
- def main(container: dom.HTMLDivElement) = {
- container.appendChild(
- div(
- h1("Hello from Scala.js!"),
- p(Simple.formatTimes(Seq(0, 1 << 30)))
- ).render
- )
- val payload = upickle.write(Seq(0L, 1L << 30))
- Ajax.post("/formatDates", payload).foreach{ xhr =>
- container.appendChild(
- div(
- h1("Hello from Ajax!"),
- p(xhr.responseText)
- ).render
- )
- }
-
- }
-} \ No newline at end of file
diff --git a/examples/crossBuilds/clientserver2/jvm/shared/main/scala/simple/Simple.scala b/examples/crossBuilds/clientserver2/jvm/shared/main/scala/simple/Simple.scala
deleted file mode 100644
index d3b0278..0000000
--- a/examples/crossBuilds/clientserver2/jvm/shared/main/scala/simple/Simple.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-/*shared/main/scala/simple/Simple.scala*/
-package simple
-object Simple{
- def formatTimes(timestamps: Seq[Long]): String = {
- timestamps.map(Platform.format).mkString("\n")
- }
-} \ No newline at end of file
diff --git a/examples/crossBuilds/clientserver2/jvm/shared/test/scala/simple/SimpleTest.scala b/examples/crossBuilds/clientserver2/jvm/shared/test/scala/simple/SimpleTest.scala
deleted file mode 100644
index ec6b29f..0000000
--- a/examples/crossBuilds/clientserver2/jvm/shared/test/scala/simple/SimpleTest.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-/*js/shared/test/scala/simple/SimpleTest.scala*/
-/*jvm/shared/test/scala/simple/SimpleTest.scala*/
-package simple
-import utest._
-object SimpleTest extends TestSuite{
- val tests = TestSuite{
- 'format{
- 'nil - assert(Simple.formatTimes(Nil) == "")
- 'timeZero - assert(
- Simple.formatTimes(Seq(0)) == "December 31, 1969 4:00:00 PM PST")
- }
- }
-} \ No newline at end of file
diff --git a/examples/crossBuilds/clientserver2/jvm/src/main/scala/simple/Platform.scala b/examples/crossBuilds/clientserver2/jvm/src/main/scala/simple/Platform.scala
deleted file mode 100644
index f4ef986..0000000
--- a/examples/crossBuilds/clientserver2/jvm/src/main/scala/simple/Platform.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-//jvm/src/main/scala/simple/Platform.scala
-package simple
-
-import java.text.SimpleDateFormat
-import akka.actor.ActorSystem
-import spray.http.{HttpEntity, MediaTypes}
-import spray.routing.SimpleRoutingApp
-import scalatags.Text.all._
-
-object Static{
- val msg = Simple.formatTimes(Seq(0, 1 << 30))
- val boot =
- "Platform().main(document.getElementById('contents'))"
- val page = html(
- head(
- script(src:="/js-fastopt.js")
- ),
- body(
- onload:=boot,
- div(id:="contents")(
- h1("Hello from Scala-JVM!"),
- p(msg)
- )
- )
- )
-}
-object Platform extends SimpleRoutingApp{
- def format(ts: Long) = {
- val fmt =
- "MMMM d, yyyy h:mm:ss aaa z"
- new SimpleDateFormat(fmt).format(
- new java.util.Date(ts)
- )
- }
-
- def main(args: Array[String]): Unit = {
- implicit val system = ActorSystem()
- startServer("localhost", port = 8080){
- get{
- pathSingleSlash{
- complete{
- HttpEntity(
- MediaTypes.`text/html`,
- Static.page.render
- )
- }
- } ~
- getFromResourceDirectory("")
- } ~
- post{
- path("formatDates"){
- extract(_.request.entity.asString) { e =>
- complete {
- Simple.formatTimes(upickle.read[Seq[Long]](e))
- }
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/examples/crossBuilds/clientserver2/project/build.sbt b/examples/crossBuilds/clientserver2/project/build.sbt
deleted file mode 100644
index 5bd83ce..0000000
--- a/examples/crossBuilds/clientserver2/project/build.sbt
+++ /dev/null
@@ -1,4 +0,0 @@
-/*project/build.sbt*/
-addSbtPlugin("org.scala-lang.modules.scalajs" % "scalajs-sbt-plugin" % "0.5.5")
-
-addSbtPlugin("com.lihaoyi" % "utest-js-plugin" % "0.2.4") \ No newline at end of file