Skip to content

Bump scalac-scoverage-plugin version #323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,7 @@ jobs:
matrix:
java: [ '11' ]
scala: [
{ version: '2.12.13' },
{ version: '2.12.12' },
{ version: '2.12.11' },
{ version: '2.12.10' },
{ version: '2.13.4' },
{ version: '2.13.3' },
{ version: '2.13.2' },
{ version: '2.13.1' },
{ version: '2.13.0' }
{ version: '2.12.13' }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to change this all up in the future. We can't run a matrix like this since it's not doing what we want. Instead in the actual scripted tests we'll want to instead run +test in the test file. This is trying to run the actual plugin in all these versions, which won't work.

]
steps:
- name: checkout the repo
Expand Down
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ resolvers ++= {
if (isSnapshot.value) Seq(Resolver.sonatypeRepo("snapshots")) else Nil
}

libraryDependencies += "org.scoverage" %% "scalac-scoverage-plugin" % "1.4.0"
libraryDependencies +=
"org.scoverage" %% "scalac-scoverage-plugin" % "1.4.3-SNAPSHOT" cross CrossVersion.full

publishMavenStyle := true

publishArtifact in Test := false
Test / publishArtifact := false

scriptedLaunchOpts ++= Seq(
"-Xmx1024M",
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.2.8
sbt.version=1.5.1
15 changes: 8 additions & 7 deletions src/main/scala/scoverage/ScoverageSbtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
val ScalacRuntimeArtifact = "scalac-scoverage-runtime"
val ScalacPluginArtifact = "scalac-scoverage-plugin"
// this should match the version defined in build.sbt
val DefaultScoverageVersion = "1.4.1"
val DefaultScoverageVersion = "1.4.3-SNAPSHOT"
val autoImport = ScoverageKeys
lazy val ScoveragePluginConfig = config("scoveragePlugin").hide

Expand Down Expand Up @@ -48,7 +48,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
ivyConfigurations += ScoveragePluginConfig,
coverageReport := coverageReport0.value,
coverageAggregate := coverageAggregate0.value,
aggregate in coverageAggregate := false
coverageAggregate / aggregate := false
) ++ coverageSettings ++ scalacSettings

