diff --git a/build.sbt b/build.sbt index b6a48d173..cb9b46a49 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,12 @@ import Sxr.sxr // but can be shared across the multi projects. def buildLevelSettings: Seq[Setting[_]] = Seq( organization in ThisBuild := "org.scala-sbt", - version in ThisBuild := "0.13.9-SNAPSHOT" + version in ThisBuild := "0.13.9-SNAPSHOT", + // bintrayOrganization in ThisBuild := None, + // bintrayRepository in ThisBuild := "test-test-test", + bintrayOrganization in ThisBuild := Some("sbt"), + bintrayRepository in ThisBuild := "ivy-releases", + bintrayPackage in ThisBuild := "sbt" ) def commonSettings: Seq[Setting[_]] = Seq( @@ -26,7 +31,9 @@ def commonSettings: Seq[Setting[_]] = Seq( testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"), incOptions := incOptions.value.withNameHashing(true), - crossScalaVersions := Seq(scala210) + crossScalaVersions := Seq(scala210), + bintrayPackage := (bintrayPackage in ThisBuild).value, + bintrayRepository := (bintrayRepository in ThisBuild).value ) def minimalSettings: Seq[Setting[_]] = @@ -478,7 +485,7 @@ def allProjects = Seq(interfaceProj, apiProj, def projectsWithMyProvided = allProjects.map(p => p.copy(configurations = (p.configurations.filter(_ != Provided)) :+ myProvided)) lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id)) -def rootSettings = Release.releaseSettings ++ fullDocSettings ++ +def rootSettings = fullDocSettings ++ Util.publishPomSettings ++ otherRootSettings ++ Formatting.sbtFilesSettings /*++ Transform.conscriptSettings(launchProj)*/ def otherRootSettings = Seq( diff --git a/project/Release.scala b/project/Release.scala index e3fdb7729..2c8d669fc 100644 --- a/project/Release.scala +++ b/project/Release.scala @@ -1,63 +1,21 @@ import sbt._ import Keys._ -import StatusPlugin.autoImport._ -import org.apache.ivy.util.url.CredentialsStore import com.typesafe.sbt.JavaVersionCheckPlugin.autoImport._ +import _root_.bintray.BintrayPlugin.autoImport._ +import _root_.bintray.InternalBintrayKeys._ -object Release extends Build { - lazy val remoteBase = SettingKey[String]("remote-base") - lazy val remoteID = SettingKey[String]("remote-id") +object Release { lazy val launcherRemotePath = SettingKey[String]("launcher-remote-path") lazy val deployLauncher = TaskKey[Unit]("deploy-launcher", "Upload the launcher to its traditional location for compatibility with existing scripts.") - lazy val checkCredentials = TaskKey[Unit]("checkCredentials", "Checks to ensure credentials for this user exists.") - - val PublishRepoHost = "private-repo.typesafe.com" def launcherSettings(launcher: TaskKey[File]): Seq[Setting[_]] = Seq( - launcherRemotePath <<= (organization, version, moduleName) { (org, v, n) => List(org, n, v, n + ".jar").mkString("/") }, - deployLauncher <<= deployLauncher(launcher) + launcherRemotePath := s"${organization.value}/${moduleName.value}/${version.value}/${moduleName.value}.jar", + deployLauncher := { + val repo = bintrayRepo.value + repo.upload(bintrayPackage.value, version.value, launcherRemotePath.value, launcher.value, sLog.value) + } ) - // Add credentials if they exist. - def lameCredentialSettings: Seq[Setting[_]] = - if (CredentialsFile.exists) Seq(credentials in ThisBuild += Credentials(CredentialsFile)) - else Nil - def releaseSettings: Seq[Setting[_]] = Seq( - publishTo in ThisBuild <<= publishResolver, - remoteID in ThisBuild <<= publishStatus("typesafe-ivy-" + _), - remoteBase in ThisBuild <<= publishStatus("https://" + PublishRepoHost + "/typesafe/ivy-" + _), - checkCredentials := { - // Note - This will eitehr issue a failure or succeed. - getCredentials(credentials.value, streams.value.log) - } - ) ++ lameCredentialSettings ++ javaVersionCheckSettings - - def snapshotPattern(version: String) = Resolver.localBasePattern.replaceAll("""\[revision\]""", version) - def publishResolver: Def.Initialize[Option[Resolver]] = (remoteID, remoteBase) { (id, base) => - Some(Resolver.url("publish-" + id, url(base))(Resolver.ivyStylePatterns)) - } - - lazy val CredentialsFile: File = Path.userHome / ".ivy2" / ".typesafe-credentials" - - // this is no longer strictly necessary, since the launcher is now published as normal - // however, existing scripts expect the launcher to be in a certain place and normal publishing adds "jars/" - // to the published path - def deployLauncher(launcher: TaskKey[File]) = - (launcher, launcherRemotePath, credentials, remoteBase, streams) map { (launchJar, remotePath, creds, base, s) => - val (uname, pwd) = getCredentials(creds, s.log) - val request = dispatch.classic.url(base) / remotePath <<< (launchJar, "binary/octet-stream") as (uname, pwd) - val http = new dispatch.classic.Http - try { http(request.as_str) } finally { http.shutdown() } - () - } - def getCredentials(cs: Seq[Credentials], log: Logger): (String, String) = - { - Credentials.forHost(cs, PublishRepoHost) match { - case Some(creds) => (creds.userName, creds.passwd) - case None => sys.error("No credentials defined for " + PublishRepoHost) - } - } - def javaVersionCheckSettings = Seq( javaVersionPrefix in javaVersionCheck := Some("1.6") ) diff --git a/project/Transform.scala b/project/Transform.scala index 25eee5308..950aadd6f 100644 --- a/project/Transform.scala +++ b/project/Transform.scala @@ -88,7 +88,7 @@ object Transform { def read(file: File): Option[String] = try { Some(IO.read(file)) } catch { case _: java.io.IOException => None } lazy val Property = """\$\{\{([\w.-]+)\}\}""".r - def repositories(isSnapshot: Boolean) = Releases :: (if (isSnapshot) Snapshots :: SonatypeSnapshots :: Nil else Nil) + def repositories(isSnapshot: Boolean) = Releases :: (if (isSnapshot) Snapshots :: SonatypeSnapshots :: Nil else Nil) lazy val Releases = typesafeRepository("releases") lazy val Snapshots = typesafeRepository("snapshots") lazy val SonatypeSnapshots = sonatypeRepsoitory("snapshots") diff --git a/project/bintray.sbt b/project/bintray.sbt new file mode 100644 index 000000000..0e8fa42ab --- /dev/null +++ b/project/bintray.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("com.eed3si9n" % "bintray-sbt" % "0.3.0-a1934a5457f882053b08cbdab5fd4eb3c2d1285d") +resolvers += Resolver.url("bintray-eed3si9n-sbt-plugins", url("https://dl.bintray.com/eed3si9n/sbt-plugins/"))(Resolver.ivyStylePatterns)