mirror of https://github.com/sbt/sbt.git
More for extra attributes from POM
This commit is contained in:
parent
1a51200ec5
commit
0d5ac09aa1
|
|
@ -31,7 +31,8 @@ case class CommonOptions(
|
|||
@HelpMessage("Do not add default repositories (~/.ivy2/local, and Central)")
|
||||
noDefault: Boolean = false,
|
||||
@HelpMessage("Modify names in Maven repository paths for SBT plugins")
|
||||
sbtPluginHack: Boolean = false,
|
||||
@ValueDescription("Attribute prefix (typically \"e\")")
|
||||
sbtPluginHack: String = "",
|
||||
@HelpMessage("Force module version")
|
||||
@ValueDescription("organization:name:forcedVersion")
|
||||
@ExtraName("V")
|
||||
|
|
|
|||
|
|
@ -118,9 +118,9 @@ class Helper(
|
|||
repositories0.collect { case Right(r) => r }
|
||||
|
||||
val repositories =
|
||||
if (common.sbtPluginHack)
|
||||
if (common.sbtPluginHack.nonEmpty)
|
||||
repositories1.map {
|
||||
case m: MavenRepository => m.copy(sbtAttrStub = true)
|
||||
case m: MavenRepository => m.copy(sbtAttrStub = Some(common.sbtPluginHack))
|
||||
case other => other
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ object Fetch {
|
|||
val task = lookups.foldLeft[F[Seq[String] \/ (Artifact.Source, Project)]](F.point(-\/(Nil))) {
|
||||
case (acc, (repo, eitherProjTask)) =>
|
||||
val looseModuleValidation = repo match {
|
||||
case m: MavenRepository => m.sbtAttrStub // that sucks so much
|
||||
case m: MavenRepository => m.sbtAttrStub.nonEmpty // that sucks so much
|
||||
case _ => false
|
||||
}
|
||||
val moduleCmp = if (looseModuleValidation) module.copy(attributes = Map.empty) else module
|
||||
|
|
@ -66,7 +66,7 @@ object Fetch {
|
|||
EitherT(F.map(task)(_.leftMap(_.reverse)))
|
||||
.map {case x @ (source, proj) =>
|
||||
val looseModuleValidation = source match {
|
||||
case m: MavenSource => m.sbtAttrStub // omfg
|
||||
case m: MavenSource => m.sbtAttrStub.nonEmpty // omfg
|
||||
case _ => false
|
||||
}
|
||||
val projModule =
|
||||
|
|
|
|||
|
|
@ -45,16 +45,24 @@ object MavenRepository {
|
|||
"test" -> Seq("runtime")
|
||||
)
|
||||
|
||||
def dirModuleName(module: Module, sbtAttrStub: Boolean): String =
|
||||
if (sbtAttrStub) {
|
||||
def dirModuleName(module: Module, sbtAttrStub: Option[String]): String =
|
||||
sbtAttrStub.fold(module.name) { prefix =>
|
||||
def attr(name: String) = {
|
||||
val base = module.attributes.get(name)
|
||||
|
||||
if (prefix.isEmpty)
|
||||
base
|
||||
else
|
||||
base.orElse(module.attributes.get(s"$prefix:$name"))
|
||||
}
|
||||
|
||||
var name = module.name
|
||||
for (scalaVersion <- module.attributes.get("scalaVersion"))
|
||||
for (scalaVersion <- attr("scalaVersion"))
|
||||
name = name + "_" + scalaVersion
|
||||
for (sbtVersion <- module.attributes.get("sbtVersion"))
|
||||
for (sbtVersion <- attr("sbtVersion"))
|
||||
name = name + "_" + sbtVersion
|
||||
name
|
||||
} else
|
||||
module.name
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +71,7 @@ case class MavenRepository(
|
|||
ivyLike: Boolean = false,
|
||||
changing: Option[Boolean] = None,
|
||||
/** Hackish hack for sbt plugins mainly - what this does really sucks */
|
||||
sbtAttrStub: Boolean = false
|
||||
sbtAttrStub: Option[String] = None
|
||||
) extends Repository {
|
||||
|
||||
import Repository._
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ case class MavenSource(
|
|||
ivyLike: Boolean,
|
||||
changing: Option[Boolean] = None,
|
||||
/** See doc on MavenRepository */
|
||||
sbtAttrStub: Boolean
|
||||
sbtAttrStub: Option[String] = None
|
||||
) extends Artifact.Source {
|
||||
|
||||
import Repository._
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ object FromSbt {
|
|||
case sbt.MavenRepository(_, root) =>
|
||||
if (root.startsWith("http://") || root.startsWith("https://")) {
|
||||
val root0 = if (root.endsWith("/")) root else root + "/"
|
||||
Some(MavenRepository(root0, sbtAttrStub = true))
|
||||
Some(MavenRepository(root0, sbtAttrStub = Some("e")))
|
||||
} else {
|
||||
Console.err.println(s"Warning: unrecognized Maven repository protocol in $root, ignoring it")
|
||||
None
|
||||
|
|
|
|||
Loading…
Reference in New Issue