Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Scala Native - Updated #1443

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 54 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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]](
Expand All @@ -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") =>
Expand All @@ -61,30 +62,35 @@ 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] =
Some(projectBase.getParentFile / "src" / conf / "scala")

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",
Expand All @@ -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 := ".*"
Expand All @@ -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` =
Expand Down Expand Up @@ -191,13 +212,15 @@ 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")

lazy val `quill-monix` =
(project in file("quill-monix"))
.settings(commonSettings: _*)
.settings(commonJvmJsSettings)
.settings(mimaSettings: _*)
.settings(
fork in Test := true,
Expand All @@ -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(
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -605,3 +639,13 @@ lazy val commonSettings = ReleasePlugin.extraReleaseCommands ++ basicSettings ++
</developer>
</developers>)
)

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")
)
4 changes: 2 additions & 2 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -215,4 +215,4 @@ if [[ $TRAVIS_SCALA_VERSION == 2.11* ]]; then
fi
show_mem

sleep 10
sleep 10
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.1.6
sbt.version=1.2.8
6 changes: 5 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")