Merge pull request #314 from eed3si9n/wip/http

Fix validatePatterns
This commit is contained in:
eugene yokota 2019-08-18 00:27:22 -04:00 committed by GitHub
commit edfe9c6c63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 18 deletions

View File

@ -98,6 +98,7 @@ lazy val lmCore = (project in file("core"))
sjsonnewScalaJson.value % Optional,
scalaTest % Test,
scalaCheck % Test,
scalaVerify % Test,
),
libraryDependencies += scalaXml,
resourceGenerators in Compile += Def
@ -217,25 +218,18 @@ lazy val lmCore = (project in file("core"))
)
.configure(addSbtIO, addSbtUtilLogging, addSbtUtilPosition, addSbtUtilCache)
lazy val lmCommonTest = (project in file("common-test"))
lazy val lmIvy = (project in file("ivy"))
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
.dependsOn(lmCore)
.settings(
commonSettings,
skip in publish := true,
name := "common-test",
libraryDependencies ++= Seq(scalaTest, scalaCheck, scalaVerify),
scalacOptions in (Compile, console) --=
Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint"),
mimaSettings,
)
lazy val lmIvy = (project in file("ivy"))
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
.dependsOn(lmCore, lmCommonTest % Test)
.settings(
commonSettings,
name := "librarymanagement-ivy",
libraryDependencies ++= Seq(ivy),
libraryDependencies ++= Seq(
ivy,
scalaTest % Test,
scalaCheck % Test,
scalaVerify % Test,
),
managedSourceDirectories in Compile +=
baseDirectory.value / "src" / "main" / "contraband-scala",
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",

View File

@ -417,9 +417,15 @@ private[librarymanagement] abstract class ResolverFunctions {
log.warn(s"insecure HTTP request is deprecated '$value'; switch to HTTPS")
}
private[sbt] def validatePatterns(patterns: Patterns): Unit = {
val ivy = patterns.ivyPatterns.headOption map (_.startsWith("http:"))
val art = patterns.artifactPatterns.headOption map (_.startsWith("http:"))
(ivy orElse art) foreach { _ =>
val ivy = patterns.ivyPatterns.headOption match {
case Some(x) => x.startsWith("http:")
case _ => false
}
val art = patterns.artifactPatterns.headOption match {
case Some(x) => x.startsWith("http:")
case _ => false
}
if (ivy || art) {
warnHttp(patterns.toString)
}
}