mirror of https://github.com/sbt/sbt.git
Add sbt-plugin: and typesafe: repo syntaxes
This commit is contained in:
parent
bfe36c7ec7
commit
70906fcc8e
|
|
@ -29,7 +29,7 @@ final case class CommonOptions(
|
|||
@Short("N")
|
||||
maxIterations: Int = 100,
|
||||
@Help("Repository - for multiple repositories, separate with comma and/or add this option multiple times (e.g. -r central,ivy2local -r sonatype-snapshots, or equivalently -r central,ivy2local,sonatype-snapshots)")
|
||||
@Value("maven|sonatype:$repo|ivy2local|bintray:$org/$repo|bintray-ivy:$org/$repo|typesafe:ivy-$repo|ivy:$pattern")
|
||||
@Value("maven|sonatype:$repo|ivy2local|bintray:$org/$repo|bintray-ivy:$org/$repo|typesafe:ivy-$repo|typesafe:$repo|sbt-plugin:$repo|ivy:$pattern")
|
||||
@Short("r")
|
||||
repository: List[String] = Nil,
|
||||
@Help("Source repository - for multiple repositories, separate with comma and/or add this option multiple times")
|
||||
|
|
|
|||
|
|
@ -190,12 +190,19 @@ object Parse {
|
|||
MavenRepository(s"https://dl.bintray.com/${s.stripPrefix("bintray:")}").right
|
||||
else if (s.startsWith("bintray-ivy:"))
|
||||
IvyRepository.fromPattern(
|
||||
s"https://dl.bintray.com/${s.stripPrefix("bintray-ivy:").stripSuffix("/")}" +: "/" +:
|
||||
s"https://dl.bintray.com/${s.stripPrefix("bintray-ivy:").stripSuffix("/")}/" +:
|
||||
coursier.ivy.Pattern.default
|
||||
).right
|
||||
else if (s.startsWith("typesafe:ivy-"))
|
||||
IvyRepository.fromPattern(
|
||||
(s"https://repo.typesafe.com/typesafe/ivy-" + s.stripPrefix("typesafe:ivy-") + "/") +:
|
||||
s"https://repo.typesafe.com/typesafe/ivy-${s.stripPrefix("typesafe:ivy-")}/" +:
|
||||
coursier.ivy.Pattern.default
|
||||
).right
|
||||
else if (s.startsWith("typesafe:"))
|
||||
MavenRepository(s"https://repo.typesafe.com/typesafe/${s.stripPrefix("typesafe:")}").right
|
||||
else if (s.startsWith("sbt-plugin:"))
|
||||
IvyRepository.fromPattern(
|
||||
s"https://repo.scala-sbt.org/scalasbt/sbt-plugin-${s.stripPrefix("sbt-plugin:")}/" +:
|
||||
coursier.ivy.Pattern.default
|
||||
).right
|
||||
else if (s.startsWith("ivy:"))
|
||||
|
|
|
|||
|
|
@ -1,21 +1,46 @@
|
|||
package coursier.test
|
||||
|
||||
import scalaz.\/-
|
||||
|
||||
import coursier.MavenRepository
|
||||
import coursier.{MavenRepository, Repository}
|
||||
import coursier.ivy.IvyRepository
|
||||
import coursier.util.Parse
|
||||
import utest._
|
||||
|
||||
object ParseTests extends TestSuite {
|
||||
|
||||
def isMavenRepo(repo: Repository): Boolean =
|
||||
repo match {
|
||||
case _: MavenRepository => true
|
||||
case _ => false
|
||||
}
|
||||
|
||||
def isIvyRepo(repo: Repository): Boolean =
|
||||
repo match {
|
||||
case _: IvyRepository => true
|
||||
case _ => false
|
||||
}
|
||||
|
||||
val tests = TestSuite {
|
||||
"bintray-ivy:" - {
|
||||
val obtained = Parse.repository("bintray-ivy:scalameta/maven")
|
||||
assert(obtained.exists(_.isInstanceOf[IvyRepository]))
|
||||
assert(obtained.exists(isIvyRepo))
|
||||
}
|
||||
"bintray:" - {
|
||||
val obtained = Parse.repository("bintray:scalameta/maven")
|
||||
assert(obtained.exists(_.isInstanceOf[MavenRepository]))
|
||||
assert(obtained.exists(isMavenRepo))
|
||||
}
|
||||
|
||||
"sbt-plugin:" - {
|
||||
val res = Parse.repository("sbt-plugin:releases")
|
||||
assert(res.exists(isIvyRepo))
|
||||
}
|
||||
|
||||
"typesafe:ivy-" - {
|
||||
val res = Parse.repository("typesafe:ivy-releases")
|
||||
assert(res.exists(isIvyRepo))
|
||||
}
|
||||
"typesafe:" - {
|
||||
val res = Parse.repository("typesafe:releases")
|
||||
assert(res.exists(isMavenRepo))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue