diff --git a/build.sbt b/build.sbt index 63eb7a3..094fc79 100644 --- a/build.sbt +++ b/build.sbt @@ -23,19 +23,22 @@ lazy val scala3 = "3.0.2" ThisBuild / scalaVersion := scala213 ThisBuild / scalafixDependencies += organizeImports -lazy val root = project +lazy val root = crossProject(JVMPlatform, NativePlatform) + .crossType(CrossType.Pure) .in(file(".")) .settings( - name := "Python Native Libs", + name := "Python Native Libs", + sonatypeCredentialHost := "s01.oss.sonatype.org", + sonatypeRepository := "https://s01.oss.sonatype.org/service/local" + ) + .jvmSettings( crossScalaVersions := Seq(scala212, scala213, scala3), libraryDependencies ++= Seq( - scalaCollectionCompat, - scalapy % Test, - scalaTest % Test + "org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion, + "org.scalatest" %% "scalatest" % scalaTestVersion % Test, + "me.shadaj" %% "scalapy-core" % scalapyVersion % Test ), - Test / fork := true - ) - .settings( + Test / fork := true, semanticdbEnabled := true, semanticdbVersion := scalafixSemanticdb.revision, scalacOptions += { @@ -46,9 +49,13 @@ lazy val root = project } } ) - .settings( - sonatypeCredentialHost := "s01.oss.sonatype.org", - sonatypeRepository := "https://s01.oss.sonatype.org/service/local" + .nativeSettings( + crossScalaVersions := Seq(scala212, scala213), + libraryDependencies ++= Seq( + "org.scala-lang.modules" %%% "scala-collection-compat" % scalaCollectionCompatVersion, + "org.scalatest" %%% "scalatest" % scalaTestVersion % Test, + "me.shadaj" %%% "scalapy-core" % scalapyVersion % Test + ) ) lazy val docs = project @@ -59,4 +66,4 @@ lazy val docs = project "PYTHON" -> "/usr/bin/python3" ) ) - .dependsOn(root) + .dependsOn(root.jvm) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index c1ff9f5..c59bd9d 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -1,9 +1,9 @@ import sbt._ object Dependencies { - lazy val scalaCollectionCompat = - "org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0" - lazy val scalapy = "me.shadaj" %% "scalapy-core" % "0.5.2" - lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.2.11" + lazy val scalapyVersion = "0.5.2" + lazy val scalaCollectionCompatVersion = "2.7.0" + lazy val scalaTestVersion = "3.2.11" + lazy val organizeImports = "com.github.liancheng" %% "organize-imports" % "0.6.0" } diff --git a/project/plugins.sbt b/project/plugins.sbt index 9412367..7444726 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,5 @@ -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2") -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0")