From e3d95adc583d3c06c81f6f55fa77a18d88560847 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sat, 11 May 2024 03:10:40 +0200 Subject: [PATCH 1/8] Scala Native 0.5.x --- .github/workflows/ci.yml | 8 ++++---- build.sbt | 12 ++++++------ project/plugins.sbt | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 262e52f1..90bfa004 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - scala: [2.12.19, 2.13.14, 3.4.1] + scala: [2.12.19, 2.13.14, 3.3.3] java: [temurin@8, temurin@17] runs-on: ${{ matrix.os }} steps: @@ -119,12 +119,12 @@ jobs: tar xf targets.tar rm targets.tar - - name: Download target directories (3.4.1) + - name: Download target directories (3.3.3) uses: actions/download-artifact@v4 with: - name: target-${{ matrix.os }}-3.4.1-${{ matrix.java }} + name: target-${{ matrix.os }}-3.3.3-${{ matrix.java }} - - name: Inflate target directories (3.4.1) + - name: Inflate target directories (3.3.3) run: | tar xf targets.tar rm targets.tar diff --git a/build.sbt b/build.sbt index 54e57f60..d42907c1 100644 --- a/build.sbt +++ b/build.sbt @@ -2,14 +2,14 @@ import locales._ import sbt.Keys._ import sbtcrossproject.CrossPlugin.autoImport.{ CrossType, crossProject } -lazy val cldrApiVersion = "4.3.0" +lazy val cldrApiVersion = "4.4.0" ThisBuild / versionScheme := Some("always") Global / onChangedBuildSource := ReloadOnSourceChanges lazy val scalaVersion213 = "2.13.14" -lazy val scalaVersion3 = "3.4.1" +lazy val scalaVersion3 = "3.3.3" ThisBuild / scalaVersion := scalaVersion213 ThisBuild / crossScalaVersions := Seq("2.12.19", scalaVersion213, scalaVersion3) @@ -151,7 +151,7 @@ lazy val localesFullCurrenciesDb = project supportDateTimeFormats := true, supportNumberFormats := true, supportISOCodes := true, - libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.2") + libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.3") .cross(CrossVersion.for3Use2_13) ) @@ -170,7 +170,7 @@ lazy val localesFullDb = crossProject(JSPlatform, NativePlatform) supportDateTimeFormats := true, supportNumberFormats := true, supportISOCodes := true, - libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.2") + libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.3") .cross(CrossVersion.for3Use2_13) ) @@ -188,7 +188,7 @@ lazy val localesMinimalEnDb = crossProject(JSPlatform, NativePlatform) supportDateTimeFormats := true, supportNumberFormats := true, supportISOCodes := false, - libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.2") + libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.3") .cross(CrossVersion.for3Use2_13) ) @@ -206,7 +206,7 @@ lazy val localesMinimalEnUSDb = crossProject(JSPlatform, NativePlatform) supportDateTimeFormats := true, supportNumberFormats := true, supportISOCodes := false, - libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.2") + libraryDependencies += ("org.portable-scala" %%% "portable-scala-reflect" % "1.1.3") .cross(CrossVersion.for3Use2_13) ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 80882e9f..79f578bd 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,9 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") 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.1") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") -addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "4.3.0") +addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "4.4.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1") -addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.23.0") \ No newline at end of file +addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.23.0") From 1774fe54ca1df4adf05d3809fa09d17e01ea5c46 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Fri, 31 May 2024 19:18:43 +0200 Subject: [PATCH 2/8] update --- build.sbt | 2 +- project/plugins.sbt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index d42907c1..590625fc 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ import locales._ import sbt.Keys._ import sbtcrossproject.CrossPlugin.autoImport.{ CrossType, crossProject } -lazy val cldrApiVersion = "4.4.0" +lazy val cldrApiVersion = "4.5.0" ThisBuild / versionScheme := Some("always") diff --git a/project/plugins.sbt b/project/plugins.sbt index 79f578bd..be916cad 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,7 +3,7 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") -addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "4.4.0") +addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "4.5.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1") addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.23.0") From 5d6c4c6f3611c1fc8916e4005095bdf813892976 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Fri, 31 May 2024 19:55:24 +0200 Subject: [PATCH 3/8] scala-native 0.5.2 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index be916cad..c8b70699 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.2") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("io.github.cquiroz" % "sbt-locales" % "4.5.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") From 66e176970e1f7bbe5a8c8f31f2e28ec0d0b9c3ed Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Fri, 31 May 2024 20:54:38 +0200 Subject: [PATCH 4/8] genStaticForwardersForNonTopLevelObjects --- build.sbt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/build.sbt b/build.sbt index 590625fc..ea1dfac1 100644 --- a/build.sbt +++ b/build.sbt @@ -87,7 +87,8 @@ lazy val root = project tests.native, localesFullDb.js, localesFullDb.native, - localesFullCurrenciesDb, + localesFullCurrenciesDb.js, + localesFullCurrenciesDb.native, localesMinimalEnDb.js, localesMinimalEnDb.native, localesMinimalEnUSDb.js, @@ -133,14 +134,20 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) } } ) + .nativeSettings( + scalacOptions ++= { + if (scalaVersion.value == scalaVersion3) + Seq("-scalanative-genStaticForwardersForNonTopLevelObjects") + else Seq("-P:scalanative:genStaticForwardersForNonTopLevelObjects") + } + ) lazy val cldrDbVersion = "36.0" -lazy val localesFullCurrenciesDb = project +lazy val localesFullCurrenciesDb = crossProject(JSPlatform, NativePlatform) .in(file("localesFullCurrenciesDb")) .settings(commonSettings) .configure(_.enablePlugins(LocalesPlugin)) - .configure(_.enablePlugins(ScalaJSPlugin)) .settings( name := "locales-full-currencies-db", cldrVersion := CLDRVersion.Version(cldrDbVersion), @@ -228,7 +235,7 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform, NativePlatform) .jsSettings(Test / parallelExecution := false, scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)) ) - .jsConfigure(_.dependsOn(core.js, macroutils, localesFullCurrenciesDb)) + .jsConfigure(_.dependsOn(core.js, macroutils, localesFullCurrenciesDb.js)) .jvmSettings( // Fork the JVM test to ensure that the custom flags are set Test / fork := true, @@ -245,14 +252,7 @@ lazy val tests = crossProject(JVMPlatform, JSPlatform, NativePlatform) Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat ) .jvmConfigure(_.dependsOn(macroutils)) - .nativeSettings( - nativeConfig ~= { - _.withOptimize(false) - // tests fail to link on Scala 2.11 and 2.12 in debug mode - // with the optimizer enabled - } - ) - .nativeConfigure(_.dependsOn(core.native, macroutils, localesFullDb.native)) + .nativeConfigure(_.dependsOn(core.native, macroutils, localesFullCurrenciesDb.native)) .platformsSettings(JSPlatform, NativePlatform)( Test / unmanagedSourceDirectories += baseDirectory.value.getParentFile / "js-native" / "src" / "test" / "scala" ) From fcffd21b6dabe0bc476541d90e2479630ae27922 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Fri, 31 May 2024 20:56:26 +0200 Subject: [PATCH 5/8] githubWorkflowGenerate --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90bfa004..51bcb420 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: run: sbt '++ ${{ matrix.scala }}' test - name: Compress target directories - run: tar cf targets.tar target core/native/target localesMinimalEnUSDb/native/target localesFullCurrenciesDb/target macroutils/target core/js/target core/jvm/target tests/js/target localesFullDb/.js/target localesFullDb/.native/target localesMinimalEnUSDb/js/target tests/jvm/target demo/native/target localesMinimalEnDb/native/target localesMinimalEnDb/js/target tests/native/target demo/js/target project/target + run: tar cf targets.tar target localesFullCurrenciesDb/js/target core/native/target localesMinimalEnUSDb/native/target macroutils/target core/js/target localesFullCurrenciesDb/native/target core/jvm/target tests/js/target localesFullDb/.js/target localesFullDb/.native/target localesMinimalEnUSDb/js/target tests/jvm/target demo/native/target localesMinimalEnDb/native/target localesMinimalEnDb/js/target tests/native/target demo/js/target project/target - name: Upload target directories uses: actions/upload-artifact@v4 From a74a40d51f784d1b040d89bc9045ea9baaacd1c0 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Fri, 31 May 2024 21:12:25 +0200 Subject: [PATCH 6/8] implicit z: Zone --- core/native/src/main/scala/locales/NormalizerImpl.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/native/src/main/scala/locales/NormalizerImpl.scala b/core/native/src/main/scala/locales/NormalizerImpl.scala index ed80a935..dc966026 100644 --- a/core/native/src/main/scala/locales/NormalizerImpl.scala +++ b/core/native/src/main/scala/locales/NormalizerImpl.scala @@ -13,7 +13,7 @@ private object NormalizerImpl { if (src == null || form == null) throw new NullPointerException else - Zone { implicit z => + Zone { implicit z: Zone => import Form._ import utf8proc._ From 58efbf3af493ed784db756058d1797e3dc30c514 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Fri, 31 May 2024 21:22:38 +0200 Subject: [PATCH 7/8] -P:scalanative:genStaticForwardersForNonTopLevelObjects --- build.sbt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index ea1dfac1..99b5ab6a 100644 --- a/build.sbt +++ b/build.sbt @@ -134,13 +134,9 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) } } ) - .nativeSettings( - scalacOptions ++= { - if (scalaVersion.value == scalaVersion3) - Seq("-scalanative-genStaticForwardersForNonTopLevelObjects") - else Seq("-P:scalanative:genStaticForwardersForNonTopLevelObjects") - } - ) + .nativeSettings { + scalacOptions += "-P:scalanative:genStaticForwardersForNonTopLevelObjects" + } lazy val cldrDbVersion = "36.0" From 0304c11facf2b94810a160fe31780fcda4cca61e Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Fri, 31 May 2024 21:29:21 +0200 Subject: [PATCH 8/8] Zone.acquire --- core/native/src/main/scala/locales/NormalizerImpl.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/native/src/main/scala/locales/NormalizerImpl.scala b/core/native/src/main/scala/locales/NormalizerImpl.scala index dc966026..e76dfd0c 100644 --- a/core/native/src/main/scala/locales/NormalizerImpl.scala +++ b/core/native/src/main/scala/locales/NormalizerImpl.scala @@ -13,7 +13,7 @@ private object NormalizerImpl { if (src == null || form == null) throw new NullPointerException else - Zone { implicit z: Zone => + Zone.acquire { implicit z => import Form._ import utf8proc._