Skip to content
This repository has been archived by the owner on Feb 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #179 from eed3si9n/wip/disable
Browse files Browse the repository at this point in the history
-Dsbt.sbtbintray=false to disable the plugin
  • Loading branch information
eed3si9n authored Dec 26, 2019
2 parents 0bf8ac3 + 5c61ae0 commit 13ab83f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,7 +21,6 @@ jobs:

- stage: deploy-sbt-1.0
script: skip
jdk: oraclejdk8
deploy:
provider: script
script: sbt ^^1.0.0 publish
Expand All @@ -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="

31 changes: 26 additions & 5 deletions src/main/scala/BintrayPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}

Expand Down Expand Up @@ -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
)

Expand All @@ -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
}
Expand Down

0 comments on commit 13ab83f

Please sign in to comment.