mirror of https://github.com/sbt/sbt.git
Merge pull request #1983 from sbt/wip/nightly-bintray
publish nightlies to bintray
This commit is contained in:
commit
d6a77b3a81
|
|
@ -15,7 +15,7 @@ def buildLevelSettings: Seq[Setting[_]] = Seq(
|
|||
// bintrayOrganization in ThisBuild := None,
|
||||
// bintrayRepository in ThisBuild := "test-test-test",
|
||||
bintrayOrganization in ThisBuild := Some("sbt"),
|
||||
bintrayRepository in ThisBuild := "ivy-releases",
|
||||
bintrayRepository in ThisBuild := s"ivy-${(publishStatus in ThisBuild).value}",
|
||||
bintrayPackage in ThisBuild := "sbt"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,29 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
import java.util.regex.Pattern
|
||||
|
||||
object StatusPlugin extends AutoPlugin {
|
||||
override def requires = plugins.JvmPlugin
|
||||
override def trigger = allRequirements
|
||||
|
||||
object autoImport {
|
||||
lazy val publishStatus = SettingKey[String]("publish-status")
|
||||
lazy val publishStatus = settingKey[String]("possible values are snapshots or releases.")
|
||||
}
|
||||
|
||||
import autoImport._
|
||||
|
||||
override def buildSettings: Seq[Setting[_]] = Seq(
|
||||
isSnapshot <<= version(v => v.contains("-") && snapshotQualifier(v)),
|
||||
publishStatus <<= isSnapshot { snap => if (snap) "snapshots" else "releases" },
|
||||
isSnapshot := {
|
||||
val SnapshotQualifier = """(.+)(-.*SNAPSHOT)(.*)""".r
|
||||
val v = version.value
|
||||
v match {
|
||||
case SnapshotQualifier(_, _, _) => true
|
||||
case _ => false
|
||||
}
|
||||
},
|
||||
publishStatus := {
|
||||
if (isSnapshot.value) "snapshots"
|
||||
else "releases"
|
||||
},
|
||||
commands += stampVersion
|
||||
)
|
||||
def stampVersion = Command.command("stamp-version") { state =>
|
||||
|
|
@ -29,17 +38,14 @@ object StatusPlugin extends AutoPlugin {
|
|||
state)
|
||||
}
|
||||
def stamp(v: String): String =
|
||||
if (v endsWith Snapshot)
|
||||
(v stripSuffix Snapshot) + "-" + timestampString(System.currentTimeMillis)
|
||||
else
|
||||
error("Release version '" + v + "' cannot be stamped")
|
||||
{
|
||||
val Snapshot = "-SNAPSHOT"
|
||||
if (v endsWith Snapshot) (v stripSuffix Snapshot) + "-" + timestampString(System.currentTimeMillis)
|
||||
else sys.error("Release version '" + v + "' cannot be stamped")
|
||||
}
|
||||
def timestampString(time: Long): String =
|
||||
{
|
||||
val format = new java.text.SimpleDateFormat("yyyyMMdd-HHmmss")
|
||||
format.format(new java.util.Date(time))
|
||||
}
|
||||
final val Snapshot = "-SNAPSHOT"
|
||||
// NOte: This moved into sbt itself... But we need to add semantic knowledge of how
|
||||
// we stamp our nightlies.
|
||||
def snapshotQualifier(v: String) = Pattern.matches(""".+-.*SNAPSHOT.*""", v)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue