mirror of https://github.com/sbt/sbt.git
Configurable explicit list of artifacts for Scala binary version check
This commit is contained in:
parent
b47f281c6a
commit
56e843960b
|
|
@ -155,6 +155,7 @@ object Defaults extends BuildCommon {
|
|||
retrieveManagedSync :== false,
|
||||
configurationsToRetrieve :== None,
|
||||
scalaOrganization :== ScalaArtifacts.Organization,
|
||||
scalaArtifacts :== ScalaArtifacts.Artifacts,
|
||||
sbtResolver := { if (sbtVersion.value endsWith "-SNAPSHOT") Classpaths.sbtIvySnapshots else Classpaths.typesafeReleases },
|
||||
crossVersion :== Disabled(),
|
||||
buildDependencies := Classpaths.constructBuildDependencies.value,
|
||||
|
|
@ -1431,7 +1432,9 @@ object Classpaths {
|
|||
(scalaVersion in update).value,
|
||||
(scalaBinaryVersion in update).value,
|
||||
Vector.empty, filterImplicit = false, checkExplicit = true, overrideScalaVersion = true
|
||||
).withScalaOrganization(scalaOrganization.value))
|
||||
)
|
||||
.withScalaOrganization(scalaOrganization.value)
|
||||
.withScalaArtifacts(scalaArtifacts.value))
|
||||
}
|
||||
)).value,
|
||||
artifactPath in makePom := artifactPathSetting(artifact in makePom).value,
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ object Keys {
|
|||
val printWarnings = TaskKey[Unit]("print-warnings", "Shows warnings from compilation, including ones that weren't printed initially.", BPlusTask)
|
||||
val fileInputOptions = SettingKey[Seq[String]]("file-input-options", "Options that take file input, which may invalidate the cache.", CSetting)
|
||||
val scalaCompilerBridgeSource = SettingKey[ModuleID]("scala-compiler-bridge-source", "Configures the module ID of the sources of the compiler bridge.", CSetting)
|
||||
val scalaArtifacts = SettingKey[Vector[String]]("scala-artifacts", "Configures the list of artifacts which should match the Scala binary version", CSetting)
|
||||
|
||||
val clean = TaskKey[Unit]("clean", "Deletes files produced by the build, such as generated sources, compiled classes, and task caches.", APlusTask)
|
||||
val console = TaskKey[Unit]("console", "Starts the Scala interpreter with the project classes on the classpath.", APlusTask)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
scalaOrganization := "org.other"
|
||||
|
||||
scalaArtifacts += "thing"
|
||||
|
||||
scalaVersion := "2.11.8"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"org.other" % "thing" % "1.2.3",
|
||||
"org.other" %% "wotsit" % "4.5.6"
|
||||
)
|
||||
|
||||
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;1.2.3"
|
||||
def containsWarn2 = last contains "Binary version (4.5.6) for dependency org.other#wotsit_2.11;4.5.6"
|
||||
def containsWarn3 = last contains "differs from Scala binary version in project (2.11)."
|
||||
if (!containsWarn1) sys error "thing should not be exempted from the Scala binary version check"
|
||||
if (containsWarn2) sys error "wotsit should be exempted from the Scala binary version check"
|
||||
if (!containsWarn3) sys error "Binary version check failed"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
> clean
|
||||
|
||||
> check
|
||||
Loading…
Reference in New Issue