mirror of https://github.com/sbt/sbt.git
Ivy Artifact needs wildcard configuration added if no explicit ones are defined. Fixes #439.
This commit is contained in:
parent
070a87dda4
commit
37f937402f
|
|
@ -420,7 +420,7 @@ private object IvySbt
|
|||
private def toIvyArtifact(moduleID: ModuleDescriptor, a: Artifact, configurations: Iterable[String]): MDArtifact =
|
||||
{
|
||||
val artifact = new MDArtifact(moduleID, a.name, a.`type`, a.extension, null, extra(a, false))
|
||||
configurations.foreach(artifact.addConfiguration)
|
||||
copyConfigurations(a, artifact.addConfiguration)
|
||||
artifact
|
||||
}
|
||||
def getExtraAttributes(revID: ExtendableItem): Map[String,String] =
|
||||
|
|
@ -563,6 +563,7 @@ private object IvySbt
|
|||
import artifact.{name, classifier, `type`, extension, url}
|
||||
val extraMap = extra(artifact)
|
||||
val ivyArtifact = new DefaultDependencyArtifactDescriptor(dependencyDescriptor, name, `type`, extension, url.getOrElse(null), extraMap)
|
||||
copyConfigurations(artifact, ivyArtifact.addConfiguration)
|
||||
for(conf <- dependencyDescriptor.getModuleConfigurations)
|
||||
dependencyDescriptor.addDependencyArtifact(conf, ivyArtifact)
|
||||
}
|
||||
|
|
@ -575,6 +576,11 @@ private object IvySbt
|
|||
}
|
||||
dependencyDescriptor
|
||||
}
|
||||
def copyConfigurations(artifact: Artifact, addConfiguration: String => Unit): Unit =
|
||||
if(artifact.configurations.isEmpty)
|
||||
addConfiguration("*")
|
||||
else
|
||||
artifact.configurations.foreach(c => addConfiguration(c.name))
|
||||
|
||||
def addOverrides(moduleID: DefaultModuleDescriptor, overrides: Set[ModuleID], matcher: PatternMatcher): Unit =
|
||||
overrides foreach addOverride(moduleID, matcher)
|
||||
|
|
@ -601,8 +607,9 @@ private object IvySbt
|
|||
|
||||
/** This method is used to add inline artifacts to the provided module. */
|
||||
def addArtifacts(moduleID: DefaultModuleDescriptor, artifacts: Iterable[Artifact]): Unit =
|
||||
for(art <- mapArtifacts(moduleID, artifacts.toSeq); c <- art.getConfigurations)
|
||||
for(art <- mapArtifacts(moduleID, artifacts.toSeq); c <- art.getConfigurations if c != "*")
|
||||
moduleID.addArtifact(c, art)
|
||||
|
||||
def addConfigurations(mod: DefaultModuleDescriptor, configurations: Iterable[Configuration]): Unit =
|
||||
configurations.foreach(config => mod.addConfiguration(toIvyConfiguration(config)))
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
// verifies that a can be published as an ivy.xml file and preserve the extra artifact information,
|
||||
// such as a classifier
|
||||
lazy val a = project.settings(common: _*).settings(
|
||||
libraryDependencies := Seq("net.sf.json-lib" % "json-lib" % "2.4" classifier "jdk15" intransitive())
|
||||
)
|
||||
|
||||
lazy val b = project.settings(common: _*).settings(
|
||||
libraryDependencies := Seq(organization.value %% "a" % version.value)
|
||||
)
|
||||
|
||||
organization in ThisBuild := "org.example"
|
||||
|
||||
version in ThisBuild := "1.0"
|
||||
|
||||
lazy val common = Seq(
|
||||
autoScalaLibrary := false, // avoid downloading fresh scala-library/scala-compiler
|
||||
managedScalaInstance := false,
|
||||
ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache"))
|
||||
)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
> a/publish-local
|
||||
> b/update
|
||||
Loading…
Reference in New Issue