Skip to content

Commit

Permalink
Close #213 by adding support of Scala Native and Scala.js
Browse files Browse the repository at this point in the history
  • Loading branch information
plokhotnyuk committed Oct 13, 2022
1 parent d7d1204 commit b9560f8
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 6 deletions.
59 changes: 54 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sbt.url
import org.scalajs.linker.interface.{CheckedBehavior, ESVersion}
import scala.sys.process._

lazy val oldVersion = "git describe --abbrev=0".!!.trim.replaceAll("^v", "")
Expand Down Expand Up @@ -58,6 +59,25 @@ lazy val commonSettings = Seq(
pomIncludeRepository := { _ => false }
)

lazy val jsSettings = Seq(
scalaJSLinkerConfig ~= {
_.withSemantics({
_.optimized
.withProductionMode(true)
.withAsInstanceOfs(CheckedBehavior.Unchecked)
.withStringIndexOutOfBounds(CheckedBehavior.Unchecked)
.withArrayIndexOutOfBounds(CheckedBehavior.Unchecked)
}).withClosureCompiler(true)
.withESFeatures(_.withESVersion(ESVersion.ES2015))
.withModuleKind(ModuleKind.CommonJSModule)
},
coverageEnabled := false // FIXME: Unexpected crash of scalac
)

lazy val nativeSettings = Seq(
coverageEnabled := false // FIXME: Unexpected linking error
)

lazy val noPublishSettings = Seq(
publish / skip := true,
mimaPreviousArtifacts := Set()
Expand Down Expand Up @@ -88,11 +108,12 @@ lazy val publishSettings = Seq(
)

lazy val `fast-string-interpolator` = project.in(file("."))
.aggregate(`fsi-macros`, `fsi-benchmark-core`, `fsi-benchmark`)
.aggregate(`fsi-macrosJVM`, `fsi-macrosJS`, `fsi-macrosNative`, `fsi-benchmark-coreJVM`, `fsi-benchmarkJVM`)
.settings(commonSettings)
.settings(noPublishSettings)

lazy val `fsi-macros` = project
lazy val `fsi-macros` = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Full)
.settings(commonSettings)
.settings(publishSettings)
.settings(
Expand All @@ -108,8 +129,30 @@ lazy val `fsi-macros` = project
}
)

lazy val `fsi-benchmark-core` = project
.enablePlugins(JmhPlugin)
lazy val `fsi-macrosJVM` = `fsi-macros`.jvm

lazy val `fsi-macrosJS` = `fsi-macros`.js
.settings(jsSettings)
.settings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.4.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.4.0"
),
mimaPreviousArtifacts := Set()
)

lazy val `fsi-macrosNative` = `fsi-macros`.native
.settings(nativeSettings)
.settings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % "2.4.0",
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.4.0"
),
mimaPreviousArtifacts := Set()
)

lazy val `fsi-benchmark-core` = crossProject(JVMPlatform)
.crossType(CrossType.Full)
.dependsOn(`fsi-macros`)
.settings(commonSettings)
.settings(noPublishSettings)
Expand All @@ -120,8 +163,11 @@ lazy val `fsi-benchmark-core` = project
)
)

lazy val `fsi-benchmark` = project
lazy val `fsi-benchmark-coreJVM` = `fsi-benchmark-core`.jvm
.enablePlugins(JmhPlugin)

lazy val `fsi-benchmark` = crossProject(JVMPlatform)
.crossType(CrossType.Full)
.dependsOn(`fsi-benchmark-core`)
.settings(commonSettings)
.settings(noPublishSettings)
Expand All @@ -134,3 +180,6 @@ lazy val `fsi-benchmark` = project
"org.scalatest" %% "scalatest" % "3.2.14" % Test
)
)

lazy val `fsi-benchmarkJVM` = `fsi-benchmark`.jvm
.enablePlugins(JmhPlugin)
File renamed without changes.
6 changes: 5 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.5")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.2")
Expand Down

0 comments on commit b9560f8

Please sign in to comment.