Skip to content

Commit

Permalink
feature: Support Scala Native (#73)
Browse files Browse the repository at this point in the history
* feature: Support Scala Native

* clean: Drop Scala 2.11

* fix: Install clang in CI

* fix: Scalatest dependency to use Scala Native dep
  • Loading branch information
lolgab committed May 4, 2023
1 parent 5728bc8 commit b19179f
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ workflows:
- run:
name: Compile
command: sbt +compile
- run:
name: Install Clang for Scala Native
command: sudo apt-get update && sudo apt-get install clang
- run:
name: Test
command: sbt +test
Expand Down
61 changes: 32 additions & 29 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
val scala211 = "2.11.12"
val scala212 = "2.12.10"
val scala212 = "2.12.17"
val scala213 = "2.13.10"
val scala3 = "3.2.2"

name := "codacy-plugins-api"
organization := "com.codacy"

scalaVersion := scala212

crossScalaVersions := Seq(scala211, scala212, scala213, scala3)

libraryDependencies ++= Seq("wordspec", "shouldmatchers").map(m => "org.scalatest" %% s"scalatest-$m" % "3.2.14" % Test)

Compile / unmanagedSourceDirectories += {
val sourceDir = (sourceDirectory in Compile).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((major, minor)) if major > 2 || minor >= 13 =>
sourceDir / "scala-2.13+"
case _ =>
sourceDir / "scala-2.13-"
}
}

pgpPassphrase := Option(System.getenv("SONATYPE_GPG_PASSPHRASE")).map(_.toCharArray)

description := "A dependency free api for Codacy Tools"

scmInfo := Some(
ScmInfo(url("https://github.com/codacy/codacy-plugins-api"), "scm:git:git@github.com:codacy/codacy-plugins-api.git"))

publicMvnPublish
ThisBuild / scalaVersion := scala212
ThisBuild / crossScalaVersions := Seq(scala212, scala213, scala3)

lazy val `codacy-plugins-api` =
crossProject(JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(name := "codacy-plugins-api",
organization := "com.codacy",
libraryDependencies ++= Seq("wordspec", "shouldmatchers").map(m =>
"org.scalatest" %%% s"scalatest-$m" % "3.2.14" % Test),
Compile / unmanagedSourceDirectories += {
val sourceDir = (ThisBuild / baseDirectory).value / name.value / "src" / "main"
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((major, minor)) if major > 2 || minor >= 13 =>
sourceDir / "scala-2.13+"
case _ =>
sourceDir / "scala-2.13-"
}
},
pgpPassphrase := Option(System.getenv("SONATYPE_GPG_PASSPHRASE")).map(_.toCharArray),
description := "A dependency free api for Codacy Tools",
scmInfo := Some(
ScmInfo(url("https://github.com/codacy/codacy-plugins-api"),
"scm:git:git@github.com:codacy/codacy-plugins-api.git")),
publicMvnPublish)

lazy val root =
project
.in(file("."))
.settings(publish / skip := true)
.aggregate(`codacy-plugins-api`.jvm, `codacy-plugins-api`.native)
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("com.codacy" % "codacy-sbt-plugin" % "25.1.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1")

0 comments on commit b19179f

Please sign in to comment.