diff --git a/.travis.yml b/.travis.yml index 3d89ad1..c126901 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,17 @@ language: scala sudo: false +jdk: openjdk8 jobs: include: - stage: test script: sbt test scripted - jdk: openjdk7 - stage: test script: sbt ^^1.0.0 test scripted - jdk: oraclejdk8 - stage: deploy-sbt-0.13 script: skip - jdk: openjdk7 deploy: provider: script script: sbt publish @@ -23,7 +21,6 @@ jobs: - stage: deploy-sbt-1.0 script: skip - jdk: oraclejdk8 deploy: provider: script script: sbt ^^1.0.0 publish @@ -46,4 +43,3 @@ env: - secure: "eo+yjPcu9FZnK4ZhR5hGo6ZmWAyp2rwm1/KmaTyVcc9DMhn4YWv5DlxsnkVcPvX+RXOOSMy3zh+kK3PKRCsNSWGNICUulP5XmOT1cR55X3455kvRvzUzIXKlapw/jPU8eo+ak/g/KlWGql6y254oQfMZL5cNoC8GMfT8vLFIQhE=" # travis encrypt BINTRAY_PASS=... - secure: "jTaZa7TqL/Kev8WZPvqaJXaI4aMLfPua4SZo9fFbUvSob1+m09cDgS33VDohq+d45n/+gSDCHePSm2/tDlqti3utM/9X3xkzUhn3kJM/70Rq1cCmBsPlnFCpnDoGYPOCBskTo1dVbmab0WIpdUtfETTe6+3jlu7ijFfXaR7Yy3c=" - diff --git a/src/main/scala/BintrayPlugin.scala b/src/main/scala/BintrayPlugin.scala index 28b194b..3689a40 100644 --- a/src/main/scala/BintrayPlugin.scala +++ b/src/main/scala/BintrayPlugin.scala @@ -18,6 +18,12 @@ object BintrayPlugin extends AutoPlugin { override def buildSettings: Seq[Setting[_]] = buildPublishSettings override def projectSettings: Seq[Setting[_]] = bintraySettings + lazy val isEnabledViaProp: Boolean = sys.props.get("sbt.sbtbintray") + .getOrElse("true").toLowerCase(java.util.Locale.ENGLISH) match { + case "true" | "1" | "always" => true + case _ => false + } + object autoImport extends BintrayKeys { } @@ -117,9 +123,22 @@ object BintrayPlugin extends AutoPlugin { repo.release(bintrayPackage.value, version.value, streams.value.log) } ) ++ Seq( - resolvers ++= (resolvers in bintray).value, - credentials ++= (credentials in bintray).value, - publishTo := (publishTo in bintray).value, + resolvers ++= { + val rs = (resolvers in bintray).value + if (isEnabledViaProp) rs + else Nil + }, + credentials ++= { + val cs = (credentials in bintray).value + if (isEnabledViaProp) cs + else Nil + }, + publishTo := { + val old = publishTo.value + val p = (publishTo in bintray).value + if (isEnabledViaProp) p + else old + }, publish := dynamicallyPublish.value ) @@ -141,8 +160,10 @@ object BintrayPlugin extends AutoPlugin { val sk = ((skip in publish) ?? false).value val s = streams.value val ref = thisProjectRef.value - if (sk) Def.task { - s.log.debug(s"Skipping publish for ${ref.project}") + + if (!isEnabledViaProp) publishTask(publishConfiguration, deliver) + else if (sk) Def.task { + s.log.debug(s"skipping publish for ${ref.project}") } else dynamicallyPublish0 }