Skip to content

Commit

Permalink
Backport Scala 2.13.12 support (#1377)
Browse files Browse the repository at this point in the history
Backport of #1375

Pull request: #1377
---------

Co-authored-by: Alexandre Archambault <[email protected]>
  • Loading branch information
lefou and alexarchambault authored Sep 16, 2023
1 parent 6321610 commit 7633e64
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
java-version: [8, 11]
scala-version: [2.12.18, 2.13.11, 3.2.2]
scala-version: [2.12.18, 2.13.12, 3.2.2]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -29,7 +29,7 @@ jobs:
fail-fast: false
matrix:
java-version: [8, 11]
scala-version: [2.12.18, 2.13.11, 3.2.2]
scala-version: [2.12.18, 2.13.12, 3.2.2]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package ammonite.compiler

import ammonite.util.Classpath

import scala.reflect.internal.util.{CodeAction, Position}
import scala.reflect.io.FileZipArchive
import scala.tools.nsc
import scala.tools.nsc.classpath.{AggregateClassPath, ZipAndJarClassPathFactory}
import scala.tools.nsc.{Global, Settings}
import scala.tools.nsc.interactive.{InteractiveAnalyzer, Global => InteractiveGlobal}
import scala.tools.nsc.plugins.Plugin
import scala.tools.nsc.reporters.FilteringReporter
import scala.tools.nsc.typechecker.Analyzer

object MakeReporter {

type Reporter = scala.tools.nsc.reporters.Reporter

def makeReporter(errorLogger: (Position, String) => Unit,
warningLogger: (Position, String) => Unit,
infoLogger: (Position, String) => Unit,
outerSettings: Settings): Reporter =
new FilteringReporter {

override
def doReport(pos: scala.reflect.internal.util.Position,
msg: String,
severity: Severity,
actions: List[CodeAction]): Unit =
display(pos, msg, severity)

def display(pos: Position, msg: String, severity: Severity) =
severity match{
case ERROR =>
Classpath.traceClasspathProblem(s"ERROR: $msg")
errorLogger(pos, msg)
case WARNING =>
warningLogger(pos, msg)
case INFO =>
infoLogger(pos, msg)
}

def settings = outerSettings
}
}
10 changes: 6 additions & 4 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ val cross2_3Version = (scala3Ver: String) =>


val scala2_12Versions = Seq("2.12.8", "2.12.9", "2.12.10", "2.12.11", "2.12.12", "2.12.13", "2.12.14", "2.12.15", "2.12.16", "2.12.17", "2.12.18")
val scala2_13Versions = Seq("2.13.0", "2.13.1", "2.13.2", "2.13.3", "2.13.4", "2.13.5", "2.13.6", "2.13.7", "2.13.8", "2.13.9", "2.13.10", "2.13.11")
val scala2_13Versions = Seq("2.13.0", "2.13.1", "2.13.2", "2.13.3", "2.13.4", "2.13.5", "2.13.6", "2.13.7", "2.13.8", "2.13.9", "2.13.10", "2.13.11", "2.13.12")
val scala30Versions = Seq("3.0.0", "3.0.1", "3.0.2")
val scala31Versions = Seq("3.1.0", "3.1.1", "3.1.2", "3.1.3")
val scala32Versions = Seq("3.2.0", "3.2.1", "3.2.2")
Expand Down Expand Up @@ -79,7 +79,7 @@ val fastparseVersion = "2.3.0"
val scalametaVersion = "4.8.5"

object Deps {
val acyclic = ivy"com.lihaoyi:::acyclic:0.3.8"
val acyclic = ivy"com.lihaoyi:::acyclic:0.3.9"
val bsp4j = ivy"ch.epfl.scala:bsp4j:${bspVersion}"
val bcprovJdk15on = ivy"org.bouncycastle:bcprov-jdk15on:1.56"
val cask = ivy"com.lihaoyi::cask:0.6.0"
Expand Down Expand Up @@ -269,8 +269,10 @@ trait AmmInternalModule extends CrossSbtModule with Bloop.Module{
val extraDir3 =
if (isScala2()) {
val dir =
if (sv.startsWith("2.13.") && sv != "2.13.0")
millSourcePath / "src" / "main" / "scala-2.13.1+"
if (sv.startsWith("2.13.") && sv.stripPrefix("2.13.").toInt >= 1 && sv.stripPrefix("2.13.").toInt <= 11)
millSourcePath / "src" / "main" / "scala-2.13.1-2.13.11"
else if (sv.startsWith("2.13.") && sv.stripPrefix("2.13.").toInt >= 12)
millSourcePath / "src" / "main" / "scala-2.13.12+"
else if (sv.startsWith("2.12.") && sv.stripPrefix("2.12.").toInt >= 13)
millSourcePath / "src" / "main" / "scala-2.12.13+"
else
Expand Down

0 comments on commit 7633e64

Please sign in to comment.