From 82aaf23c73cc0e4bf2b533f7028e74a3f400ca52 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 4 Sep 2024 13:52:27 +0800 Subject: [PATCH] [TOREE-555] Upgrade Coursier from 1.0.3 to 2.0.0 (#223) --- etc/legal/LICENSE_extras | 47 +- etc/legal/licenses/LICENSE-ammonite.txt | 25 - etc/legal/licenses/LICENSE-jline.txt | 902 ------------------ etc/legal/licenses/LICENSE-scala-stm.txt | 24 - etc/legal/licenses/LICENSE-scalaz.txt | 24 - .../CoursierDependencyDownloader.scala | 131 +-- project/Dependencies.scala | 2 +- 7 files changed, 85 insertions(+), 1070 deletions(-) delete mode 100644 etc/legal/licenses/LICENSE-ammonite.txt delete mode 100644 etc/legal/licenses/LICENSE-jline.txt delete mode 100644 etc/legal/licenses/LICENSE-scala-stm.txt delete mode 100644 etc/legal/licenses/LICENSE-scalaz.txt diff --git a/etc/legal/LICENSE_extras b/etc/legal/LICENSE_extras index 01ec513b5..fccbf2f3d 100644 --- a/etc/legal/LICENSE_extras +++ b/etc/legal/LICENSE_extras @@ -13,51 +13,40 @@ Apache License 2.0 com.google.guava:guava:14.0.1 org.apache.pekko:pekko-slf4j_2.12:1.0.2 org.apache.pekko:pekko-actor_2.12:1.0.2 - com.typesafe:config:1.3.0 -> https://github.com/lightbend/config/blob/master/LICENSE-2.0.txt - com.typesafe.play:play-json_2.11:2.3.10 -> https://github.com/playframework/play-json/blob/master/LICENSE - com.typesafe.play:play-datacommons_2.11:2.3.10 - com.typesafe.play:play-functional_2.11:2.3.10 - com.typesafe.play:play-iteratees_2.11:2.3.10 + com.typesafe:config:1.4.3 -> https://github.com/lightbend/config/blob/master/LICENSE-2.0.txt + com.typesafe.play:play-json_2.12:2.7.4 -> https://github.com/playframework/play-json/blob/master/LICENSE + com.typesafe.play:play-functional_2.12:2.7.4 commons-logging:commons-logging:1.1.3 -> https://github.com/apache/commons-logging/blob/trunk/LICENSE.txt - io.get-coursier:coursier-cache_2.11:1.0.0-RC10 -> https://github.com/coursier/coursier/blob/master/LICENSE - io.get-coursier:coursier_2.11:1.0.0-RC10 -> https://github.com/coursier/coursier/blob/master/LICENSE - joda-time:joda-time:2.3 -> https://github.com/JodaOrg/joda-time/blob/master/LICENSE.txt - org.springframework:spring-core:4.1.1.RELEASE + io.get-coursier:coursier-cache_2.12:2.0.0 -> https://github.com/coursier/coursier/blob/master/LICENSE + io.get-coursier:coursier_2.12:2.0.0 -> https://github.com/coursier/coursier/blob/master/LICENSE + joda-time:joda-time:2.10.1 -> https://github.com/JodaOrg/joda-time/blob/master/LICENSE.txt + org.springframework:spring-core:5.2.2.RELEASE org.apache.commons:commons-exec:1.3 -> https://github.com/apache/commons-exec/blob/trunk/LICENSE.txt - org.joda:joda-convert:1.6 -> https://github.com/JodaOrg/joda-convert/blob/master/LICENSE.txt - ======================================================================== MPL v2 ======================================================================== - org.zeromq:jeromq:0.3.6 -> https://github.com/zeromq/jeromq/blob/master/LICENSE + org.zeromq:jeromq:0.5.3 -> https://github.com/zeromq/jeromq/blob/master/LICENSE ======================================================================== BSD-like ======================================================================== - asm:asm-commons:5.1 -> http://asm.ow2.org/license.html and licenses/LICENSE-asm.txt - asm:asm-tree:5.1 -> http://asm.ow2.org/license.html and licenses/LICENSE-asm.txt - asm:asm-util:5.1 -> http://asm.ow2.org/license.html and licenses/LICENSE-asm.txt - asm:asm:5.1 -> http://asm.ow2.org/license.html and licenses/LICENSE-asm.txt + asm:asm-commons:7.1 -> http://asm.ow2.org/license.html and licenses/LICENSE-asm.txt + asm:asm-tree:7.1 -> http://asm.ow2.org/license.html and licenses/LICENSE-asm.txt + asm:asm-util:7.1 -> http://asm.ow2.org/license.html and licenses/LICENSE-asm.txt + asm:asm:7.1 -> http://asm.ow2.org/license.html and licenses/LICENSE-asm.txt com.github.jupyter:jvm-repr:0.1.0 -> https://github.com/jupyter/jvm-repr/blob/master/LICENSE - jline:jline:2.6 -> https://github.com/jline/jline2/blob/master/LICENSE.txt and licenses/LICENSE-jline.txt - org.clapper:classutil_2.11:1.0.12 -> http://software.clapper.org/javautil/#copyright-and-license and licenses/LICENSE-clapper.txt - org.clapper:grizzled-scala_2.11:2.4.1 -> http://software.clapper.org/grizzled-scala/#copyright-and-license and licenses/LICENSE-clapper.txt - org.scala-lang.modules:scala-java8-compat_2.11:0.7.0 -> https://github.com/scala/scala-java8-compat/blob/master/LICENSE - org.scala-lang.modules:scala-xml_2.11:1.0.6 -> https://github.com/scala/scala-xml/blob/master/LICENSE.md - org.scala-lang:scala-reflect:2.11.8 -> http://www.scala-lang.org/license.html and licenses/LICENSE-scala.txt - org.scala-stm:scala-stm_2.11:0.7 -> https://nbronson.github.io/scala-stm/license.html and licenses/LICENSE-scala-stm.txt - org.scalaz:scalaz-concurrent_2.11:7.2.13 -> https://github.com/scalaz/scalaz/blob/series/7.1.x/etc/LICENCE and licenses/LICENSE-scalaz.txt - org.scalaz:scalaz-core_2.11:7.2.13 -> https://github.com/scalaz/scalaz/blob/series/7.1.x/etc/LICENCE and licenses/LICENSE-scalaz.txt - org.scalaz:scalaz-effect_2.11:7.2.13 -> https://github.com/scalaz/scalaz/blob/series/7.1.x/etc/LICENCE and licenses/LICENSE-scalaz.txt - org.scalamacros:quasiquotes_2.10:2.0.1 -> http://www.scala-lang.org/license.html and licenses/LICENSE-scala.txt + org.clapper:classutil_2.12:1.5.1 -> http://software.clapper.org/javautil/#copyright-and-license and licenses/LICENSE-clapper.txt + org.clapper:grizzled-scala_2.12:4.9.3 -> http://software.clapper.org/grizzled-scala/#copyright-and-license and licenses/LICENSE-clapper.txt + org.scala-lang.modules:scala-java8-compat_2.12:1.0.2 -> https://github.com/scala/scala-java8-compat/blob/master/LICENSE + org.scala-lang.modules:scala-xml_2.12:2.1.0 -> https://github.com/scala/scala-xml/blob/master/LICENSE.md + org.scala-lang:scala-reflect:2.12.15 -> http://www.scala-lang.org/license.html and licenses/LICENSE-scala.txt ======================================================================== MIT license ======================================================================== - com.lihaoyi:ammonite-terminal_2.10:0.5.0 -> https://github.com/lihaoyi/Ammonite/blob/master/LICENSE and licenses/LICENSE-ammonite.txt net.sf.jopt-simple:jopt-simple:4.9 -> https://pholser.github.io/jopt-simple/license.html and licenses/LICENSE-jopt-simple.txt - org.slf4j:slf4j-api:1.7.21 -> http://www.slf4j.org/license.html and licenses/LICENSE-slf4j.txt + org.slf4j:slf4j-api:1.7.32 -> http://www.slf4j.org/license.html and licenses/LICENSE-slf4j.txt diff --git a/etc/legal/licenses/LICENSE-ammonite.txt b/etc/legal/licenses/LICENSE-ammonite.txt deleted file mode 100644 index 307d8e963..000000000 --- a/etc/legal/licenses/LICENSE-ammonite.txt +++ /dev/null @@ -1,25 +0,0 @@ -License -======= - - -The MIT License (MIT) - -Copyright (c) 2014 Li Haoyi (haoyi.sg@gmail.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/etc/legal/licenses/LICENSE-jline.txt b/etc/legal/licenses/LICENSE-jline.txt deleted file mode 100644 index 0565aea65..000000000 --- a/etc/legal/licenses/LICENSE-jline.txt +++ /dev/null @@ -1,902 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - jline2/LICENSE.txt at master · jline/jline2 · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Skip to content - - - - - - - - - - - -
- -
-
- - -
-
-
- - - -
-
- - - - - - - - - - -
- - - f9b8398 - - - - - -
- - @gnodet - @jdillon - - -
- - -
- -
-
-
- -
- Raw - Blame - History -
- - - - -
- -
- 36 lines (28 sloc) - - 1.5 KB -
-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Copyright (c) 2002-2016, the original author or authors.
All rights reserved.
-
http://www.opensource.org/licenses/bsd-license.php
-
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:
-
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with
the distribution.
-
Neither the name of JLine nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
-
- -
- -
- - - - -
- -
- - -
-
- -
- - - - - - - - -
- - - Something went wrong with that request. Please try again. -
- - - - - - - - - - - - - - - - diff --git a/etc/legal/licenses/LICENSE-scala-stm.txt b/etc/legal/licenses/LICENSE-scala-stm.txt deleted file mode 100644 index 1b7a9a471..000000000 --- a/etc/legal/licenses/LICENSE-scala-stm.txt +++ /dev/null @@ -1,24 +0,0 @@ -All of the source code and documentation that has been developed by the Scala STM Expert Group is available under a modified-BSD license. -Copyright (c) 2009-2012 Stanford University, unless otherwise specified. -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Stanford University nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/etc/legal/licenses/LICENSE-scalaz.txt b/etc/legal/licenses/LICENSE-scalaz.txt deleted file mode 100644 index e6ce8436d..000000000 --- a/etc/legal/licenses/LICENSE-scalaz.txt +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2009-2014 Tony Morris, Runar Bjarnason, Tom Adams, Kristian Domagala, Brad Clow, Ricky Clarkson, Paul Chiusano, Trygve Laugstøl, Nick Partridge, Jason Zaugg -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/kernel-api/src/main/scala/org/apache/toree/dependencies/CoursierDependencyDownloader.scala b/kernel-api/src/main/scala/org/apache/toree/dependencies/CoursierDependencyDownloader.scala index c3d9d1d89..fb88aad57 100644 --- a/kernel-api/src/main/scala/org/apache/toree/dependencies/CoursierDependencyDownloader.scala +++ b/kernel-api/src/main/scala/org/apache/toree/dependencies/CoursierDependencyDownloader.scala @@ -16,21 +16,23 @@ */ package org.apache.toree.dependencies -import java.io.{File, FileInputStream, PrintStream} -import java.net.{URI, URL} -import java.util.Properties -import java.util.concurrent.ConcurrentHashMap -import coursier.core.Authentication -import coursier.Cache.Logger +import coursier.core.{Authentication, Configuration, Repository} import coursier.Dependency -import coursier.core.Repository -import coursier.core.Resolution.ModuleVersion import coursier.ivy.{IvyRepository, IvyXml} +import coursier.util.{Gather, Task} +import coursier.cache.{ArtifactError, CacheLogger, FileCache} import coursier.maven.MavenRepository +import coursier.util.Task.sync import org.springframework.core.io.support.PathMatchingResourcePatternResolver + +import java.io.{File, FileInputStream, PrintStream} +import java.lang.{Long => JLong, Double => JDouble} +import java.net.{URI, URL} +import java.util.Properties +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.atomic.AtomicLong +import scala.concurrent.ExecutionContext.Implicits.global import scala.util.Try -import scalaz.\/ -import scalaz.concurrent.Task /** * Represents a dependency downloader for jars that uses Coursier underneath. @@ -83,23 +85,26 @@ class CoursierDependencyDownloader extends DependencyDownloader { import coursier._ // Grab exclusions using base dependencies (always exclude scala lang) - val exclusions: Set[(String, String)] = (if (excludeBaseDependencies) { + val exclusions: Set[(Organization, ModuleName)] = (if (excludeBaseDependencies) { getBaseDependencies.map(_.module).map(m => (m.organization, m.name)) - } else Nil).toSet ++ Set(("org.scala-lang", "*"), ("org.scala-lang.modules", "*")) ++ excludes + } else Nil).toSet ++ + (Set(("org.scala-lang", "*"), ("org.scala-lang.modules", "*")) ++ excludes) + .map { case (org, module) => Organization(org) -> ModuleName(module) } // Mark dependency that we want to download - val start = Resolution(Set( - Dependency( - module = Module(organization = groupId, name = artifactId), - version = version, - transitive = transitive, - exclusions = exclusions, // NOTE: Source/Javadoc not downloaded by default - configuration = configuration.getOrElse("default"), - attributes = Attributes( - artifactType.getOrElse(""), - artifactClassifier.getOrElse("") - ) - ) + val start = Resolution(Seq( + Dependency(Module(Organization(groupId), ModuleName(artifactId)), version) + .withTransitive(transitive) + .withExclusions(exclusions) // NOTE: Source/Javadoc not downloaded by default + .withConfiguration { + configuration.map(c => new Configuration(c)).getOrElse(Configuration.default) + } + .withAttributes { + Attributes( + artifactType.map(t => Type(t)).getOrElse(Type.jar), + artifactClassifier.map(c => Classifier(c)).getOrElse(Classifier.empty) + ) + } )) printStream.println(s"Marking $groupId:$artifactId:$version for download") @@ -112,10 +117,15 @@ class CoursierDependencyDownloader extends DependencyDownloader { // Build list of locations to fetch dependencies val fetchLocations = Seq(ivy2Cache(localDirectory)) ++ allRepositories - val fetch = Fetch.from( + + val localCache = FileCache() + .withLocation(downloadLocations) + .withLogger(new DownloadLogger(verbose, trace)) + + val fetch = ResolutionProcess.fetch( fetchLocations, - Cache.fetch(downloadLocations, logger = Some(new DownloadLogger(verbose, trace))) - ) + localCache.fetch + )(Task.gather) val fetchUris = localDirectory +: repositoriesToURIs(allRepositories) if (verbose) { @@ -123,10 +133,10 @@ class CoursierDependencyDownloader extends DependencyDownloader { printStream.println(s"-> ${fetchUris.mkString("\n-> ")}") } // Verify locations where we will download dependencies - val resolution = start.process.run(fetch).unsafePerformSync + val resolution = start.process.run(fetch).unsafeRun() // Report any resolution errors - val errors: Seq[(ModuleVersion, Seq[String])] = resolution.metadataErrors + val errors: Seq[(ModuleVersion, Seq[String])] = resolution.errors errors.foreach { case (dep, e) => printStream.println(s"-> Failed to resolve ${dep._1.toString()}:${dep._2}") e.foreach(s => printStream.println(s" -> $s")) @@ -136,12 +146,10 @@ class CoursierDependencyDownloader extends DependencyDownloader { if (errors.nonEmpty && !ignoreResolutionErrors) return Nil // Perform task of downloading dependencies - val localArtifacts: Seq[FileError \/ File] = Task.gatherUnordered( - resolution.artifacts.map(a => Cache.file( - artifact = a, - cache = downloadLocations, - logger = Some(new DownloadLogger(verbose, trace)) - ).run)).unsafePerformSync + val localArtifacts: Seq[Either[ArtifactError, File]] = Gather[Task].gather( + resolution.artifacts().map(localCache.file(_).run) + ).unsafeRun() + // Print any errors in retrieving dependencies localArtifacts.flatMap(_.swap.toOption).map(_.message) @@ -220,37 +228,39 @@ class CoursierDependencyDownloader extends DependencyDownloader { true } - private class DownloadLogger( - private val verbose: Boolean, - private val trace: Boolean - ) extends Logger { + private class DownloadLogger(verbose: Boolean, trace: Boolean) extends CacheLogger { import scala.collection.JavaConverters._ private val downloadId = new ConcurrentHashMap[String, String]().asScala - private val downloadFile = new ConcurrentHashMap[String, File]().asScala + private val downloadFile = new ConcurrentHashMap[String, String]().asScala private val downloadAmount = new ConcurrentHashMap[String, Long]().asScala private val downloadTotal = new ConcurrentHashMap[String, Long]().asScala + private val counter = new AtomicLong(0) + private def nextId(): Long = counter.getAndIncrement() - override def foundLocally(url: String, file: File): Unit = { + override def foundLocally(url: String): Unit = { + val file = new File(new URL(url).getPath).getName + downloadFile.put(url, file) val id = downloadId.getOrElse(url, url) - val f = s"(${downloadFile.get(url).map(_.getName).getOrElse("")})" - if (verbose) printStream.println(s"=> $id: Found at ${file.getAbsolutePath}") + val f = s"(${downloadFile.getOrElse(url, "")})" + if (verbose) printStream.println(s"=> $id $f: Found at local") } - override def downloadingArtifact(url: String, file: File): Unit = { - downloadId.put(url, nextId()) + override def downloadingArtifact(url: String): Unit = { + downloadId.put(url, nextId().toString) + val file = new File(new URL(url).getPath).getName + downloadFile.put(url, file) val id = downloadId.getOrElse(url, url) - val f = s"(${downloadFile.get(url).map(_.getName).getOrElse("")})" + val f = s"(${downloadFile.getOrElse(url, "")})" if (verbose) printStream.println(s"=> $id $f: Downloading $url") - - downloadFile.put(url, file) } - override def downloadLength(url: String, length: Long): Unit = { + override def downloadLength( + url: String,totalLength: Long, alreadyDownloaded: Long, watching: Boolean): Unit = { val id = downloadId.getOrElse(url, url) - val f = s"(${downloadFile.get(url).map(_.getName).getOrElse("")})" - if (trace) printStream.println(s"===> $id $f: Is $length total bytes") - downloadTotal.put(url, length) + val f = s"(${downloadFile.getOrElse(url, "")})" + if (trace) printStream.println(s"===> $id $f: Is $totalLength total bytes") + downloadTotal.put(url, totalLength) } override def downloadProgress(url: String, downloaded: Long): Unit = { @@ -262,29 +272,20 @@ class CoursierDependencyDownloader extends DependencyDownloader { if (trace) printStream.printf( "===> %s %s: Downloaded %d bytes (%.2f%%)\n", downloadId.getOrElse(url, url), - s"(${downloadFile.get(url).map(_.getName).getOrElse("")})", - java.lang.Long.valueOf(downloaded), - java.lang.Double.valueOf(percent) + s"(${downloadFile.getOrElse(url, "")})", + JLong.valueOf(downloaded), + JDouble.valueOf(percent) ) } override def downloadedArtifact(url: String, success: Boolean): Unit = { if (verbose) { val id = downloadId.getOrElse(url, url) - val f = s"(${downloadFile.get(url).map(_.getName).getOrElse("")})" + val f = s"(${downloadFile.getOrElse(url, "")})" if (success) printStream.println(s"=> $id $f: Finished downloading") else printStream.println(s"=> $id: An error occurred while downloading") } } - - private val nextId: () => String = (() => { - var counter: Long = 0 - - () => { - counter += 1 - counter.toString - } - })() } /** diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 231136f5d..e873a48e0 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -32,7 +32,7 @@ object Dependencies { val config = "com.typesafe" % "config" % "1.4.3" // Apache v2 - val coursierVersion = "1.0.3" + val coursierVersion = "2.0.0" val coursier = "io.get-coursier" %% "coursier" % coursierVersion // Apache v2 val coursierCache = "io.get-coursier" %% "coursier-cache" % coursierVersion // Apache v2