mirror of https://github.com/sbt/sbt.git
Merge pull request #2703 from milessabin/topic/scala-artifacts-fixed
Explicit list of artifacts for Scala binary version check
This commit is contained in:
commit
5b70e9f4e0
|
|
@ -20,6 +20,7 @@ object ScalaArtifacts {
|
|||
val ReflectID = "scala-reflect"
|
||||
val ActorsID = "scala-actors"
|
||||
val ScalapID = "scalap"
|
||||
val Artifacts = Seq(LibraryID, CompilerID, ReflectID, ActorsID, ScalapID)
|
||||
val DottyIDPrefix = "dotty"
|
||||
|
||||
def dottyID(binaryVersion: String): String = s"${DottyIDPrefix}_${binaryVersion}"
|
||||
|
|
@ -102,11 +103,10 @@ private object IvyScala {
|
|||
val id = dep.getDependencyRevisionId
|
||||
val depBinaryVersion = CrossVersion.binaryScalaVersion(id.getRevision)
|
||||
def isScalaLangOrg = id.getOrganisation == scalaOrganization
|
||||
def isNotScalaActorsMigration = !(id.getName startsWith "scala-actors-migration") // Exception to the rule: sbt/sbt#1818
|
||||
def isNotScalaPickling = !(id.getName startsWith "scala-pickling") // Exception to the rule: sbt/sbt#1899
|
||||
def isScalaArtifact = Artifacts.contains(id.getName)
|
||||
def hasBinVerMismatch = depBinaryVersion != scalaBinaryVersion
|
||||
def matchesOneOfTheConfigs = dep.getModuleConfigurations.exists(configSet)
|
||||
val mismatched = isScalaLangOrg && isNotScalaActorsMigration && isNotScalaPickling && hasBinVerMismatch && matchesOneOfTheConfigs
|
||||
val mismatched = isScalaLangOrg && isScalaArtifact && hasBinVerMismatch && matchesOneOfTheConfigs
|
||||
if (mismatched)
|
||||
Some("Binary version (" + depBinaryVersion + ") for dependency " + id +
|
||||
"\n\tin " + module.getModuleRevisionId +
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
scalaOrganization := "org.other"
|
||||
|
||||
scalaVersion := "2.11.8"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"org.other" %% "thing" % "1.2.3"
|
||||
)
|
||||
|
||||
lazy val check = taskKey[Unit]("Runs the check")
|
||||
|
||||
check := {
|
||||
val lastLog = BuiltinCommands lastLogFile state.value
|
||||
val last = IO read lastLog.get
|
||||
def containsWarn1 = last contains "Binary version (1.2.3) for dependency org.other#thing_2.11;1.2.3"
|
||||
def containsWarn2 = last contains "differs from Scala binary version in project (2.11)."
|
||||
if (containsWarn1) sys error "thing should be exempted from the Scala binary version check"
|
||||
if (containsWarn2) sys error "Binary version check failed"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
> clean
|
||||
|
||||
> check
|
||||
Loading…
Reference in New Issue