blob: 8bcf442403e17ee6f122d46912e2ad986f2f089a (
plain) (
tree)
|
|
package flow
import sbt._
import sbt.Keys._
import ch.jodersky.sbt.jni.plugins.JniPackaging
import ch.jodersky.sbt.jni.plugins.JniPackaging.autoImport._
import bintray._
import bintray.BintrayPlugin.autoImport._
/** Custom bintray tasks. */
object CustomBintray extends AutoPlugin {
override def requires = JniPackaging && BintrayPlugin
override def trigger = allRequirements
object autoImport {
val unmanagedNativeZip = taskKey[File](
"Packages unmanaged native libraries in a zip file."
)
val publishNativeZip = taskKey[Unit](
"Signs and publishes native zip files to a generic bintray repository."
)
}
import autoImport._
lazy val settings: Seq[Setting[_]] = Seq(
unmanagedNativeZip := {
val out = target.value / (name.value + "-native.zip")
val files: Seq[File] = unmanagedNativeDirectories.value flatMap {dir =>
(dir ** "*").get.filter(_.isFile)
}
val baseDirectories: Seq[File] = unmanagedNativeDirectories.value
val mappings: Seq[(File,String)] = files pair Path.relativeTo(baseDirectories)
IO.zip(mappings, out)
out
},
publishNativeZip := {
val credsFile = bintrayCredentialsFile.value
val btyOrg = bintrayOrganization.value
val repoName = "generic"
val zip = unmanagedNativeZip.value
Bintray.withRepo(credsFile, btyOrg, repoName, prompt = false) { repo =>
//def upload(packageName: String, vers: String, path: String, f: File, log: Logger): Unit =
repo.upload(
"flow",
version.value,
zip.name,
zip,
streams.value.log
)
}
}
)
override def projectSettings = inConfig(Compile)(settings)
}
|