From c5ecd062db3a251a65b4430902364c070c0ec5e7 Mon Sep 17 00:00:00 2001 From: Jiro Kugiya Date: Mon, 26 Aug 2024 20:53:13 +0900 Subject: [PATCH] Revert "Revert "Merge pull request #9 from arturaz/feat/cross-building"" This reverts commit edf3db9dc772ba85887ad67a5e88eeb3d70b9611. --- .gitignore | 11 ++++++++++- build.sbt | 16 +++++++++++----- project/build.properties | 2 +- project/plugins.sbt | 6 ++++++ 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 76f2cb8..ef9fff0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,13 @@ .idea/ target/ -.bsp +/.bsp +# SBT cross compilation targets +/.js +/.jvm +/.native +# Metals files +.bloop +/.metals +metals.sbt + null \ No newline at end of file diff --git a/build.sbt b/build.sbt index f0e3d88..3ea04ae 100644 --- a/build.sbt +++ b/build.sbt @@ -1,12 +1,18 @@ import Dependencies._ ThisBuild / scalaVersion := "3.3.3" -ThisBuild / crossScalaVersions := Seq("3.3.3", "2.13.14", "2.12.19", "2.11.19") -ThisBuild / version := "1.0.3-SNAPSHOT" +ThisBuild / crossScalaVersions := Seq("3.3.3", "2.13.14", "2.12.19", "2.11.12") +ThisBuild / version := "1.0.4-SNAPSHOT" ThisBuild / organization := "com.github.jkugiya" ThisBuild / organizationName := "jkugiya" -lazy val root = (project in file(".")) +lazy val root = + ( + crossProject(JVMPlatform, JSPlatform, NativePlatform) + .withoutSuffixFor(JVMPlatform) + .crossType(CrossType.Pure) + .in(file(".")) + ) .settings( name := "ulid-scala", libraryDependencies += scalaTest % Test @@ -20,13 +26,13 @@ lazy val benchmark = (project in file("benchmark")) "io.azam.ulidj" % "ulidj" % "1.0.0" ) ) - .dependsOn(root) + .dependsOn(root.jvm) // Uncomment the following for publishing to Sonatype. // See https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html for more detail. ThisBuild / description := "A Scala port of alizain/ulid" - ThisBuild / licenses := List("MIT" -> new URL("https://github.com/jkugiya/ulid-scala/blob/master/LICENSE")) + ThisBuild / licenses := List("MIT" -> new URI("https://github.com/jkugiya/ulid-scala/blob/master/LICENSE").toURL) ThisBuild / homepage := Some(url("https://github.com/jkugiya/ulid-scala")) ThisBuild / scmInfo := Some( ScmInfo( diff --git a/project/build.properties b/project/build.properties index 46e43a9..ee4c672 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.2 +sbt.version=1.10.1 diff --git a/project/plugins.sbt b/project/plugins.sbt index 658a210..dd84939 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,3 +6,9 @@ addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") // coverage addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.1.1") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.13") + +// Cross-compilation +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4")