{"action":"created","comment":{"url":"https://api.github.com/repos/softprops/bintray-sbt/pulls/comments/28558751","id":28558751,"diff_hunk":"@@ -0,0 +1,194 @@\n+package bintray\n+\n+import bintry.Attr\n+import sbt.{ AutoPlugin, Credentials, Global, Path, Resolver, Setting, Task, Tags, ThisBuild }\n+import sbt.Def.{ Initialize, setting, task, taskDyn }\n+import sbt.Keys._\n+import sbt.Path.richFile\n+\n+object BintrayPlugin extends AutoPlugin {\n+  import BintrayKeys._\n+  import InternalBintrayKeys._\n+\n+  override def requires = sbt.plugins.JvmPlugin\n+  override def trigger = allRequirements\n+  \n+  override def globalSettings: Seq[Setting[_]] = globalPublishSettings\n+  override def buildSettings: Seq[Setting[_]] = buildPublishSettings\n+  override def projectSettings: Seq[Setting[_]] = bintraySettings\n+\n+  object autoImport extends BintrayKeys {\n+  }\n+\n+  lazy val Git = Tags.Tag(\"git\")\n+\n+  def bintraySettings: Seq[Setting[_]] =\n+    bintrayCommonSettings ++ bintrayPublishSettings ++ bintrayQuerySettings\n+\n+  def bintrayCommonSettings: Seq[Setting[_]] = Seq(\n+    bintrayChangeCredentials := {\n+      Bintray.changeCredentials(bintrayCredentialsFile.value)\n+    },\n+    bintrayWhoami := {\n+      Bintray.whoami(bintrayCredentialsFile.value, sLog.value)\n+    }\n+  )\n+\n+  def bintrayQuerySettings: Seq[Setting[_]] = Seq(\n+    bintrayPackageVersions <<= packageVersionsTask\n+  )\n+\n+  def globalPublishSettings: Seq[Setting[_]] = Seq(\n+    bintrayCredentialsFile in Global := Path.userHome / \".bintray\" / \".credentials\",\n+    concurrentRestrictions in Global += Tags.exclusive(Git)\n+  )\n+\n+  def buildPublishSettings: Seq[Setting[_]] = Seq(\n+    bintrayOrganization in ThisBuild := None,\n+    bintrayVcsUrl in ThisBuild := vcsUrlTask.value,\n+    bintrayReleaseOnPublish in ThisBuild := false\n+  )\n+\n+  def bintrayPublishSettings: Seq[Setting[_]] = bintrayCommonSettings ++ Seq(\n+    bintrayPackage := moduleName.value,\n+    bintrayRepo := BintrayRepo(bintrayEnsureCredentials.value,\n+      bintrayOrganization.value,\n+      bintrayRepository.value),\n+    // todo: don't force this to be sbt-plugin-releases\n+    bintrayRepository := {\n+      if (sbtPlugin.value) Bintray.defaultSbtPluginRepository\n+      else Bintray.defaultMavenRepository\n+    },\n+    publishMavenStyle := {\n+      if (sbtPlugin.value) false else publishMavenStyle.value\n+    },\n+    bintrayPackageLabels := Nil,\n+    description in bintray <<= description,\n+    // note: publishTo may not have dependencies. therefore, we can not rely well on inline overrides\n+    // for inline credentials resolution we recommend defining bintrayCredentials _before_ mixing in the defaults\n+    // perhaps we should try overriding something in the publishConfig setting -- https://github.com/sbt/sbt-pgp/blob/master/pgp-plugin/src/main/scala/com/typesafe/sbt/pgp/PgpSettings.scala#L124-L131\n+    publishTo in bintray <<= publishToBintray,\n+    resolvers in bintray := {\n+      Bintray.buildResolvers(bintrayCredentialsFile.value,\n+        bintrayOrganization.value,\n+        bintrayRepository.value)\n+    },\n+    credentials in bintray := {\n+      Credentials(bintrayCredentialsFile.value) :: Nil\n+    },\n+    bintrayPackageAttributes := {\n+      if (sbtPlugin.value) Map(AttrNames.sbtPlugin -> Seq(Attr.Boolean(sbtPlugin.value)))\n+      else Map.empty\n+    },\n+    bintrayVersionAttributes := {\n+      val scalaVersions = crossScalaVersions.value\n+      val sv = Map(AttrNames.scalas -> scalaVersions.map(Attr.Version(_)))\n+      if (sbtPlugin.value) sv ++ Map(AttrNames.sbtVersion-> Seq(Attr.Version(sbtVersion.value)))\n+      else sv\n+    },\n+    bintrayOmitLicense := {\n+      if (sbtPlugin.value) sbtPlugin.value\n+      else false\n+    },\n+    bintrayEnsureLicenses := {\n+      Bintray.ensureLicenses(licenses.value, bintrayOmitLicense.value)\n+    },\n+    bintrayEnsureCredentials := {\n+      Bintray.ensuredCredentials(bintrayCredentialsFile.value).get\n+    },\n+    bintrayEnsureBintrayPackageExists <<= ensurePackageTask,\n+    bintrayUnpublish := {\n+      val e1 = bintrayEnsureBintrayPackageExists\n+      val e2 = bintrayEnsureLicenses\n+      val repo = bintrayRepo.value\n+      repo.unpublish(bintrayPackage.value, version.value, sLog.value)\n+    },\n+    bintrayRemoteSign := {\n+      val repo = bintrayRepo.value\n+      repo.remoteSign(bintrayPackage.value, version.value, sLog.value)\n+    },\n+    bintraySyncMavenCentral := {\n+      val repo = bintrayRepo.value\n+      repo.syncMavenCentral(bintrayPackage.value, version.value, credentials.value, sLog.value)\n+    },\n+    bintrayRelease := {\n+      val _ = publishVersionAttributesTask.value\n+      val repo = bintrayRepo.value\n+      repo.release(bintrayPackage.value, version.value, sLog.value)\n+    }\n+  ) ++ Seq(\n+    resolvers <++= resolvers in bintray,\n+    credentials <++= credentials in bintray,\n+    publishTo <<= publishTo in bintray, \n+    publish := dynamicallyPublish.value\n+  )\n+\n+  private def vcsUrlTask: Initialize[Task[Option[String]]] =\n+    task {\n+      Bintray.resolveVcsUrl.recover { case _ => None }.get\n+    } tag(Git)\n+\n+  private def dynamicallyPublish: Initialize[Task[Unit]] =\n+    taskDyn {","path":"src/main/scala/BintrayPlugin.scala","position":132,"original_position":132,"commit_id":"9487f9c9817c99cf0afe5ec7196dcec597552f3a","original_commit_id":"9487f9c9817c99cf0afe5ec7196dcec597552f3a","user":{"login":"softprops","id":2242,"avatar_url":"https://avatars.githubusercontent.com/u/2242?v=3","gravatar_id":"","url":"https://api.github.com/users/softprops","html_url":"https://github.com/softprops","followers_url":"https://api.github.com/users/softprops/followers","following_url":"https://api.github.com/users/softprops/following{/other_user}","gists_url":"https://api.github.com/users/softprops/gists{/gist_id}","starred_url":"https://api.github.com/users/softprops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softprops/subscriptions","organizations_url":"https://api.github.com/users/softprops/orgs","repos_url":"https://api.github.com/users/softprops/repos","events_url":"https://api.github.com/users/softprops/events{/privacy}","received_events_url":"https://api.github.com/users/softprops/received_events","type":"User","site_admin":false},"body":"Interesting, I'm learning a lot about whats changed recently in sbt in this pull :)","created_at":"2015-04-16T23:18:04Z","updated_at":"2015-04-16T23:18:04Z","html_url":"https://github.com/softprops/bintray-sbt/pull/53#discussion_r28558751","pull_request_url":"https://api.github.com/repos/softprops/bintray-sbt/pulls/53","_links":{"self":{"href":"https://api.github.com/repos/softprops/bintray-sbt/pulls/comments/28558751"},"html":{"href":"https://github.com/softprops/bintray-sbt/pull/53#discussion_r28558751"},"pull_request":{"href":"https://api.github.com/repos/softprops/bintray-sbt/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/softprops/bintray-sbt/pulls/53","id":33328004,"html_url":"https://github.com/softprops/bintray-sbt/pull/53","diff_url":"https://github.com/softprops/bintray-sbt/pull/53.diff","patch_url":"https://github.com/softprops/bintray-sbt/pull/53.patch","issue_url":"https://api.github.com/repos/softprops/bintray-sbt/issues/53","number":53,"state":"open","locked":false,"title":"auto plugin + stage/release","user":{"login":"eed3si9n","id":184683,"avatar_url":"https://avatars.githubusercontent.com/u/184683?v=3","gravatar_id":"","url":"https://api.github.com/users/eed3si9n","html_url":"https://github.com/eed3si9n","followers_url":"https://api.github.com/users/eed3si9n/followers","following_url":"https://api.github.com/users/eed3si9n/following{/other_user}","gists_url":"https://api.github.com/users/eed3si9n/gists{/gist_id}","starred_url":"https://api.github.com/users/eed3si9n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eed3si9n/subscriptions","organizations_url":"https://api.github.com/users/eed3si9n/orgs","repos_url":"https://api.github.com/users/eed3si9n/repos","events_url":"https://api.github.com/users/eed3si9n/events{/privacy}","received_events_url":"https://api.github.com/users/eed3si9n/received_events","type":"User","site_admin":false},"body":"Fixes #52\r\n","created_at":"2015-04-15T07:12:51Z","updated_at":"2015-04-16T23:18:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29e3011f013aa55920a61ba283e0500d9cce372d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/softprops/bintray-sbt/pulls/53/commits","review_comments_url":"https://api.github.com/repos/softprops/bintray-sbt/pulls/53/comments","review_comment_url":"https://api.github.com/repos/softprops/bintray-sbt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/softprops/bintray-sbt/issues/53/comments","statuses_url":"https://api.github.com/repos/softprops/bintray-sbt/statuses/9487f9c9817c99cf0afe5ec7196dcec597552f3a","head":{"label":"eed3si9n:topic/auto-plugins","ref":"topic/auto-plugins","sha":"9487f9c9817c99cf0afe5ec7196dcec597552f3a","user":{"login":"eed3si9n","id":184683,"avatar_url":"https://avatars.githubusercontent.com/u/184683?v=3","gravatar_id":"","url":"https://api.github.com/users/eed3si9n","html_url":"https://github.com/eed3si9n","followers_url":"https://api.github.com/users/eed3si9n/followers","following_url":"https://api.github.com/users/eed3si9n/following{/other_user}","gists_url":"https://api.github.com/users/eed3si9n/gists{/gist_id}","starred_url":"https://api.github.com/users/eed3si9n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eed3si9n/subscriptions","organizations_url":"https://api.github.com/users/eed3si9n/orgs","repos_url":"https://api.github.com/users/eed3si9n/repos","events_url":"https://api.github.com/users/eed3si9n/events{/privacy}","received_events_url":"https://api.github.com/users/eed3si9n/received_events","type":"User","site_admin":false},"repo":{"id":33977973,"name":"bintray-sbt","full_name":"eed3si9n/bintray-sbt","owner":{"login":"eed3si9n","id":184683,"avatar_url":"https://avatars.githubusercontent.com/u/184683?v=3","gravatar_id":"","url":"https://api.github.com/users/eed3si9n","html_url":"https://github.com/eed3si9n","followers_url":"https://api.github.com/users/eed3si9n/followers","following_url":"https://api.github.com/users/eed3si9n/following{/other_user}","gists_url":"https://api.github.com/users/eed3si9n/gists{/gist_id}","starred_url":"https://api.github.com/users/eed3si9n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eed3si9n/subscriptions","organizations_url":"https://api.github.com/users/eed3si9n/orgs","repos_url":"https://api.github.com/users/eed3si9n/repos","events_url":"https://api.github.com/users/eed3si9n/events{/privacy}","received_events_url":"https://api.github.com/users/eed3si9n/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eed3si9n/bintray-sbt","description":"fresh packages delivered from your sbt console","fork":true,"url":"https://api.github.com/repos/eed3si9n/bintray-sbt","forks_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/forks","keys_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/teams","hooks_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/hooks","issue_events_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/issues/events{/number}","events_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/events","assignees_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/assignees{/user}","branches_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/branches{/branch}","tags_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/tags","blobs_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/git/refs{/sha}","trees_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/statuses/{sha}","languages_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/languages","stargazers_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/stargazers","contributors_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/contributors","subscribers_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/subscribers","subscription_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/subscription","commits_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/commits{/sha}","git_commits_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/git/commits{/sha}","comments_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/comments{/number}","issue_comment_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/issues/comments{/number}","contents_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/contents/{+path}","compare_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/merges","archive_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/downloads","issues_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/issues{/number}","pulls_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/pulls{/number}","milestones_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/milestones{/number}","notifications_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/labels{/name}","releases_url":"https://api.github.com/repos/eed3si9n/bintray-sbt/releases{/id}","created_at":"2015-04-15T06:48:25Z","updated_at":"2015-04-15T06:48:26Z","pushed_at":"2015-04-16T02:18:43Z","git_url":"git://github.com/eed3si9n/bintray-sbt.git","ssh_url":"git@github.com:eed3si9n/bintray-sbt.git","clone_url":"https://github.com/eed3si9n/bintray-sbt.git","svn_url":"https://github.com/eed3si9n/bintray-sbt","homepage":"","size":220,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"softprops:master","ref":"master","sha":"44d1c993e385e8ec775e86ff61c11777ff228f10","user":{"login":"softprops","id":2242,"avatar_url":"https://avatars.githubusercontent.com/u/2242?v=3","gravatar_id":"","url":"https://api.github.com/users/softprops","html_url":"https://github.com/softprops","followers_url":"https://api.github.com/users/softprops/followers","following_url":"https://api.github.com/users/softprops/following{/other_user}","gists_url":"https://api.github.com/users/softprops/gists{/gist_id}","starred_url":"https://api.github.com/users/softprops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softprops/subscriptions","organizations_url":"https://api.github.com/users/softprops/orgs","repos_url":"https://api.github.com/users/softprops/repos","events_url":"https://api.github.com/users/softprops/events{/privacy}","received_events_url":"https://api.github.com/users/softprops/received_events","type":"User","site_admin":false},"repo":{"id":10736620,"name":"bintray-sbt","full_name":"softprops/bintray-sbt","owner":{"login":"softprops","id":2242,"avatar_url":"https://avatars.githubusercontent.com/u/2242?v=3","gravatar_id":"","url":"https://api.github.com/users/softprops","html_url":"https://github.com/softprops","followers_url":"https://api.github.com/users/softprops/followers","following_url":"https://api.github.com/users/softprops/following{/other_user}","gists_url":"https://api.github.com/users/softprops/gists{/gist_id}","starred_url":"https://api.github.com/users/softprops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softprops/subscriptions","organizations_url":"https://api.github.com/users/softprops/orgs","repos_url":"https://api.github.com/users/softprops/repos","events_url":"https://api.github.com/users/softprops/events{/privacy}","received_events_url":"https://api.github.com/users/softprops/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/softprops/bintray-sbt","description":"fresh packages delivered from your sbt console","fork":false,"url":"https://api.github.com/repos/softprops/bintray-sbt","forks_url":"https://api.github.com/repos/softprops/bintray-sbt/forks","keys_url":"https://api.github.com/repos/softprops/bintray-sbt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/softprops/bintray-sbt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/softprops/bintray-sbt/teams","hooks_url":"https://api.github.com/repos/softprops/bintray-sbt/hooks","issue_events_url":"https://api.github.com/repos/softprops/bintray-sbt/issues/events{/number}","events_url":"https://api.github.com/repos/softprops/bintray-sbt/events","assignees_url":"https://api.github.com/repos/softprops/bintray-sbt/assignees{/user}","branches_url":"https://api.github.com/repos/softprops/bintray-sbt/branches{/branch}","tags_url":"https://api.github.com/repos/softprops/bintray-sbt/tags","blobs_url":"https://api.github.com/repos/softprops/bintray-sbt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/softprops/bintray-sbt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/softprops/bintray-sbt/git/refs{/sha}","trees_url":"https://api.github.com/repos/softprops/bintray-sbt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/softprops/bintray-sbt/statuses/{sha}","languages_url":"https://api.github.com/repos/softprops/bintray-sbt/languages","stargazers_url":"https://api.github.com/repos/softprops/bintray-sbt/stargazers","contributors_url":"https://api.github.com/repos/softprops/bintray-sbt/contributors","subscribers_url":"https://api.github.com/repos/softprops/bintray-sbt/subscribers","subscription_url":"https://api.github.com/repos/softprops/bintray-sbt/subscription","commits_url":"https://api.github.com/repos/softprops/bintray-sbt/commits{/sha}","git_commits_url":"https://api.github.com/repos/softprops/bintray-sbt/git/commits{/sha}","comments_url":"https://api.github.com/repos/softprops/bintray-sbt/comments{/number}","issue_comment_url":"https://api.github.com/repos/softprops/bintray-sbt/issues/comments{/number}","contents_url":"https://api.github.com/repos/softprops/bintray-sbt/contents/{+path}","compare_url":"https://api.github.com/repos/softprops/bintray-sbt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/softprops/bintray-sbt/merges","archive_url":"https://api.github.com/repos/softprops/bintray-sbt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/softprops/bintray-sbt/downloads","issues_url":"https://api.github.com/repos/softprops/bintray-sbt/issues{/number}","pulls_url":"https://api.github.com/repos/softprops/bintray-sbt/pulls{/number}","milestones_url":"https://api.github.com/repos/softprops/bintray-sbt/milestones{/number}","notifications_url":"https://api.github.com/repos/softprops/bintray-sbt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/softprops/bintray-sbt/labels{/name}","releases_url":"https://api.github.com/repos/softprops/bintray-sbt/releases{/id}","created_at":"2013-06-17T12:15:37Z","updated_at":"2015-04-10T20:25:40Z","pushed_at":"2015-04-16T02:18:43Z","git_url":"git://github.com/softprops/bintray-sbt.git","ssh_url":"git@github.com:softprops/bintray-sbt.git","clone_url":"https://github.com/softprops/bintray-sbt.git","svn_url":"https://github.com/softprops/bintray-sbt","homepage":"","size":637,"stargazers_count":50,"watchers_count":50,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":22,"forks":13,"open_issues":22,"watchers":50,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/softprops/bintray-sbt/pulls/53"},"html":{"href":"https://github.com/softprops/bintray-sbt/pull/53"},"issue":{"href":"https://api.github.com/repos/softprops/bintray-sbt/issues/53"},"comments":{"href":"https://api.github.com/repos/softprops/bintray-sbt/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/softprops/bintray-sbt/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/softprops/bintray-sbt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/softprops/bintray-sbt/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/softprops/bintray-sbt/statuses/9487f9c9817c99cf0afe5ec7196dcec597552f3a"}}}}