diff options
Diffstat (limited to 'project/Bintray.scala.notyet')
-rw-r--r-- | project/Bintray.scala.notyet | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/project/Bintray.scala.notyet b/project/Bintray.scala.notyet new file mode 100644 index 0000000..8bcf442 --- /dev/null +++ b/project/Bintray.scala.notyet @@ -0,0 +1,70 @@ +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) + +} |