mirror of https://github.com/sbt/sbt.git
Ensure we write api URL info in ivy.xml (#66)
This commit is contained in:
parent
f993b8db91
commit
1499a15730
|
|
@ -128,6 +128,14 @@ object FromSbt {
|
|||
|
||||
val deps = allDependencies.flatMap(dependencies(_, scalaVersion, scalaBinaryVersion))
|
||||
|
||||
val prefix = "e:" + SbtPomExtraProperties.POM_INFO_KEY_PREFIX
|
||||
val properties = projectID
|
||||
.extraAttributes
|
||||
.filterKeys(_.startsWith(prefix))
|
||||
.toSeq
|
||||
.map { case (k, v) => (k.stripPrefix("e:"), v) }
|
||||
.sortBy(_._1)
|
||||
|
||||
Project(
|
||||
Module(
|
||||
Organization(projectID.organization),
|
||||
|
|
@ -137,7 +145,7 @@ object FromSbt {
|
|||
projectID.revision,
|
||||
deps,
|
||||
ivyConfigurations,
|
||||
Nil,
|
||||
properties,
|
||||
None,
|
||||
Nil,
|
||||
Info("", "", Nil, Nil, None)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ object IvyXml {
|
|||
}
|
||||
)
|
||||
|
||||
val infoAttrs = project.module.attributes.foldLeft[xml.MetaData](xml.Null) {
|
||||
val props = project.module.attributes.toSeq ++ project.properties
|
||||
val infoAttrs = props.foldLeft[xml.MetaData](xml.Null) {
|
||||
case (acc, (k, v)) =>
|
||||
new PrefixedAttribute("e", k, v, acc)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
lazy val b = project
|
||||
.settings(
|
||||
apiURL := Some(url(s"http://example.org/b")),
|
||||
publishMavenStyle := false,
|
||||
publishTo := Some(bResolver.value),
|
||||
organization := "b",
|
||||
version := "0.1.0-SNAPSHOT"
|
||||
)
|
||||
|
||||
lazy val bResolver = Def.setting {
|
||||
val dir = baseDirectory.in(ThisBuild).value / "b-repo"
|
||||
Resolver.file("b-resolver", dir)(Resolver.defaultIvyPatterns)
|
||||
}
|
||||
|
||||
lazy val check = taskKey[Unit]("")
|
||||
|
||||
check := {
|
||||
import java.nio.file._
|
||||
val f = baseDirectory.in(ThisBuild).value / "b-repo/b/b_2.12/0.1.0-SNAPSHOT/ivys/ivy.xml"
|
||||
assert(f.exists())
|
||||
val content = new String(Files.readAllBytes(f.toPath), "UTF-8")
|
||||
assert(content.contains("""e:info.apiURL="http://example.org/b""""))
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
addSbtPlugin {
|
||||
|
||||
val name = sys.props.getOrElse(
|
||||
"plugin.name",
|
||||
sys.error("plugin.name Java property not set")
|
||||
)
|
||||
val version = sys.props.getOrElse(
|
||||
"plugin.version",
|
||||
sys.error("plugin.version Java property not set")
|
||||
)
|
||||
|
||||
"io.get-coursier" % name % version
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
$ delete b-repo
|
||||
> b/publish
|
||||
> check
|
||||
Loading…
Reference in New Issue