diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 33f409b3..23862471 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -26,7 +26,7 @@ jobs:
java-version: 11
- name: run tests
- run: sbt ++2.12.12 test
+ run: sbt ++2.12.10 test
scala-2_13:
runs-on: ubuntu-latest
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 3805efb7..05ffb87b 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -22,7 +22,7 @@ jobs:
java-version: 11
- name: run tests
- run: sbt ++2.12.12 test
+ run: sbt ++2.12.10 test
scala-2_13:
runs-on: ubuntu-latest
diff --git a/.travis.yml b/.travis.yml
index c03e55b7..75d0ea64 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ jdk:
- openjdk8
scala:
- - 2.12.12
+ - 2.12.10
- 2.13.3
before_cache:
diff --git a/build.sbt b/build.sbt
index 62fb19df..6005c089 100644
--- a/build.sbt
+++ b/build.sbt
@@ -10,8 +10,8 @@ val ScalatestVersion = "3.1.1"
val appSettings = Seq(
organization := Org,
- scalaVersion := "2.13.3",
- crossScalaVersions := Seq("2.12.12", "2.13.3"),
+ scalaVersion := "2.12.10",
+ crossScalaVersions := Seq("2.12.10", "2.13.3"),
fork in Test := false,
publishMavenStyle := true,
publishArtifact in Test := false,
@@ -24,6 +24,9 @@ val appSettings = Seq(
else
Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
},
+ libraryDependencies ++= Seq(
+ "org.scala-lang" % "scala-compiler" % scalaVersion.value % Compile
+ ),
pomExtra := {
https://github.com/scoverage/scalac-scoverage-plugin
@@ -89,11 +92,10 @@ lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plug
.settings(
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % "1.2.0",
- "org.scalatest" %% "scalatest" % ScalatestVersion % Test,
- "org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided
+ "org.scalatest" %% "scalatest" % ScalatestVersion % Test
)
)
.settings(
- unmanagedSourceDirectories in Test += (sourceDirectory in Test).value / "scala-2.11+"
+ unmanagedSourceDirectories in Test += (sourceDirectory in Test).value / "scala-2.12+"
)
diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala
index 27a824e5..a5440a76 100644
--- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala
+++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala
@@ -4,20 +4,20 @@ import java.io.{File, FileNotFoundException}
import java.net.URL
import scala.collection.mutable.ListBuffer
-import scala.tools.nsc.{Settings, Global}
+import scala.tools.nsc.{Global, Settings}
import scala.tools.nsc.plugins.PluginComponent
import scala.tools.nsc.transform.{Transform, TypingTransformers}
-/** @author Stephen Samuel */
object ScoverageCompiler {
- val ScalaVersion = scala.util.Properties.versionNumberString
- val ShortScalaVersion = (ScalaVersion split "[.]").toList match {
+ val ScalaVersion: String = scala.util.Properties.versionNumberString
+ val ShortScalaVersion: String = (ScalaVersion split "[.]").toList match {
case init :+ last if last forall (_.isDigit) => init mkString "."
- case _ => ScalaVersion
+ case _ => ScalaVersion
}
- def classPath = getScalaJars.map(_.getAbsolutePath) :+ sbtCompileDir.getAbsolutePath :+ runtimeClasses.getAbsolutePath
+ def classPath: Seq[String] =
+ getScalaJars.map(_.getAbsolutePath) :+ sbtCompileDir.getAbsolutePath :+ runtimeClasses.getAbsolutePath
def settings: Settings = {
val s = new scala.tools.nsc.Settings
@@ -57,15 +57,25 @@ object ScoverageCompiler {
private def runtimeClasses: File = new File(s"./scalac-scoverage-runtime/jvm/target/scala-$ShortScalaVersion/classes")
- private def findScalaJar(artifactId: String): File = findIvyJar("org.scala-lang", artifactId, ScalaVersion)
+ private def findScalaJar(artifactId: String): File =
+ findIvyJar("org.scala-lang", artifactId, ScalaVersion)
+ .orElse(findCoursierJar(artifactId, ScalaVersion))
+ .getOrElse {
+ throw new FileNotFoundException(s"Could not locate $artifactId/$ScalaVersion")
+ }
+
+ private def findCoursierJar(artifactId: String, version: String): Option[File] = {
+ val userHome = System.getProperty("user.home")
+ val jarPath = s"$userHome/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/$artifactId/$version/$artifactId-$version.jar"
+ val file = new File(jarPath)
+ if (file.exists()) Some(file) else None
+ }
- private def findIvyJar(groupId: String, artifactId: String, version: String, packaging: String = "jar"): File = {
+ private def findIvyJar(groupId: String, artifactId: String, version: String, packaging: String = "jar"): Option[File] = {
val userHome = System.getProperty("user.home")
val jarPath = s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar"
val file = new File(jarPath)
- if (!file.exists)
- throw new FileNotFoundException(s"Could not locate [$jarPath].")
- file
+ if (file.exists()) Some(file) else None
}
}
diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/macrosupport/Tester.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/macrosupport/Tester.scala
index 70b1788a..78386a68 100644
--- a/scalac-scoverage-plugin/src/test/scala/scoverage/macrosupport/Tester.scala
+++ b/scalac-scoverage-plugin/src/test/scala/scoverage/macrosupport/Tester.scala
@@ -4,6 +4,6 @@ import scala.language.experimental.macros
object Tester {
- def test: Unit = macro TesterMacro.test
+// def test: Unit = macro TesterMacro.test
}