diff --git a/build.sbt b/build.sbt index 7a03e65457..91f324cd32 100644 --- a/build.sbt +++ b/build.sbt @@ -2,14 +2,15 @@ import ReleaseTransformations._ import com.typesafe.sbt.SbtScalariform.ScalariformKeys import scalariform.formatter.preferences._ import sbtrelease.ReleasePlugin + import scala.sys.process.Process -import sbtcrossproject.crossProject import java.io.{File => JFile} +import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject} enablePlugins(TutPlugin) lazy val baseModules = Seq[sbt.ClasspathDep[sbt.ProjectReference]]( - `quill-core-jvm`, `quill-core-js`, `quill-sql-jvm`, `quill-sql-js`, `quill-monix` + `quill-core-jvm`, `quill-core-js`, `quill-core-native`, `quill-sql-jvm`, `quill-sql-js`, `quill-sql-native`, `quill-monix` ) lazy val dbModules = Seq[sbt.ClasspathDep[sbt.ProjectReference]]( @@ -34,7 +35,7 @@ lazy val allModules = lazy val filteredModules = { val modulesStr = sys.props.get("modules") - println(s"Modules Argument Value: ${modulesStr}") + println(s"Modules Argument Value: $modulesStr") modulesStr match { case Some("base") => @@ -61,15 +62,17 @@ lazy val filteredModules = { lazy val `quill` = (project in file(".")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings: _*) .settings(`tut-settings`:_*) .aggregate(filteredModules.map(_.project): _*) .dependsOn(filteredModules: _*) -lazy val superPure = new sbtcrossproject.CrossType { +lazy val superPure = new CrossType { def projectDir(crossBase: File, projectType: String): File = projectType match { - case "jvm" => crossBase - case "js" => crossBase / s".$projectType" + case "jvm" => crossBase + case "js" => crossBase / s".$projectType" + case "native" => crossBase / s".$projectType" } def sharedSrcDir(projectBase: File, conf: String): Option[File] = @@ -77,14 +80,17 @@ lazy val superPure = new sbtcrossproject.CrossType { override def projectDir(crossBase: File, projectType: sbtcrossproject.Platform): File = projectType match { - case JVMPlatform => crossBase - case JSPlatform => crossBase / ".js" + case JVMPlatform => crossBase + case JSPlatform => crossBase / ".js" + case NativePlatform => crossBase / ".native" } } lazy val `quill-core` = - crossProject(JVMPlatform, JSPlatform).crossType(superPure) + crossProject(JVMPlatform, JSPlatform, NativePlatform).crossType(superPure) .settings(commonSettings: _*) + .platformsSettings(JVMPlatform, JSPlatform)(commonJvmJsSettings) + .nativeSettings(commonNativeSettings) .settings(mimaSettings: _*) .settings(libraryDependencies ++= Seq( "com.typesafe" % "config" % "1.3.4", @@ -98,13 +104,27 @@ lazy val `quill-core` = libraryDependencies += "org.scala-js" %%% "scalajs-java-time" % "0.2.5", coverageExcludedPackages := ".*" ) + .nativeSettings( + libraryDependencies += "org.akka-js" %%% "scalanative-java-time" % "0.0.2", + // Workaround for Scala Native bug: https://github.com/scala-native/scala-native/issues/1359 + Test / sources := + (Test / sources).value + .filterNot { s => + val path = s.getPath + path.contains("src/test/scala/io/getquill/monad/") + }, + nativeLinkStubs := true + ) lazy val `quill-core-jvm` = `quill-core`.jvm lazy val `quill-core-js` = `quill-core`.js +lazy val `quill-core-native` = `quill-core`.native lazy val `quill-sql` = - crossProject(JVMPlatform, JSPlatform).crossType(superPure) + crossProject(JVMPlatform, JSPlatform, NativePlatform).crossType(superPure) .settings(commonSettings: _*) + .platformsSettings(JVMPlatform, JSPlatform)(commonJvmJsSettings) + .nativeSettings(commonNativeSettings) .settings(mimaSettings: _*) .jsSettings( coverageExcludedPackages := ".*" @@ -113,6 +133,7 @@ lazy val `quill-sql` = lazy val `quill-sql-jvm` = `quill-sql`.jvm lazy val `quill-sql-js` = `quill-sql`.js +lazy val `quill-sql-native` = `quill-sql`.native lazy val `quill-codegen` = @@ -191,6 +212,7 @@ def includeIfOracle[T](t:T):Seq[T] = lazy val `quill-jdbc` = (project in file("quill-jdbc")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings(jdbcTestingSettings: _*) .dependsOn(`quill-sql-jvm` % "compile->compile;test->test") @@ -198,6 +220,7 @@ lazy val `quill-jdbc` = lazy val `quill-monix` = (project in file("quill-monix")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -211,6 +234,7 @@ lazy val `quill-monix` = lazy val `quill-jdbc-monix` = (project in file("quill-jdbc-monix")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings(jdbcTestingSettings: _*) .settings( @@ -232,6 +256,7 @@ lazy val `quill-jdbc-monix` = lazy val `quill-spark` = (project in file("quill-spark")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -244,6 +269,7 @@ lazy val `quill-spark` = lazy val `quill-finagle-mysql` = (project in file("quill-finagle-mysql")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -256,6 +282,7 @@ lazy val `quill-finagle-mysql` = lazy val `quill-finagle-postgres` = (project in file("quill-finagle-postgres")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -268,6 +295,7 @@ lazy val `quill-finagle-postgres` = lazy val `quill-async` = (project in file("quill-async")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -280,6 +308,7 @@ lazy val `quill-async` = lazy val `quill-async-mysql` = (project in file("quill-async-mysql")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -292,6 +321,7 @@ lazy val `quill-async-mysql` = lazy val `quill-async-postgres` = (project in file("quill-async-postgres")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -304,6 +334,7 @@ lazy val `quill-async-postgres` = lazy val `quill-cassandra` = (project in file("quill-cassandra")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -316,6 +347,7 @@ lazy val `quill-cassandra` = lazy val `quill-cassandra-monix` = (project in file("quill-cassandra-monix")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true @@ -326,6 +358,7 @@ lazy val `quill-cassandra-monix` = lazy val `quill-cassandra-lagom` = (project in file("quill-cassandra-lagom")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -343,6 +376,7 @@ lazy val `quill-cassandra-lagom` = lazy val `quill-orientdb` = (project in file("quill-orientdb")) .settings(commonSettings: _*) + .settings(commonJvmJsSettings) .settings(mimaSettings: _*) .settings( fork in Test := true, @@ -605,3 +639,13 @@ lazy val commonSettings = ReleasePlugin.extraReleaseCommands ++ basicSettings ++ ) ) + +lazy val commonJvmJsSettings = Seq( + libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.6" % Test +) + +lazy val commonNativeSettings = Seq( + libraryDependencies += "org.scalatest" %%% "scalatest" % "3.1.0-SNAP7" % Test, + nativeLinkStubs := true, + crossScalaVersions := Seq("2.11.12") +) diff --git a/build/build.sh b/build/build.sh index 26f5d16937..38ab9f76ec 100755 --- a/build/build.sh +++ b/build/build.sh @@ -20,7 +20,7 @@ export CASSANDRA_PORT=19042 export ORIENTDB_HOST=127.0.0.1 export ORIENTDB_PORT=12424 -export SBT_ARGS="-Dquill.macro.log=false -Xms1024m -Xmx3g -Xss5m -XX:ReservedCodeCacheSize=256m -XX:+TieredCompilation -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC ++$TRAVIS_SCALA_VERSION" +export SBT_ARGS="-Dquill.macro.log=false -J-Xms1024m -J-Xmx3g -J-Xss5m -J-XX:ReservedCodeCacheSize=256m -J-XX:+TieredCompilation -J-XX:+CMSClassUnloadingEnabled -J-XX:+UseConcMarkSweepGC ++$TRAVIS_SCALA_VERSION" modules=$1 @@ -215,4 +215,4 @@ if [[ $TRAVIS_SCALA_VERSION == 2.11* ]]; then fi show_mem -sleep 10 \ No newline at end of file +sleep 10 diff --git a/project/build.properties b/project/build.properties index d6e35076cc..c0bab04941 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.1.6 +sbt.version=1.2.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 588f2437ac..7076ac0145 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -20,4 +20,8 @@ addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.27") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.8") + +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") + +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.0")