mirror of https://github.com/sbt/sbt.git
Follow http to https redirections by default (#85)
This commit is contained in:
parent
dc8b787ca6
commit
dcc7d87503
|
|
@ -33,7 +33,8 @@ final class CoursierConfiguration private (
|
|||
val credentials: Seq[Credentials],
|
||||
val logger: Option[CacheLogger],
|
||||
val cache: Option[File],
|
||||
val ivyHome: Option[File]
|
||||
val ivyHome: Option[File],
|
||||
val followHttpToHttpsRedirections: Option[Boolean]
|
||||
) extends Serializable {
|
||||
|
||||
private def this() =
|
||||
|
|
@ -58,6 +59,7 @@ final class CoursierConfiguration private (
|
|||
Vector.empty,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None
|
||||
)
|
||||
|
||||
|
|
@ -84,7 +86,8 @@ final class CoursierConfiguration private (
|
|||
credentials == other.credentials &&
|
||||
logger == other.logger &&
|
||||
cache == other.cache &&
|
||||
ivyHome == other.ivyHome
|
||||
ivyHome == other.ivyHome &&
|
||||
followHttpToHttpsRedirections == other.followHttpToHttpsRedirections
|
||||
case _ => false
|
||||
}
|
||||
|
||||
|
|
@ -111,11 +114,12 @@ final class CoursierConfiguration private (
|
|||
code = 37 * (code + logger.##)
|
||||
code = 37 * (code + cache.##)
|
||||
code = 37 * (code + ivyHome.##)
|
||||
code = 37 * (code + followHttpToHttpsRedirections.##)
|
||||
code
|
||||
}
|
||||
|
||||
override def toString: String =
|
||||
s"CoursierConfiguration($log, $resolvers, $parallelDownloads, $maxIterations, $sbtScalaOrganization, $sbtScalaVersion, $sbtScalaJars, $interProjectDependencies, $excludeDependencies, $fallbackDependencies, $autoScalaLibrary, $hasClassifiers, $classifiers, $mavenProfiles, $scalaOrganization, $scalaVersion, $authenticationByRepositoryId, $credentials, $logger, $cache, $ivyHome)"
|
||||
s"CoursierConfiguration($log, $resolvers, $parallelDownloads, $maxIterations, $sbtScalaOrganization, $sbtScalaVersion, $sbtScalaJars, $interProjectDependencies, $excludeDependencies, $fallbackDependencies, $autoScalaLibrary, $hasClassifiers, $classifiers, $mavenProfiles, $scalaOrganization, $scalaVersion, $authenticationByRepositoryId, $credentials, $logger, $cache, $ivyHome, $followHttpToHttpsRedirections)"
|
||||
|
||||
private[this] def copy(
|
||||
log: Option[Logger] = log,
|
||||
|
|
@ -138,7 +142,8 @@ final class CoursierConfiguration private (
|
|||
credentials: Seq[Credentials] = credentials,
|
||||
logger: Option[CacheLogger] = logger,
|
||||
cache: Option[File] = cache,
|
||||
ivyHome: Option[File] = ivyHome
|
||||
ivyHome: Option[File] = ivyHome,
|
||||
followHttpToHttpsRedirections: Option[Boolean] = followHttpToHttpsRedirections
|
||||
): CoursierConfiguration =
|
||||
new CoursierConfiguration(
|
||||
log,
|
||||
|
|
@ -161,7 +166,8 @@ final class CoursierConfiguration private (
|
|||
credentials,
|
||||
logger,
|
||||
cache,
|
||||
ivyHome
|
||||
ivyHome,
|
||||
followHttpToHttpsRedirections
|
||||
)
|
||||
|
||||
def withLog(log: Option[Logger]): CoursierConfiguration =
|
||||
|
|
@ -249,6 +255,13 @@ final class CoursierConfiguration private (
|
|||
copy(ivyHome = ivyHomeOpt)
|
||||
def withIvyHome(ivyHome: File): CoursierConfiguration =
|
||||
copy(ivyHome = Option(ivyHome))
|
||||
|
||||
def withFollowHttpToHttpsRedirections(followHttpToHttpsRedirectionsOpt: Option[Boolean]): CoursierConfiguration =
|
||||
copy(followHttpToHttpsRedirections = followHttpToHttpsRedirectionsOpt)
|
||||
def withFollowHttpToHttpsRedirections(followHttpToHttpsRedirections: Boolean): CoursierConfiguration =
|
||||
copy(followHttpToHttpsRedirections = Some(followHttpToHttpsRedirections))
|
||||
def withFollowHttpToHttpsRedirections(): CoursierConfiguration =
|
||||
copy(followHttpToHttpsRedirections = Some(true))
|
||||
}
|
||||
|
||||
object CoursierConfiguration {
|
||||
|
|
@ -299,6 +312,7 @@ object CoursierConfiguration {
|
|||
credentials,
|
||||
logger,
|
||||
cache,
|
||||
None,
|
||||
None
|
||||
)
|
||||
|
||||
|
|
@ -345,6 +359,7 @@ object CoursierConfiguration {
|
|||
credentials,
|
||||
Option(logger),
|
||||
Option(cache),
|
||||
None,
|
||||
None
|
||||
)
|
||||
|
||||
|
|
@ -392,6 +407,7 @@ object CoursierConfiguration {
|
|||
credentials,
|
||||
logger,
|
||||
cache,
|
||||
ivyHome
|
||||
ivyHome,
|
||||
None
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
|
|||
.withTtl(ttl)
|
||||
.withChecksums(checksums)
|
||||
.withCredentials(conf.credentials.map(ToCoursier.credentials))
|
||||
.withFollowHttpToHttpsRedirections(conf.followHttpToHttpsRedirections.getOrElse(true))
|
||||
|
||||
val resolutionParams = ResolutionParams(
|
||||
dependencies = dependencies,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ object ArtifactsTasks {
|
|||
.withChecksums(artifactsChecksums)
|
||||
.withTtl(ttl)
|
||||
.withCachePolicies(cachePolicies)
|
||||
.withCredentials(credentials),
|
||||
.withCredentials(credentials)
|
||||
.withFollowHttpToHttpsRedirections(true),
|
||||
parallel = parallelDownloads
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@ object ResolutionTasks {
|
|||
.withCachePolicies(cachePolicies)
|
||||
.withTtl(ttl)
|
||||
.withChecksums(checksums)
|
||||
.withCredentials(credentials),
|
||||
.withCredentials(credentials)
|
||||
.withFollowHttpToHttpsRedirections(true),
|
||||
parallel = parallelDownloads,
|
||||
params = coursier.params.ResolutionParams()
|
||||
.withMaxIterations(maxIterations)
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Originally from https://github.com/sbt/sbt/tree/57a86e60f6d7c6fd428fb73a6786b62972fdae54/sbt/src/sbt-test/dependency-management/url
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import sbt.internal.inc.classpath.ClasspathUtilities
|
||||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")),
|
||||
libraryDependencies += "org.jsoup" % "jsoup" % "1.9.1" % Test from "http://jsoup.org/packages/jsoup-1.9.1.jar",
|
||||
ivyLoggingLevel := UpdateLogging.Full,
|
||||
TaskKey[Unit]("checkInTest") := checkClasspath(Test).value,
|
||||
TaskKey[Unit]("checkInCompile") := checkClasspath(Compile).value
|
||||
)
|
||||
|
||||
def checkClasspath(conf: Configuration) =
|
||||
fullClasspath in conf map { cp =>
|
||||
try {
|
||||
val loader = ClasspathUtilities.toLoader(cp.files)
|
||||
Class.forName("org.jsoup.Jsoup", false, loader)
|
||||
()
|
||||
}
|
||||
catch {
|
||||
case _: ClassNotFoundException => sys.error(s"could not instantiate org.jsoup.Jsoup: ${cp.files}")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
addSbtPlugin {
|
||||
|
||||
val name = sys.props.getOrElse(
|
||||
"plugin.name",
|
||||
sys.error("plugin.name Java property not set")
|
||||
)
|
||||
val version = sys.props.getOrElse(
|
||||
"plugin.version",
|
||||
sys.error("plugin.version Java property not set")
|
||||
)
|
||||
|
||||
"io.get-coursier" % name % version
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
> checkInTest
|
||||
-> checkInCompile
|
||||
Loading…
Reference in New Issue