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

Scala Native 0.5.x #508

Merged
merged 24 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
build:
name: Build and Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
scala: [2.12, 2.13, 3]
Expand Down Expand Up @@ -252,5 +253,5 @@ jobs:
- name: Submit Dependencies
uses: scalacenter/sbt-dependency-submission@v2
with:
modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 tests_sjs1_2.12 tests_sjs1_2.13 tests_sjs1_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 demo_2.12 demo_2.13 demo_3 tests_2.12 tests_2.13 tests_3 demo_native0.4_2.12 demo_native0.4_2.13 demo_native0.4_3 tests_native0.4_2.12 tests_native0.4_2.13 tests_native0.4_3 demo_sjs1_2.12 demo_sjs1_2.13 demo_sjs1_3
modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 tests_sjs1_2.12 tests_sjs1_2.13 tests_sjs1_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 demo_2.12 demo_2.13 demo_3 tests_2.12 tests_2.13 tests_3 demo_native0.5_2.12 demo_native0.5_2.13 demo_native0.5_3 tests_native0.5_2.12 tests_native0.5_2.13 tests_native0.5_3 demo_sjs1_2.12 demo_sjs1_2.13 demo_sjs1_3
configs-ignore: test scala-tool scala-doc-tool test-internal
4 changes: 1 addition & 3 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
-Xmx4g
-Xss4m
-XX:MaxMetaspaceSize=1g
-XX:ReservedCodeCacheSize=512m
-XX:+UseParallelGC
-Dfile.encoding=UTF8
-XX:+PrintCommandLineFlags
25 changes: 14 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ ThisBuild / crossScalaVersions := Seq("2.12.17", scala213, scala3)

ThisBuild / tlBaseVersion := "2.5"

ThisBuild / githubWorkflowBuildMatrixFailFast := Some(false)

val javaDistro = JavaSpec.corretto("11")
ThisBuild / githubWorkflowJavaVersions := Seq(javaDistro)

Expand All @@ -23,7 +25,7 @@ ThisBuild / githubWorkflowBuildMatrixInclusions +=
)

val tzdbVersion = "2019c"
val scalajavaLocalesVersion = "1.5.1"
val scalajavaLocalesVersion = "1.5.4"
Global / onChangedBuildSource := ReloadOnSourceChanges

lazy val downloadFromZip: TaskKey[Unit] =
Expand Down Expand Up @@ -142,7 +144,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.settings(commonSettings)
.settings(
name := "scala-java-time",
libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.2")
libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.3")
.cross(CrossVersion.for3Use2_13)
)
.jsSettings(
Expand All @@ -160,6 +162,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
)
)
.nativeSettings(
scalacOptions += "-P:scalanative:genStaticForwardersForNonTopLevelObjects",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be different for Scala 3?

(CrossVersion.partialVersion(scalaVersion.value) match {
    case Some((2, _)) => "-P:scalanative:genStaticForwardersForNonTopLevelObjects"
    case _ => "-scalanative-genStaticForwardersForNonTopLevelObjects"
  })

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, that doesn't work. Has to be like it is currently in the PR. The tests being green are the proof :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'-P' stands for prefix for compiler settings. In case of Scala.js the compiler plugin setting in Scala 2 was elevated to standalone setting in Scala 3 after Scala.js backend become a part of compiler.
Scala Native is not going to become part of compiler at least until 1.0

Compile / sourceGenerators += Def.task {
val srcDirs = (Compile / sourceDirectories).value
val destinationDir = (Compile / sourceManaged).value
Expand All @@ -175,9 +178,9 @@ lazy val tzdb = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.in(file("tzdb"))
.settings(commonSettings)
.settings(
name := "scala-java-time-tzdb",
includeTTBP := true,
dbVersion := TzdbPlugin.Version(tzdbVersion),
name := "scala-java-time-tzdb",
includeTTBP := true,
dbVersion := TzdbPlugin.Version(tzdbVersion)
)
.jsSettings(
Compile / sourceGenerators += Def.task {
Expand Down Expand Up @@ -209,7 +212,7 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform, NativePlatform)
name := "tests",
Keys.`package` := file(""),
libraryDependencies +=
"org.scalatest" %%% "scalatest" % "3.2.14" % Test,
"org.scalatest" %%% "scalatest" % "3.2.18" % Test,
scalacOptions ~= (_.filterNot(
Set("-Wnumeric-widen", "-Ywarn-numeric-widen", "-Ywarn-value-discard", "-Wvalue-discard")
))
Expand Down Expand Up @@ -246,12 +249,12 @@ lazy val demo = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.dependsOn(core)
.enablePlugins(TzdbPlugin, NoPublishPlugin)
.settings(
name := "demo",
Keys.`package` := file(""),
zonesFilter := zonesFilterFn,
dbVersion := TzdbPlugin.Version(tzdbVersion),
name := "demo",
Keys.`package` := file(""),
zonesFilter := zonesFilterFn,
dbVersion := TzdbPlugin.Version(tzdbVersion),
// delegate test to run, so that it is invoked during test step in ci
Test / test := (Compile / run).toTask("").value
Test / test := (Compile / run).toTask("").value
)
.jsSettings(
scalaJSUseMainModuleInitializer := true
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.7.1")

addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.3")