From 5c7faea2052344c1186a14b15269017d4b676aab Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Sun, 29 Apr 2018 18:00:04 -0700 Subject: Build for ScalaJS and Scala Native --- build.sbt | 36 +++++++++++++++++++++++++++++++----- project/plugins.sbt | 5 +++++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 423d09a..fe7afad 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,32 @@ -scalaVersion := "2.12.5" +// shadow sbt-scalajs' crossProject and CrossType until Scala.js 1.0.0 is released +import sbtcrossproject.{crossProject, CrossType} -libraryDependencies ++= Seq( - "com.lihaoyi" %% "utest" % "0.6.3" % "test" -) -testFrameworks += new TestFramework("utest.runner.Framework") +lazy val commando = crossProject(JSPlatform, JVMPlatform, NativePlatform) + .withoutSuffixFor(JVMPlatform) + .crossType(CrossType.Pure) + .in(file(".")) + .settings( + scalacOptions ++= Seq( + "-deprecation", + "-feature" + ), + libraryDependencies ++= Seq( + "com.lihaoyi" %%% "utest" % "0.6.3" % "test" + ), + testFrameworks += new TestFramework("utest.runner.Framework"), + scalaVersion := crossScalaVersions.value.head + ) + .jsSettings( + crossScalaVersions := "2.11.12" :: Nil + ) + .jvmSettings( + crossScalaVersions := "2.12.5" :: "2.11.12" :: Nil + ) + .nativeSettings( + crossScalaVersions := "2.11.12" :: Nil, + nativeLinkStubs := true + ) + +lazy val commandoJS = commando.js +lazy val commandoJVM = commando.jvm +lazy val commandoNative = commando.native diff --git a/project/plugins.sbt b/project/plugins.sbt index f86e373..8725466 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1,6 @@ addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1") + +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.4.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.4.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.7") -- cgit v1.2.3