mirror of https://github.com/sbt/sbt.git
Merge pull request #2485 from eed3si9n/fport/2345
FPORT: Maven compatibility changes + Adds CompatibilityWarningOptions
This commit is contained in:
commit
e79f1b3a15
|
|
@ -1136,6 +1136,7 @@ object Classpaths {
|
|||
|
||||
private[this] def baseGlobalDefaults = Defaults.globalDefaults(Seq(
|
||||
conflictWarning :== ConflictWarning.default("global"),
|
||||
compatibilityWarningOptions :== CompatibilityWarningOptions.default,
|
||||
homepage :== None,
|
||||
startYear :== None,
|
||||
licenses :== Nil,
|
||||
|
|
@ -1442,6 +1443,8 @@ object Classpaths {
|
|||
val logicalClock = LogicalClock(st.hashCode)
|
||||
val depDir = dependencyCacheDirectory.value
|
||||
val uc0 = updateConfiguration.value
|
||||
val ms = publishMavenStyle.value
|
||||
val cw = compatibilityWarningOptions.value
|
||||
// Normally, log would capture log messages at all levels.
|
||||
// Ivy logs are treated specially using sbt.UpdateConfiguration.logging.
|
||||
// This code bumps up the sbt.UpdateConfiguration.logging to Full when logLevel is Debug.
|
||||
|
|
@ -1457,17 +1460,18 @@ object Classpaths {
|
|||
cachedUpdate(s.cacheDirectory / updateCacheName.value, show, ivyModule.value, uc, transform,
|
||||
skip = (skip in update).value, force = isRoot || forceUpdateByTime, depsUpdated = depsUpdated,
|
||||
uwConfig = uwConfig, logicalClock = logicalClock, depDir = Some(depDir),
|
||||
ewo = ewo, log = s.log)
|
||||
ewo = ewo, mavenStyle = ms, compatWarning = cw, log = s.log)
|
||||
}
|
||||
@deprecated("Use cachedUpdate with the variant that takes unresolvedHandler instead.", "0.13.6")
|
||||
def cachedUpdate(cacheFile: File, label: String, module: IvySbt#Module, config: UpdateConfiguration,
|
||||
transform: UpdateReport => UpdateReport, skip: Boolean, force: Boolean, depsUpdated: Boolean, log: Logger): UpdateReport =
|
||||
cachedUpdate(cacheFile, label, module, config, transform, skip, force, depsUpdated,
|
||||
UnresolvedWarningConfiguration(), LogicalClock.unknown, None, EvictionWarningOptions.empty, log)
|
||||
UnresolvedWarningConfiguration(), LogicalClock.unknown, None, EvictionWarningOptions.empty, true, CompatibilityWarningOptions.default, log)
|
||||
private[sbt] def cachedUpdate(cacheFile: File, label: String, module: IvySbt#Module, config: UpdateConfiguration,
|
||||
transform: UpdateReport => UpdateReport, skip: Boolean, force: Boolean, depsUpdated: Boolean,
|
||||
uwConfig: UnresolvedWarningConfiguration, logicalClock: LogicalClock, depDir: Option[File],
|
||||
ewo: EvictionWarningOptions, log: Logger): UpdateReport =
|
||||
ewo: EvictionWarningOptions, mavenStyle: Boolean, compatWarning: CompatibilityWarningOptions,
|
||||
log: Logger): UpdateReport =
|
||||
{
|
||||
implicit val updateCache = updateIC
|
||||
type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil
|
||||
|
|
@ -1486,6 +1490,7 @@ object Classpaths {
|
|||
val ew = EvictionWarning(module, ewo, result, log)
|
||||
ew.lines foreach { log.warn(_) }
|
||||
ew.infoAllTheThings foreach { log.info(_) }
|
||||
val cw = CompatibilityWarning.run(compatWarning, module, mavenStyle, log)
|
||||
result
|
||||
}
|
||||
def uptodate(inChanged: Boolean, out: UpdateReport): Boolean =
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import sbt.librarymanagement.{
|
|||
UpdateReport
|
||||
}
|
||||
import sbt.internal.librarymanagement.{
|
||||
CompatibilityWarningOptions,
|
||||
DeliverConfiguration,
|
||||
GetClassifiersModule,
|
||||
IvyConfiguration,
|
||||
|
|
@ -376,6 +377,7 @@ object Keys {
|
|||
val forceUpdatePeriod = SettingKey[Option[FiniteDuration]]("force-update-period", "Duration after which to force a full update to occur", CSetting)
|
||||
|
||||
val classifiersModule = TaskKey[GetClassifiersModule]("classifiers-module", rank = CTask)
|
||||
val compatibilityWarningOptions = SettingKey[CompatibilityWarningOptions]("compatibility-warning", "Configures warnings around Maven incompatibility.", CSetting)
|
||||
val conflictWarning = SettingKey[ConflictWarning]("conflict-warning", "Configures warnings for conflicts in dependency management.", CSetting)
|
||||
val conflictManager = SettingKey[ConflictManager]("conflict-manager", "Selects the conflict manager to use for dependency management.", CSetting)
|
||||
val autoScalaLibrary = SettingKey[Boolean]("auto-scala-library", "Adds a dependency on scala-library if true.", ASetting)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
### Improvements
|
||||
|
||||
- Scala version used by the build is updated to 2.10.6. [#2311][2311] by [@eed3si9n][@eed3si9n]
|
||||
- `makePom` warns when it sees intransitive dependencies, which do not translate to Maven. [#2127][2127] by [@jsuereth][@jsuereth]
|
||||
- If `publishMavenStyle` is `true`, `update` task warns when it sees intransitive dependencies, which do not translate to Maven. [#2127][2127] by [@jsuereth][@jsuereth]
|
||||
- Adds `Def.settings`, which facilitates mixing settings with seq of settings. See below.
|
||||
- sbt Serialization is updated to 0.1.2. [2117][#2117] by [@dwijnand][@dwijnand]
|
||||
- Hides the stack trace on compilation error in build definition. [#2071][2071]/[#2091][2091] by [@Duhemm][@Duhemm]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
lazy val check = taskKey[Unit]("Runs the check")
|
||||
|
||||
def commonSettings: Seq[Def.Setting[_]] =
|
||||
Seq(
|
||||
ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),
|
||||
scalaVersion in ThisBuild := "2.11.7",
|
||||
organization in ThisBuild := "com.example",
|
||||
version in ThisBuild := "0.1.0-SNAPSHOT",
|
||||
autoScalaLibrary := false,
|
||||
crossPaths := false
|
||||
)
|
||||
|
||||
lazy val realCommonsIoClient = project.
|
||||
settings(
|
||||
commonSettings,
|
||||
name := "a",
|
||||
libraryDependencies := Seq(
|
||||
"commons-io" % "commons-io" % "1.3"
|
||||
),
|
||||
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project")
|
||||
)
|
||||
|
||||
lazy val fakeCommonsIo = project.
|
||||
settings(
|
||||
commonSettings,
|
||||
organization := "commons-io",
|
||||
name := "commons-io",
|
||||
version := "1.3"
|
||||
)
|
||||
|
||||
lazy val fakeCommonsIoClient = project.
|
||||
dependsOn(fakeCommonsIo % "test->test").
|
||||
settings(
|
||||
commonSettings,
|
||||
name := "c"
|
||||
)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
> realCommonsIoClient/update
|
||||
|
||||
> fakeCommonsIoClient/update
|
||||
|
|
@ -1,19 +1,22 @@
|
|||
scalaVersion := "2.10.2"
|
||||
|
||||
libraryDependencies += "org.scala-sbt" %% "sbinary" % "0.4.1" withSources() withJavadoc()
|
||||
libraryDependencies += "org.scala-sbt" % "io" % "0.13.8" intransitive()
|
||||
|
||||
lazy val checkPom = taskKey[Unit]("check pom to ensure no <type> sections are generated")
|
||||
|
||||
checkPom := {
|
||||
val pomFile = makePom.value
|
||||
val pom = xml.XML.loadFile(pomFile)
|
||||
val tpe = pom \\ "type"
|
||||
if(tpe.nonEmpty) {
|
||||
sys.error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
||||
}
|
||||
val dir = (streams in makePom).value.cacheDirectory / "out"
|
||||
val lines = IO.readLines(dir)
|
||||
val hasError = lines exists { line => line contains "Translating intransitive dependency "}
|
||||
assert(hasError, s"Failed to detect intransitive dependencies, got: ${lines.mkString("\n")}")
|
||||
}
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
scalaVersion := "2.10.6",
|
||||
libraryDependencies += "org.scala-tools.sbinary" %% "sbinary" % "0.4.1" withSources() withJavadoc(),
|
||||
libraryDependencies += "org.scala-sbt" % "io" % "0.13.8" intransitive(),
|
||||
checkPom := {
|
||||
val pomFile = makePom.value
|
||||
val pom = xml.XML.loadFile(pomFile)
|
||||
val tpe = pom \\ "type"
|
||||
if(tpe.nonEmpty) {
|
||||
sys.error("Expected no <type> sections, got: " + tpe + " in \n\n" + pom)
|
||||
}
|
||||
val ur = update.value
|
||||
val dir = (streams in update).value.cacheDirectory / "out"
|
||||
val lines = IO.readLines(dir)
|
||||
val hasError = lines exists { line => line contains "Found intransitive dependency "}
|
||||
assert(hasError, s"Failed to detect intransitive dependencies, got: ${lines.mkString("\n")}")
|
||||
},
|
||||
resolvers += Resolver.typesafeIvyRepo("releases")
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
> checkPom
|
||||
|
|
@ -0,0 +1 @@
|
|||
> checkPom
|
||||
Loading…
Reference in New Issue