Skip to content

Commit b02adcc

Browse files
committed
Support scala native
1 parent 2554d9e commit b02adcc

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

build.sbt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,22 @@ lazy val scala3 = "3.0.2"
2323
ThisBuild / scalaVersion := scala213
2424
ThisBuild / scalafixDependencies += organizeImports
2525

26-
lazy val root = project
26+
lazy val root = crossProject(JVMPlatform, NativePlatform)
27+
.crossType(CrossType.Pure)
2728
.in(file("."))
2829
.settings(
29-
name := "Python Native Libs",
30+
name := "Python Native Libs",
31+
sonatypeCredentialHost := "s01.oss.sonatype.org",
32+
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
33+
)
34+
.jvmSettings(
3035
crossScalaVersions := Seq(scala212, scala213, scala3),
3136
libraryDependencies ++= Seq(
32-
scalaCollectionCompat,
33-
scalapy % Test,
34-
scalaTest % Test
37+
"org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion,
38+
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
39+
"me.shadaj" %% "scalapy-core" % scalapyVersion % Test
3540
),
36-
Test / fork := true
37-
)
38-
.settings(
41+
Test / fork := true,
3942
semanticdbEnabled := true,
4043
semanticdbVersion := scalafixSemanticdb.revision,
4144
scalacOptions += {
@@ -46,9 +49,13 @@ lazy val root = project
4649
}
4750
}
4851
)
49-
.settings(
50-
sonatypeCredentialHost := "s01.oss.sonatype.org",
51-
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
52+
.nativeSettings(
53+
crossScalaVersions := Seq(scala212, scala213),
54+
libraryDependencies ++= Seq(
55+
"org.scala-lang.modules" %%% "scala-collection-compat" % scalaCollectionCompatVersion,
56+
"org.scalatest" %%% "scalatest" % scalaTestVersion % Test,
57+
"me.shadaj" %%% "scalapy-core" % scalapyVersion % Test
58+
)
5259
)
5360

5461
lazy val docs = project
@@ -59,4 +66,4 @@ lazy val docs = project
5966
"PYTHON" -> "/usr/bin/python3"
6067
)
6168
)
62-
.dependsOn(root)
69+
.dependsOn(root.jvm)

project/Dependencies.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import sbt._
22

33
object Dependencies {
4-
lazy val scalaCollectionCompat =
5-
"org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0"
6-
lazy val scalapy = "me.shadaj" %% "scalapy-core" % "0.5.2"
7-
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.2.11"
4+
lazy val scalapyVersion = "0.5.2"
5+
lazy val scalaCollectionCompatVersion = "2.7.0"
6+
lazy val scalaTestVersion = "3.2.11"
7+
88
lazy val organizeImports = "com.github.liancheng" %% "organize-imports" % "0.6.0"
99
}

project/plugins.sbt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
2-
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
3-
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0")
1+
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
2+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0")
3+
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
4+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
5+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0")

0 commit comments

Comments
 (0)