From c1760fdc3c41b3d0971573a4776e68ec0261f4fc Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Wed, 30 Dec 2015 13:41:31 -0500 Subject: [PATCH] Move intransitive warning to update. Ref #2127 --- main/src/main/scala/sbt/Defaults.scala | 8 ++-- notes/0.13.10.markdown | 2 +- .../dependency-management/pom-type/build.sbt | 37 ++++++++++--------- .../dependency-management/pom-type/pending | 2 +- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index ca3f7d988..35e0416b4 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -1442,6 +1442,7 @@ object Classpaths { val logicalClock = LogicalClock(st.hashCode) val depDir = dependencyCacheDirectory.value val uc0 = updateConfiguration.value + val ms = publishMavenStyle.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 +1458,17 @@ 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, 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, 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, log: Logger): UpdateReport = { implicit val updateCache = updateIC type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil @@ -1486,6 +1487,7 @@ object Classpaths { val ew = EvictionWarning(module, ewo, result, log) ew.lines foreach { log.warn(_) } ew.infoAllTheThings foreach { log.info(_) } + val cw = CompatibilityWarning(module, mavenStyle, log) result } def uptodate(inChanged: Boolean, out: UpdateReport): Boolean = diff --git a/notes/0.13.10.markdown b/notes/0.13.10.markdown index 8e19fa621..7f1cf76b7 100644 --- a/notes/0.13.10.markdown +++ b/notes/0.13.10.markdown @@ -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] diff --git a/sbt/src/sbt-test/dependency-management/pom-type/build.sbt b/sbt/src/sbt-test/dependency-management/pom-type/build.sbt index 79af2c7af..b83e9fbbb 100644 --- a/sbt/src/sbt-test/dependency-management/pom-type/build.sbt +++ b/sbt/src/sbt-test/dependency-management/pom-type/build.sbt @@ -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 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 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")}") -} \ No newline at end of file +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 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") + ) diff --git a/sbt/src/sbt-test/dependency-management/pom-type/pending b/sbt/src/sbt-test/dependency-management/pom-type/pending index 0e9f0f7b6..8d831496e 100644 --- a/sbt/src/sbt-test/dependency-management/pom-type/pending +++ b/sbt/src/sbt-test/dependency-management/pom-type/pending @@ -1 +1 @@ -> checkPom \ No newline at end of file +> checkPom