Skip to content

Commit

Permalink
Support scala native
Browse files Browse the repository at this point in the history
  • Loading branch information
kiendang committed May 2, 2022
1 parent 2554d9e commit b02adcc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
31 changes: 19 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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 += {
Expand All @@ -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
Expand All @@ -59,4 +66,4 @@ lazy val docs = project
"PYTHON" -> "/usr/bin/python3"
)
)
.dependsOn(root)
.dependsOn(root.jvm)
8 changes: 4 additions & 4 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -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"
}
8 changes: 5 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit b02adcc

Please sign in to comment.