Skip to content

add sbt 1.0.0-RC3 support, fixes #216 #229

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

Merged
merged 6 commits into from
Aug 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ pomExtra := {
</developer>
</developers>
}

crossSbtVersions := Vector("0.13.15", "1.0.0-RC2")
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.13
sbt.version=0.13.16-RC1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sbt 0.13.16-RC1 allows to make cross building without plugin. Not sure we should merge it before 0.13.16 final release

10 changes: 10 additions & 0 deletions src/main/scala-sbt-0.13/scoverage/Deps.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package scoverage

import java.io.File

import sbt._
import sbt.{UpdateReport, configurationFilter}

object Deps {
def scoverageDeps(report: UpdateReport, configName: String): Seq[File] = report matching configurationFilter(configName)
}
10 changes: 10 additions & 0 deletions src/main/scala-sbt-1.0/scoverage/Deps.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package scoverage

import java.io.File

import sbt._
import sbt.librarymanagement.UpdateReport

object Deps {
def scoverageDeps(updateReport: UpdateReport, configName: String): Seq[File] = updateReport matching configurationFilter(configName)
}
7 changes: 4 additions & 3 deletions src/main/scala/scoverage/ScoverageSbtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ object ScoverageSbtPlugin extends AutoPlugin {

private lazy val scalacSettings = Seq(
scalacOptions in(Compile, compile) ++= {
val updateReport = update.value
if (coverageEnabled.value) {
val scoverageDeps: Seq[File] = update.value matching configurationFilter(ScoveragePluginConfig.name)
val scoverageDeps: Seq[File] = Deps.scoverageDeps(updateReport, ScoveragePluginConfig.name)
val pluginPath: File = scoverageDeps.find(_.getAbsolutePath.contains(ScalacPluginArtifact)) match {
case None => throw new Exception(s"Fatal: $ScalacPluginArtifact not in libraryDependencies")
case Some(pluginPath) => pluginPath
Expand All @@ -94,8 +95,8 @@ object ScoverageSbtPlugin extends AutoPlugin {

// returns "_sjs$sjsVersion" for Scala.js projects or "" otherwise
private def optionalScalaJsSuffix(deps: Seq[ModuleID]): String = {
val sjsClassifier = deps.collectFirst{
case ModuleID("org.scala-js", "scalajs-library", v, _, _, _, _, _, _, _, _) => v
val sjsClassifier = deps.collectFirst {
case moduleId if moduleId.name == "org.scala-js" && moduleId.organization == "scalajs-library" => moduleId.revision
}.map(_.take(3)).map(sjsVersion => "_sjs" + sjsVersion)

sjsClassifier getOrElse ""
Expand Down