From 9857b5f61a4b39643171c4ff2f255b979c53e041 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:07:33 -0600 Subject: [PATCH 01/12] Fixing tests on CI --- .../src/test/scala/scoverage/ScoverageCompiler.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala index 27a824e5..57efc59d 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala @@ -2,9 +2,10 @@ package scoverage import java.io.{File, FileNotFoundException} import java.net.URL +import java.nio.file.{Path, Paths} 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} @@ -61,6 +62,7 @@ object ScoverageCompiler { private def findIvyJar(groupId: String, artifactId: String, version: String, packaging: String = "jar"): File = { val userHome = System.getProperty("user.home") + Paths.get(s"$userHome/.ivy2/cache").toFile.listFiles().foreach(println) val jarPath = s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar" val file = new File(jarPath) if (!file.exists) From 21c2f687dca892b65495c718e2406128171b33e0 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:12:41 -0600 Subject: [PATCH 02/12] Fixing tests on CI --- .../src/test/scala/scoverage/ScoverageCompiler.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala index 57efc59d..8f715298 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala @@ -62,7 +62,7 @@ object ScoverageCompiler { private def findIvyJar(groupId: String, artifactId: String, version: String, packaging: String = "jar"): File = { val userHome = System.getProperty("user.home") - Paths.get(s"$userHome/.ivy2/cache").toFile.listFiles().foreach(println) + Paths.get(s"$userHome/.ivy2/cache/$groupId").toFile.listFiles().foreach(println) val jarPath = s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar" val file = new File(jarPath) if (!file.exists) From 0ac1fec706c221956e3b706583bb1b906ce01356 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:16:02 -0600 Subject: [PATCH 03/12] Fixing tests on CI --- .../src/test/scala/scoverage/ScoverageCompiler.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala index 8f715298..10b19d2a 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala @@ -62,7 +62,7 @@ object ScoverageCompiler { private def findIvyJar(groupId: String, artifactId: String, version: String, packaging: String = "jar"): File = { val userHome = System.getProperty("user.home") - Paths.get(s"$userHome/.ivy2/cache/$groupId").toFile.listFiles().foreach(println) + Paths.get(s"$userHome/.ivy2/cache/$groupId/$artifactId").toFile.listFiles().foreach(println) val jarPath = s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar" val file = new File(jarPath) if (!file.exists) From 0ca5f0251f4a5ee839e0fb9ed8431d1bf2a28bfe Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:24:31 -0600 Subject: [PATCH 04/12] Fixing tests on CI --- .../src/test/scala/scoverage/ScoverageCompiler.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala index 10b19d2a..0a7eb5cf 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala @@ -62,7 +62,7 @@ object ScoverageCompiler { private def findIvyJar(groupId: String, artifactId: String, version: String, packaging: String = "jar"): File = { val userHome = System.getProperty("user.home") - Paths.get(s"$userHome/.ivy2/cache/$groupId/$artifactId").toFile.listFiles().foreach(println) + Paths.get(s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s").toFile.listFiles().foreach(println) val jarPath = s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar" val file = new File(jarPath) if (!file.exists) From 93f7fa9b2ba1088d9bfda401947e7dc637464856 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:38:50 -0600 Subject: [PATCH 05/12] Fixing tests on CI --- .github/workflows/release.yml | 2 +- .travis.yml | 2 +- build.sbt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d243cad..d298d1d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,7 @@ jobs: echo "email: ${{ steps.import_gpg.outputs.email }}" - name: publish release - run: sbt ++2.12.10 publishSigned + run: sbt ++2.12.12 publishSigned env: RELEASE_VERSION: ${{ github.event.inputs.version }} OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} 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..12081a3c 100644 --- a/build.sbt +++ b/build.sbt @@ -10,7 +10,7 @@ val ScalatestVersion = "3.1.1" val appSettings = Seq( organization := Org, - scalaVersion := "2.13.3", + scalaVersion := "2.12.12", crossScalaVersions := Seq("2.12.12", "2.13.3"), fork in Test := false, publishMavenStyle := true, @@ -94,6 +94,6 @@ lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plug ) ) .settings( - unmanagedSourceDirectories in Test += (sourceDirectory in Test).value / "scala-2.11+" + unmanagedSourceDirectories in Test += (sourceDirectory in Test).value / "scala-2.12+" ) From d90cbb2362b3462458f454b6e9a17f9569ca120f Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:42:55 -0600 Subject: [PATCH 06/12] Fixing tests on CI --- .../src/test/scala/scoverage/macrosupport/Tester.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } From f3f6e85b5eac8ebdd4d2608a824ad426e95798dc Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:47:21 -0600 Subject: [PATCH 07/12] Fixing tests on CI --- .github/workflows/build.yml | 2 +- .github/workflows/pr.yml | 2 +- .github/workflows/release.yml | 2 +- build.sbt | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) 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/.github/workflows/release.yml b/.github/workflows/release.yml index d298d1d3..2d243cad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,7 @@ jobs: echo "email: ${{ steps.import_gpg.outputs.email }}" - name: publish release - run: sbt ++2.12.12 publishSigned + run: sbt ++2.12.10 publishSigned env: RELEASE_VERSION: ${{ github.event.inputs.version }} OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} diff --git a/build.sbt b/build.sbt index 12081a3c..baab29f1 100644 --- a/build.sbt +++ b/build.sbt @@ -10,8 +10,8 @@ val ScalatestVersion = "3.1.1" val appSettings = Seq( organization := Org, - scalaVersion := "2.12.12", - 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, From 61d9f2437d6ade9620926cd403d5143b70473ba7 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:47:51 -0600 Subject: [PATCH 08/12] Fixing tests on CI --- .../src/test/scala/scoverage/ScoverageCompiler.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala index 0a7eb5cf..fc11c610 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala @@ -63,6 +63,7 @@ object ScoverageCompiler { private def findIvyJar(groupId: String, artifactId: String, version: String, packaging: String = "jar"): File = { val userHome = System.getProperty("user.home") Paths.get(s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s").toFile.listFiles().foreach(println) + println(s"Trying to load $userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar") val jarPath = s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar" val file = new File(jarPath) if (!file.exists) From c2dfc17767967bf6c80a826ed2717e1eaf4c5c04 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 20:56:49 -0600 Subject: [PATCH 09/12] Fixing tests on CI --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index baab29f1..ad3891be 100644 --- a/build.sbt +++ b/build.sbt @@ -90,7 +90,7 @@ lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plug 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.scala-lang" % "scala-compiler" % scalaVersion.value % Compile ) ) .settings( From ff5e73f41e489f14e8767c59230ca9beaa482a8e Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 21:02:36 -0600 Subject: [PATCH 10/12] Fixing tests on CI --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ad3891be..604f3281 100644 --- a/build.sbt +++ b/build.sbt @@ -90,7 +90,7 @@ lazy val plugin = Project("scalac-scoverage-plugin", file("scalac-scoverage-plug libraryDependencies ++= Seq( "org.scala-lang.modules" %% "scala-xml" % "1.2.0", "org.scalatest" %% "scalatest" % ScalatestVersion % Test, - "org.scala-lang" % "scala-compiler" % scalaVersion.value % Compile + "org.scala-lang" % "scala-compiler" % scalaVersion.value ) ) .settings( From c00ddfd939c3c7e7861e559fc1be7f02870ad9f7 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 21:24:14 -0600 Subject: [PATCH 11/12] Fixing tests on CI --- build.sbt | 6 +++-- .../scala/scoverage/ScoverageCompiler.scala | 26 ++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/build.sbt b/build.sbt index 604f3281..5090de82 100644 --- a/build.sbt +++ b/build.sbt @@ -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 + ), pomExtra := { https://github.com/scoverage/scalac-scoverage-plugin @@ -89,8 +92,7 @@ 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 + "org.scalatest" %% "scalatest" % ScalatestVersion % Test ) ) .settings( diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala index fc11c610..8dc1fed4 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala @@ -2,7 +2,6 @@ package scoverage import java.io.{File, FileNotFoundException} import java.net.URL -import java.nio.file.{Path, Paths} import scala.collection.mutable.ListBuffer import scala.tools.nsc.{Global, Settings} @@ -15,7 +14,7 @@ object ScoverageCompiler { val ScalaVersion = scala.util.Properties.versionNumberString val ShortScalaVersion = (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 @@ -58,17 +57,26 @@ 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/$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") - Paths.get(s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s").toFile.listFiles().foreach(println) - println(s"Trying to load $userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar") + // println(s"Trying to load $userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar") 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 } } From e3297b41a577ee44658901e1947781ffae7cfea4 Mon Sep 17 00:00:00 2001 From: sksamuel Date: Sun, 15 Nov 2020 21:28:47 -0600 Subject: [PATCH 12/12] Fixing tests on CI --- build.sbt | 2 +- .../src/test/scala/scoverage/ScoverageCompiler.scala | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 5090de82..6005c089 100644 --- a/build.sbt +++ b/build.sbt @@ -25,7 +25,7 @@ val appSettings = Seq( Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2") }, libraryDependencies ++= Seq( - "org.scala-lang" % "scala-compiler" % scalaVersion.value + "org.scala-lang" % "scala-compiler" % scalaVersion.value % Compile ), pomExtra := { https://github.com/scoverage/scalac-scoverage-plugin diff --git a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala index 8dc1fed4..a5440a76 100644 --- a/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala +++ b/scalac-scoverage-plugin/src/test/scala/scoverage/ScoverageCompiler.scala @@ -8,16 +8,16 @@ 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 } - 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 @@ -66,14 +66,13 @@ object ScoverageCompiler { 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/$artifactId-$version.jar" + 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"): Option[File] = { val userHome = System.getProperty("user.home") - // println(s"Trying to load $userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar") val jarPath = s"$userHome/.ivy2/cache/$groupId/$artifactId/${packaging}s/$artifactId-$version.jar" val file = new File(jarPath) if (file.exists()) Some(file) else None