Skip to content

Commit 4dffb6c

Browse files
author
exoego
committed
Pass scalajs-library.ja to the -classpath setting of the compiler
So that it ends up on the classpath of the project being compiled instead.
1 parent e78faf7 commit 4dffb6c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package scoverage
33
import java.io.{File, FileNotFoundException}
44
import java.net.URL
55

6-
import scoverage.ScoverageCompiler.getScalaJsJars
7-
86
import scala.collection.mutable.ListBuffer
97
import scala.tools.nsc.{Settings, Global}
108
import scala.tools.nsc.plugins.PluginComponent
@@ -19,8 +17,8 @@ object ScoverageCompiler {
1917
case _ => ScalaVersion
2018
}
2119

22-
def classPath = (getScalaJars ++ getScalaJsJars ++ List(sbtCompileDir, runtimeClasses)).map(_.getAbsolutePath)
23-
20+
def classPath = getScalaJars.map(_.getAbsolutePath) :+ sbtCompileDir.getAbsolutePath :+ runtimeClasses.getAbsolutePath
21+
2422
def settings: Settings = {
2523
val s = new scala.tools.nsc.Settings
2624
s.Xprint.value = List("all", "_")
@@ -50,11 +48,6 @@ object ScoverageCompiler {
5048
scalaJars.map(findScalaJar)
5149
}
5250

53-
private def getScalaJsJars: List[File] = {
54-
val scalaJars = List("scalajs-library")
55-
scalaJars.map(findScalaJsJar)
56-
}
57-
5851
private def sbtCompileDir: File = {
5952
val dir = new File(s"./scalac-scoverage-plugin/target/scala-$ShortScalaVersion/classes")
6053
if (!dir.exists)
@@ -66,8 +59,6 @@ object ScoverageCompiler {
6659

6760
private def findScalaJar(artifactId: String): File = findIvyJar("org.scala-lang", artifactId, ScalaVersion)
6861

69-
private def findScalaJsJar(artifactId: String): File = findIvyJar(s"org.scala-js", s"${artifactId}_${ShortScalaVersion}", "0.6.28")
70-
7162
private def findIvyJar(groupId: String, artifactId: String, version: String, packaging: String = "jar"): File = {
7263
val userHome = System.getProperty("user.home")
7364
val jarPath = s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar"
@@ -84,6 +75,8 @@ class ScoverageCompiler(settings: scala.tools.nsc.Settings, rep: scala.tools.nsc
8475
def addToClassPath(file: File): Unit = {
8576
settings.classpath.value = settings.classpath.value + File.pathSeparator + file.getAbsolutePath
8677
}
78+
79+
addToClassPath(ScoverageCompiler.findIvyJar(s"org.scala-js", s"scalajs-library_${ScoverageCompiler.ShortScalaVersion}", "0.6.28"))
8780

8881
val instrumentationComponent = new ScoverageInstrumentationComponent(this, None, None)
8982
instrumentationComponent.setOptions(new ScoverageOptions())

0 commit comments

Comments
 (0)