Skip to content

Commit

Permalink
switch to common update checker
Browse files Browse the repository at this point in the history
  • Loading branch information
pfn committed Sep 30, 2015
1 parent 8347ba4 commit fabb080
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 48 deletions.
1 change: 1 addition & 0 deletions build.sbt
Expand Up @@ -46,6 +46,7 @@ val plugin = project.in(file("sbt-plugin")).settings(
"-Dplugin.version=" + version.value
),
bintrayOrganization in bintray := None,
libraryDependencies += "com.hanhuy.sbt" %% "bintray-update-checker" % "0.1",
mappings in (Compile, packageBin) ++= (mappings in (Compile, packageBin) in common).value
).dependsOn(common % "provided")

Expand Down
46 changes: 0 additions & 46 deletions sbt-plugin/src/main/scala/UpdateChecker.scala

This file was deleted.

21 changes: 19 additions & 2 deletions sbt-plugin/src/main/scala/plugin.scala
Expand Up @@ -6,6 +6,7 @@ import java.net.URLEncoder
import android.Keys.Internal._
import android.{BuildOutput, Aggregate, Dex}
import com.android.ddmlib.IDevice
import com.hanhuy.sbt.bintray.UpdateChecker
import sbt.Def.Initialize
import sbt._
import sbt.Keys._
Expand Down Expand Up @@ -35,8 +36,24 @@ object Plugin extends AutoPlugin {
val autoImport = Keys


override def projectSettings =
updateCheck in Keys.Protify := UpdateChecker(streams.value.log) :: Nil
override def projectSettings = Seq(updateCheck in Keys.Protify := {
val log = streams.value.log
UpdateChecker("pfn", "sbt-plugins", "android-protify") {
case Left(t) =>
log.debug("Failed to load version info: " + t)
case Right((versions, current)) =>
log.debug("available versions: " + versions)
log.debug("current version: " + BuildInfo.version)
log.debug("latest version: " + current)
if (versions(BuildInfo.version)) {
if (BuildInfo.version != current) {
log.warn(
s"UPDATE: A newer android-protify is available:" +
s" $version, currently running: ${BuildInfo.version}")
}
}
}
})

override def globalSettings = (onLoad := onLoad.value andThen { s =>
Project.runTask(updateCheck in Keys.Protify, s).fold(s)(_._1)
Expand Down

0 comments on commit fabb080

Please sign in to comment.