private lazy val coverageSettings = Seq(
Expand All @@ -57,7 +57,8 @@ object ScoverageSbtPlugin extends AutoPlugin {
Seq(
// We only add for "compile" because of macros. This setting could be optimed to just "test" if the handling
// of macro coverage was improved.
(OrgScoverage %% (scalacRuntime(libraryDependencies.value)) % coverageScalacPluginVersion.value).cross(CrossVersion.full),
(OrgScoverage %% ScalacRuntimeArtifact % coverageScalacPluginVersion.value).cross(CrossVersion.full),
//(OrgScoverage %% (scalacRuntime(libraryDependencies.value)) % coverageScalacPluginVersion.value).cross(CrossVersion.full),
// We don't want to instrument the test code itself, nor add to a pom when published with coverage enabled.
(OrgScoverage %% ScalacPluginArtifact % coverageScalacPluginVersion.value % ScoveragePluginConfig.name).cross(CrossVersion.full)
)
Expand All @@ -67,7 +68,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
)

private lazy val scalacSettings = Seq(
scalacOptions in(Compile, compile) ++= {
Compile / compile / scalacOptions ++= {
val updateReport = update.value
if (coverageEnabled.value) {
val scoverageDeps: Seq[File] = updateReport matching configurationFilter(ScoveragePluginConfig.name)
Expand Down Expand Up @@ -113,14 +114,14 @@ object ScoverageSbtPlugin extends AutoPlugin {
case Some(cov) =>
writeReports(
target,
(sourceDirectories in Compile).value,
(Compile / sourceDirectories).value,
cov,
coverageOutputCobertura.value,
coverageOutputXML.value,
coverageOutputHTML.value,
coverageOutputDebug.value,
coverageOutputTeamCity.value,
sourceEncoding((scalacOptions in (Compile)).value),
sourceEncoding((Compile / scalacOptions).value),
log)

checkCoverage(cov, log, coverageMinimum.value, coverageFailOnMinimum.value)
Expand All @@ -144,7 +145,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
coverageOutputHTML.value,
coverageOutputDebug.value,
coverageOutputTeamCity.value,
sourceEncoding((scalacOptions in (Compile)).value),
sourceEncoding((Compile / scalacOptions).value),
log)
val cfmt = cov.statementCoverageFormatted
log.info(s"Aggregation complete. Coverage was [$cfmt]")
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/scoverage/aggregate-only/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
lazy val commonSettings = Seq(
organization := "org.scoverage",
version := "0.1.0",
scalaVersion := "2.12.8"
scalaVersion := "2.12.13"
)

lazy val specs2Lib = "org.specs2" %% "specs2" % "2.5" % "test"
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/scoverage/aggregate/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
lazy val commonSettings = Seq(
organization := "org.scoverage",
version := "0.1.0",
scalaVersion := "2.12.8"
scalaVersion := "2.12.13"
)

lazy val specs2Lib = "org.specs2" %% "specs2" % "2.5" % "test"
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/scoverage/bad-coverage/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version := "0.1"

scalaVersion := "2.12.8"
scalaVersion := "2.12.13"

libraryDependencies += "org.specs2" %% "specs2" % "2.5" % "test"

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/scoverage/coverage-off/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version := "0.1"

scalaVersion := "2.12.8"
scalaVersion := "2.12.13"

libraryDependencies += "org.specs2" %% "specs2" % "2.5" % "test"

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/scoverage/good-coverage/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version := "0.1"

scalaVersion := "2.12.8"
scalaVersion := "2.12.13"

libraryDependencies += "org.specs2" %% "specs2" % "2.5" % "test"

Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/scoverage/preserve-set/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import sbt.complete.DefaultParsers._

version := "0.1"

scalaVersion := "2.12.8"
scalaVersion := "2.12.13"

crossScalaVersions := Seq("2.10.6", "2.12.8")
crossScalaVersions := Seq("2.10.6", "2.12.13")

libraryDependencies += "org.specs2" %% "specs2" % "2.5" % "test"

Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/scoverage/preserve-set/test
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# check scalaVersion setting
> checkScalaVersion "2.12.8"
> checkScalaVersion "2.12.13"
> checkScoverageEnabled "false"
> coverage
> checkScoverageEnabled "true"
> coverageOff
> checkScalaVersion "2.12.8"
> checkScalaVersion "2.12.13"
> checkScoverageEnabled "false"
# changs scala version
> ++2.10.6
Expand Down
5 changes: 2 additions & 3 deletions src/sbt-test/scoverage/scalajs/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import sbtcrossproject.CrossType
lazy val root = (project in file(".")).aggregate(crossJS, crossJVM)

lazy val cross = CrossProject("sjstest", file("sjstest"))(JVMPlatform, JSPlatform)
.crossType(CrossType.Full)
.settings(
scalaVersion := "2.12.8",
scalaVersion := "2.13.5",
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.0.0" % "test"
"org.scalatest" %%% "scalatest" % "3.2.8" % "test"
)
)

Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/scoverage/scalajs/project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ resolvers ++= {
Seq.empty
}

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.27")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.scalatest.{FlatSpec, Matchers}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class JsTest extends FlatSpec with Matchers {
class JsTest extends AnyFlatSpec with Matchers {

"JS UnderTest" should "work on JS" in {
UnderTest.jsMethod shouldBe "js"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.scalatest.{FlatSpec, Matchers}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class JvmTest extends FlatSpec with Matchers {
class JvmTest extends AnyFlatSpec with Matchers {

"JVM UnderTest" should "work on JVM" in {
UnderTest.jvmMethod shouldBe "jvm"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.scalatest.{FlatSpec, Matchers}
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class SharedTest extends FlatSpec with Matchers {
class SharedTest extends AnyFlatSpec with Matchers {

"Shared UnderTest" should "return where it works" in {
UnderTest.onJsAndJvm shouldBe "js and jvm"
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "1.6.2-SNAPSHOT"
(ThisBuild / version) := "1.6.2-SNAPSHOT"