diff options
-rw-r--r-- | build.sbt | 31 | ||||
-rw-r--r-- | project/VersionUtil.scala | 2 | ||||
-rw-r--r-- | scripts/common | 4 | ||||
-rw-r--r-- | src/library/scala/collection/SeqLike.scala | 2 | ||||
-rw-r--r-- | src/manual/scala/man1/scala.scala | 7 | ||||
-rw-r--r-- | test/benchmarks/project/plugins.sbt | 2 | ||||
-rw-r--r-- | test/junit/scala/collection/SeqLikeTest.scala | 19 |
7 files changed, 47 insertions, 20 deletions
@@ -463,7 +463,7 @@ lazy val replJlineEmbedded = Project("repl-jline-embedded", file(".") / "target" import collection.JavaConverters._ val inputs: Iterator[JarJar.Entry] = { val repljlineClasses = (products in Compile in replJline).value.flatMap(base => Path.allSubpaths(base).map(x => (base, x._1))) - val jlineJAR = (dependencyClasspath in Compile).value.find(_.get(moduleID.key) == Some(jlineDep)).get.data + val jlineJAR = findJar((dependencyClasspath in Compile).value, jlineDep).get.data val jarFile = new JarFile(jlineJAR) val jarEntries = jarFile.entries.asScala.filterNot(_.isDirectory).map(entry => JarJar.JarEntryInput(jarFile, entry)) def compiledClasses = repljlineClasses.iterator.map { case (base, file) => JarJar.FileInput(base, file) } @@ -795,25 +795,30 @@ lazy val root: Project = (project in file(".")) k.scope.config.toOption.map(_.name + ":"), k.scope.task.toOption.map(_.label + "::") ).flatten.mkString + k.key - def logIncomplete(i: Incomplete, prefix: String): Unit = { + val loggedThis, loggedAny = new scala.collection.mutable.HashSet[String] + def findRootCauses(i: Incomplete, currentTask: String): Vector[(String, Option[Throwable])] = { val sk = i.node match { case Some(t: Task[_]) => t.info.attributes.entries.collect { case e if e.key == Keys.taskDefinitionKey => e.value.asInstanceOf[Def.ScopedKey[_]] } .headOption.map(showScopedKey) case _ => None } - val childCount = (if(i.directCause.isDefined) 1 else 0) + i.causes.length - val skip = childCount <= 1 && sk.isEmpty - if(!skip) log.error(s"$prefix- ${sk.getOrElse("?")}") - i.directCause match { - case Some(e) => log.error(s"$prefix - $e") - case None => i.causes.foreach(i => logIncomplete(i, prefix + (if(skip) "" else " "))) + val task = sk.getOrElse(currentTask) + val dup = sk.map(s => !loggedAny.add(s)).getOrElse(false) + if(sk.map(s => !loggedThis.add(s)).getOrElse(false)) Vector.empty + else i.directCause match { + case Some(e) => Vector((task, if(dup) None else Some(e))) + case None => i.causes.toVector.flatMap(ch => findRootCauses(ch, task)) } } log.error(s"${failed.size} of ${results.length} test tasks failed:") failed.foreach { case (i, d) => log.error(s"- $d") - logIncomplete(i, " ") + loggedThis.clear + findRootCauses(i, "<unkown task>").foreach { + case (task, Some(ex)) => log.error(s" - $task failed: $ex") + case (task, None) => log.error(s" - ($task failed)") + } } throw new RuntimeException } @@ -854,7 +859,7 @@ lazy val dist = (project in file("dist")) val extraJars = (externalDependencyClasspath in Compile).value.map(a => (a.get(moduleID.key), a.data)).collect { case (Some(m), f) if extraModules contains uniqueModule(m) => f } - val jlineJAR = (dependencyClasspath in Compile).value.find(_.get(moduleID.key) == Some(jlineDep)).get.data + val jlineJAR = findJar((dependencyClasspath in Compile).value, jlineDep).get.data val mappings = extraJars.map(f => (f, targetDir / f.getName)) :+ ((jlineJAR, targetDir / "jline.jar")) IO.copy(mappings, overwrite = true) targetDir @@ -1126,3 +1131,9 @@ intellijToSample := { } else s.log.info("Aborting.") } + +/** Find a specific module's JAR in a classpath, comparing only organization and name */ +def findJar(files: Seq[Attributed[File]], dep: ModuleID): Option[Attributed[File]] = { + def extract(m: ModuleID) = (m.organization, m.name) + files.find(_.get(moduleID.key).map(extract _) == Some(extract(dep))) +} diff --git a/project/VersionUtil.scala b/project/VersionUtil.scala index 5613520e27..e2c2715320 100644 --- a/project/VersionUtil.scala +++ b/project/VersionUtil.scala @@ -146,7 +146,7 @@ object VersionUtil { def bootstrapDep(baseDir: File, path: String, libName: String): ModuleID = { val sha = IO.read(baseDir / path / s"$libName.jar.desired.sha1").split(' ')(0) bootstrapOrganization(path) % libName % sha from - s"https://dl.bintray.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap/$sha/$path/$libName.jar" + s"https://repo.lightbend.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap/$sha/$path/$libName.jar" } /** Copy a boostrap dependency JAR that is on the classpath to a file */ diff --git a/scripts/common b/scripts/common index 95389e5495..c4469348f4 100644 --- a/scripts/common +++ b/scripts/common @@ -168,8 +168,8 @@ function generateRepositoriesConfig() { fi cat >> "$sbtRepositoryConfig" << EOF jcenter-cache: $jcenterCacheUrl - typesafe-ivy-releases: https://dl.bintray.com/typesafe/ivy-releases/, [organisation]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly - sbt-plugin-releases: https://dl.bintray.com/sbt/sbt-plugin-releases/, [organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] + typesafe-ivy-releases: https://repo.lightbend.com/typesafe/ivy-releases/, [organisation]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly + sbt-plugin-releases: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] maven-central local EOF diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala index a26765027c..2d662257e5 100644 --- a/src/library/scala/collection/SeqLike.scala +++ b/src/library/scala/collection/SeqLike.scala @@ -113,7 +113,7 @@ trait SeqLike[+A, +Repr] extends Any with IterableLike[A, Repr] with GenSeqLike[ } def indexWhere(p: A => Boolean, from: Int): Int = { - var i = from + var i = from max 0 val it = iterator.drop(from) while (it.hasNext) { if (p(it.next())) return i diff --git a/src/manual/scala/man1/scala.scala b/src/manual/scala/man1/scala.scala index 9f97dd546c..3cfa9f8cb1 100644 --- a/src/manual/scala/man1/scala.scala +++ b/src/manual/scala/man1/scala.scala @@ -144,17 +144,14 @@ object scala extends Command { Mono("-nocompdaemon") & " or " & Mono("-nc") & " option can be used to " & "prevent this.", - "If " & Mono("scala") & " is run from an sbaz(1) directory, " & - "then it will add to its classpath any jars installed in the " & - "lib directory of the sbaz directory. Additionally, if no " & - "-classpath option is specified, then " & Mono("scala") & + "If no -classpath option is specified, then " & Mono("scala") & " will add " & Quote(".") & ", the current directory, to the " & "end of the classpath.") val options = Section("OPTIONS", "If any compiler options are specified, they must be first in the " & - "command line and must be followed by a bare hypen (" & Quote("-") & + "command line and must be followed by a bare hyphen (" & Quote("-") & ") character. " & "If no arguments are specified after the optional compiler arguments, " & "then an interactive Scala shell is started. Otherwise, either a " & diff --git a/test/benchmarks/project/plugins.sbt b/test/benchmarks/project/plugins.sbt index e11aa29f3b..aa49ad9872 100644 --- a/test/benchmarks/project/plugins.sbt +++ b/test/benchmarks/project/plugins.sbt @@ -1,2 +1,2 @@ addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0") -addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.6") +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.16") diff --git a/test/junit/scala/collection/SeqLikeTest.scala b/test/junit/scala/collection/SeqLikeTest.scala new file mode 100644 index 0000000000..2ab682299d --- /dev/null +++ b/test/junit/scala/collection/SeqLikeTest.scala @@ -0,0 +1,19 @@ +package scala.collection + +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 +import org.junit.Assert._ +import org.junit.Test + +@RunWith(classOf[JUnit4]) +class SeqLikeTest { + + @Test def `SI-9936 indexWhere`(): Unit = { + assertEquals(2, "abcde".indexOf('c', -1)) + assertEquals(2, "abcde".indexOf('c', -2)) + assertEquals(2, "abcde".toVector.indexOf('c', -1)) + assertEquals(2, "abcde".toVector.indexOf('c', -2)) + assertEquals(2, "abcde".toVector.indexWhere(_ == 'c', -1)) + assertEquals(2, "abcde".toVector.indexWhere(_ == 'c', -2)) + } +} |