diff --git a/.gitignore b/.gitignore index 83e9768..7794124 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ TAGS *~ .#* .lib +.idea/ +target/ \ No newline at end of file diff --git a/build.sbt b/build.sbt index 1230f03..7a0825d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,8 @@ import ReleaseTransformations._ +// shadow sbt-scalajs' crossProject and CrossType until Scala.js 1.0.0 is released +import sbtcrossproject.{crossProject, CrossType} + lazy val scalac: Seq[String] = Seq( "-deprecation", // Emit warning and location for usages of deprecated APIs. "-encoding", "utf-8", // Specify character encoding used by source files. @@ -69,9 +72,9 @@ lazy val deboxSettings = Seq( resolvers += Resolver.sonatypeRepo("releases"), libraryDependencies ++= Seq( - "org.typelevel" %% "spire" % "0.14.1", - "org.scalatest" %% "scalatest" % "3.0.4" % "test", - "org.scalacheck" %% "scalacheck" % "1.13.5" % "test" + "org.typelevel" %%% "spire" % "0.14.1", + "org.scalatest" %%% "scalatest" % "3.0.4" % "test", + "org.scalacheck" %%% "scalacheck" % "1.13.5" % "test" ), @@ -139,12 +142,16 @@ lazy val noPublishSettings = Seq( publishArtifact := false ) -lazy val core = project +lazy val core = crossProject(JSPlatform, JVMPlatform) .in(file(".")) .settings(moduleName := "debox") .settings(deboxSettings) -lazy val benchmark = project.dependsOn(core) +lazy val coreJvm = core.jvm +lazy val coreJs = core.js + +lazy val benchmark = project + .dependsOn(coreJvm) .in(file("benchmark")) .settings(moduleName := "debox-benchmark") .settings(deboxSettings) diff --git a/project/plugins.sbt b/project/plugins.sbt index ac37d4e..a3c6aca 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,3 +2,6 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.7") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") +addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "0.3.1") // (1) +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.3.1") // (2) diff --git a/src/main/scala/debox/Buffer.scala b/shared/src/main/scala/debox/Buffer.scala similarity index 100% rename from src/main/scala/debox/Buffer.scala rename to shared/src/main/scala/debox/Buffer.scala diff --git a/src/main/scala/debox/Map.scala b/shared/src/main/scala/debox/Map.scala similarity index 100% rename from src/main/scala/debox/Map.scala rename to shared/src/main/scala/debox/Map.scala diff --git a/src/main/scala/debox/Set.scala b/shared/src/main/scala/debox/Set.scala similarity index 100% rename from src/main/scala/debox/Set.scala rename to shared/src/main/scala/debox/Set.scala diff --git a/src/main/scala/debox/Util.scala b/shared/src/main/scala/debox/Util.scala similarity index 100% rename from src/main/scala/debox/Util.scala rename to shared/src/main/scala/debox/Util.scala diff --git a/src/test/scala/debox/BufferCheck.scala b/shared/src/test/scala/debox/BufferCheck.scala similarity index 100% rename from src/test/scala/debox/BufferCheck.scala rename to shared/src/test/scala/debox/BufferCheck.scala diff --git a/src/test/scala/debox/MapCheck.scala b/shared/src/test/scala/debox/MapCheck.scala similarity index 100% rename from src/test/scala/debox/MapCheck.scala rename to shared/src/test/scala/debox/MapCheck.scala diff --git a/src/test/scala/debox/SetCheck.scala b/shared/src/test/scala/debox/SetCheck.scala similarity index 100% rename from src/test/scala/debox/SetCheck.scala rename to shared/src/test/scala/debox/SetCheck.scala