mirror of https://github.com/sbt/sbt.git
Don't leave POMs as artifacts in update reports
sbt-pack isn't too fine with those in particular
This commit is contained in:
parent
ad80e1482c
commit
13da5e871f
|
|
@ -96,14 +96,23 @@ object ToSbt {
|
|||
def moduleReports(
|
||||
res: Resolution,
|
||||
classifiersOpt: Option[Seq[String]],
|
||||
artifactFileOpt: (Module, String, Artifact) => Option[File]
|
||||
artifactFileOpt: (Module, String, Artifact) => Option[File],
|
||||
keepPomArtifact: Boolean = false
|
||||
) = {
|
||||
val depArtifacts =
|
||||
val depArtifacts0 =
|
||||
classifiersOpt match {
|
||||
case None => res.dependencyArtifacts
|
||||
case Some(cl) => res.dependencyClassifiersArtifacts(cl)
|
||||
}
|
||||
|
||||
val depArtifacts =
|
||||
if (keepPomArtifact)
|
||||
depArtifacts0
|
||||
else
|
||||
depArtifacts0.filter {
|
||||
case (_, a) => a.attributes != Attributes("pom", "")
|
||||
}
|
||||
|
||||
val groupedDepArtifacts = grouped(depArtifacts)
|
||||
|
||||
val versions = res.dependencies.toVector.map { dep =>
|
||||
|
|
@ -155,7 +164,8 @@ object ToSbt {
|
|||
resolution: Resolution,
|
||||
configs: Map[String, Set[String]],
|
||||
classifiersOpt: Option[Seq[String]],
|
||||
artifactFileOpt: (Module, String, Artifact) => Option[File]
|
||||
artifactFileOpt: (Module, String, Artifact) => Option[File],
|
||||
keepPomArtifact: Boolean = false
|
||||
): sbt.UpdateReport = {
|
||||
|
||||
val configReports = configs.map {
|
||||
|
|
@ -163,7 +173,7 @@ object ToSbt {
|
|||
val configDeps = extends0.flatMap(configDependencies.getOrElse(_, Nil))
|
||||
val subRes = resolution.subset(configDeps)
|
||||
|
||||
val reports = ToSbt.moduleReports(subRes, classifiersOpt, artifactFileOpt)
|
||||
val reports = ToSbt.moduleReports(subRes, classifiersOpt, artifactFileOpt, keepPomArtifact)
|
||||
|
||||
new ConfigurationReport(
|
||||
config,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
lazy val noPomCheck = TaskKey[Unit]("noPomCheck")
|
||||
|
||||
noPomCheck := {
|
||||
|
||||
val configReport = update.value
|
||||
.configuration("compile")
|
||||
.getOrElse {
|
||||
throw new Exception(
|
||||
"compile configuration not found in update report"
|
||||
)
|
||||
}
|
||||
|
||||
val artifacts = configReport
|
||||
.modules
|
||||
.flatMap(_.artifacts)
|
||||
.map(_._1)
|
||||
|
||||
val pomArtifacts = artifacts
|
||||
.filter { a =>
|
||||
a.`type` == "pom" && a.classifier.isEmpty
|
||||
}
|
||||
|
||||
for (a <- pomArtifacts)
|
||||
streams.value.log.error(s"Found POM artifact $a")
|
||||
|
||||
assert(pomArtifacts.isEmpty)
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
val pluginVersion = sys.props.getOrElse(
|
||||
"plugin.version",
|
||||
throw new RuntimeException(
|
||||
"""|The system property 'plugin.version' is not defined.
|
||||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
|
||||
)
|
||||
)
|
||||
|
||||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
> noPomCheck
|
||||
Loading…
Reference in New Issue