Skip to content

Commit

Permalink
Cross build to sbt 2.0.0-M2
Browse files Browse the repository at this point in the history
  • Loading branch information
adpi2 committed Nov 4, 2024
1 parent b7647a9 commit 793406e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
10 changes: 7 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ licenses += (

homepage := Some(url("https://github.com/sbt/sbt-jdi-tools"))

scalaVersion := "2.12.20"
val scala212 = "2.12.20"
val scala3 = "3.3.4"

scalaVersion := scala212
crossScalaVersions := Seq(scala212, scala3)
pluginCrossBuild / sbtVersion := {
scalaBinaryVersion.value match {
case "2.12" =>
Expand All @@ -25,11 +29,11 @@ pluginCrossBuild / sbtVersion := {
}

scalacOptions ++= Seq(
"-encoding", "UTF-8", "-target:jvm-1.8",
"-encoding", "UTF-8",
"-deprecation", "-unchecked", "-feature",
"-Xfatal-warnings"
) ++ (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, scalaMajor)) if scalaMajor == 10 => Seq("-Ywarn-all")
case Some((2, _)) => Seq("-target:jvm-1.8")
case _ => Nil
})

Expand Down
7 changes: 7 additions & 0 deletions src/main/scala-2.12/org/scaladebugger/Compat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.scaladebugger

import sbt._

private[scaladebugger] object Compat {
def toClassEntry(file: File): Attributed[File] = Attributed.blank(file)
}
8 changes: 8 additions & 0 deletions src/main/scala-3/org/scaladebugger/Compat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.scaladebugger

import sbt.*

private[scaladebugger] object Compat:
inline def toClassEntry(file: File): Attributed[HashedVirtualFileRef] =
val fc = Keys.fileConverter.value
Attributed.blank(fc.toVirtualFile(file.toPath))
2 changes: 1 addition & 1 deletion src/main/scala/org/scaladebugger/SbtJdiTools.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object SbtJdiTools extends AutoPlugin {
Seq(
// JDK Dependency (just for sbt, must exist on classpath for execution,
// cannot be redistributed)
unmanagedJars += { Attributed.blank(JavaTools) }
unmanagedJars += Compat.toClassEntry(JavaTools)
)
else
// on Java 9+, we don't need to do anything at all
Expand Down

0 comments on commit 793406e

Please sign in to comment.