Skip to content

Commit 61d8d37

Browse files
committed
Update Scala Native to 0.5.4, scalatest to 3.2.19, scalacheck-1-18 to 3.2.19.0 + comment out MiMa checks for Scala Native + add platform specific options for Scala JS and Scala Native
1 parent c9461b5 commit 61d8d37

File tree

2 files changed

+56
-8
lines changed

2 files changed

+56
-8
lines changed

build.sbt

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import org.scalajs.linker.interface.{CheckedBehavior, ESVersion}
2-
import sbt._
3-
import scala.sys.process._
2+
import sbt.*
3+
4+
import scala.collection.Seq
5+
import scala.scalanative.build.{GC, LTO, Mode}
6+
import scala.sys.process.*
47

58
lazy val oldVersion = "git describe --abbrev=0".!!.trim.replaceAll("^v", "")
69

@@ -58,6 +61,49 @@ lazy val commonSettings = Seq(
5861
pomIncludeRepository := { _ => false }
5962
)
6063

64+
lazy val jsSettings = Seq(
65+
scalacOptions ++= {
66+
val localSourcesPath = (LocalRootProject / baseDirectory).value.toURI
67+
val remoteSourcesPath = s"https://raw.githubusercontent.com/plokhotnyuk/rtree2d/${git.gitHeadCommit.value.get}/"
68+
CrossVersion.partialVersion(scalaVersion.value) match {
69+
case Some((2, _)) => Seq(
70+
s"-P:scalajs:mapSourceURI:$localSourcesPath->$remoteSourcesPath",
71+
"-P:scalajs:genStaticForwardersForNonTopLevelObjects"
72+
)
73+
case _ => Seq(
74+
s"-scalajs-mapSourceURI:$localSourcesPath->$remoteSourcesPath",
75+
"-scalajs-genStaticForwardersForNonTopLevelObjects"
76+
)
77+
}
78+
},
79+
scalaJSLinkerConfig ~= {
80+
_.withSemantics({
81+
_.optimized
82+
.withProductionMode(true)
83+
.withAsInstanceOfs(CheckedBehavior.Unchecked)
84+
.withStringIndexOutOfBounds(CheckedBehavior.Unchecked)
85+
.withArrayIndexOutOfBounds(CheckedBehavior.Unchecked)
86+
.withArrayStores(CheckedBehavior.Unchecked)
87+
.withNegativeArraySizes(CheckedBehavior.Unchecked)
88+
.withNullPointers(CheckedBehavior.Unchecked)
89+
}).withClosureCompiler(true)
90+
.withESFeatures(_.withESVersion(ESVersion.ES2015))
91+
.withModuleKind(ModuleKind.CommonJSModule)
92+
},
93+
coverageEnabled := false // FIXME: Unexpected crash of scalac
94+
)
95+
96+
lazy val nativeSettings = Seq(
97+
scalacOptions ++= Seq("-P:scalanative:genStaticForwardersForNonTopLevelObjects"),
98+
nativeConfig ~= {
99+
_.withMode(Mode.releaseFast) // TODO: test with `Mode.releaseSize` and `Mode.releaseFull`
100+
.withLTO(LTO.none)
101+
.withGC(GC.immix)
102+
},
103+
mimaPreviousArtifacts := Set(), // FIXME: remove after the first release for Scala Native 0.5
104+
coverageEnabled := false // FIXME: Unexpected linking error
105+
)
106+
61107
lazy val noPublishSettings = Seq(
62108
publish / skip := true,
63109
mimaPreviousArtifacts := Set()
@@ -88,7 +134,7 @@ lazy val publishSettings = Seq(
88134
)
89135

90136
lazy val rtree2d = project.in(file("."))
91-
.aggregate((if (isWindows) winProjects else unixProjects):_*)
137+
.aggregate((if (isWindows) winProjects else unixProjects)*)
92138
.settings(commonSettings)
93139
.settings(noPublishSettings)
94140

@@ -103,8 +149,8 @@ lazy val `rtree2d-core` = crossProject(JVMPlatform, JSPlatform, NativePlatform)
103149
.settings(
104150
crossScalaVersions := Seq("3.3.3", "2.13.14", "2.12.19"),
105151
libraryDependencies ++= Seq(
106-
"org.scalatest" %%% "scalatest" % "3.2.18" % Test,
107-
"org.scalatestplus" %%% "scalacheck-1-16" % "3.2.14.0" % Test
152+
"org.scalatestplus" %%% "scalacheck-1-18" % "3.2.19.0" % Test,
153+
"org.scalatest" %%% "scalatest" % "3.2.19" % Test
108154
)
109155
)
110156
.jsSettings(
@@ -129,8 +175,10 @@ lazy val `rtree2d-core` = crossProject(JVMPlatform, JSPlatform, NativePlatform)
129175
lazy val `rtree2d-coreJVM` = `rtree2d-core`.jvm
130176

131177
lazy val `rtree2d-coreJS` = `rtree2d-core`.js
178+
.settings(jsSettings)
132179

133180
lazy val `rtree2d-coreNative` = `rtree2d-core`.native
181+
.settings(nativeSettings)
134182

135183
lazy val `rtree2d-benchmark` = project
136184
.enablePlugins(JmhPlugin)
@@ -143,7 +191,7 @@ lazy val `rtree2d-benchmark` = project
143191
"org.locationtech.jts" % "jts-core" % "1.19.0",
144192
"com.github.davidmoten" % "rtree2" % "0.9.3",
145193
"org.spire-math" %% "archery" % "0.6.0",
146-
"org.scalatest" %% "scalatest" % "3.2.18" % Test
194+
"org.scalatest" %%% "scalatest" % "3.2.19" % Test
147195
),
148196
charts := Def.inputTaskDyn {
149197
val jmhParams = Def.spaceDelimited().parsed

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
22
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
33
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
44
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")
5-
6-
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17")
5+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4")
76
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.11.0")
87
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
98
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
109
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7")
1110
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.1.0")
1211
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
1312
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.12")
13+
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")
1414

1515
libraryDependencies ++= Seq(
1616
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.7",

0 commit comments

Comments
 (0)