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

Fix Dispatch/json4s-core issue #123

Merged
merged 5 commits into from
Jul 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jdk: oraclejdk8

env:
matrix:
- SBT_CMD="test"
- SBT_CMD="++2.12.2 ^^1.0.0-M6 test"
- SBT_CMD=";test;scripted"
- SBT_CMD=";++2.12.2;^^1.0.0-RC2;test;scripted"

script: sbt "$SBT_CMD"
37 changes: 35 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,41 @@ lazy val root = (project in file("."))
.settings(
name := "sbt-bintray",
sbtPlugin := true,
crossSbtVersions := List("0.13.15", "1.0.0-RC2"),
scalaVersion := (CrossVersion partialVersion sbtCrossVersion.value match {
case Some((0, 13)) => "2.10.6"
case Some((1, _)) => "2.12.2"
case _ => sys error s"Unhandled sbt version ${sbtCrossVersion.value}"
}),
libraryDependencies ++= Seq(
"org.foundweekends" %% "bintry" % "0.5.0",
"org.foundweekends" %% "bintry" % "0.5.1",
"org.slf4j" % "slf4j-nop" % "1.7.7"), // https://github.com/softprops/bintray-sbt/issues/26
resolvers += Resolver.sonatypeRepo("releases")
resolvers += Resolver.sonatypeRepo("releases"),
scriptedSettings,
scriptedBufferLog := true,
scriptedLaunchOpts ++= Seq(
"-Xmx1024M",
"-XX:MaxPermSize=256M",
"-Dbintray.user=username",
"-Dbintray.pass=password",
"-Dplugin.version=" + version.value
)
)

val sbtCrossVersion = sbtVersion in pluginCrossBuild

// WORKAROUND https://github.com/sbt/sbt/issues/3325
def scriptedSettings = Def settings (
ScriptedPlugin.scriptedSettings filterNot (_.key.key.label == libraryDependencies.key.label),
libraryDependencies ++= {
val cross = CrossVersion partialVersion scriptedSbt.value match {
case Some((0, 13)) => CrossVersion.Disabled
case Some((1, _)) => CrossVersion.binary
case _ => sys error s"Unhandled sbt version ${scriptedSbt.value}"
}
Seq(
"org.scala-sbt" % "scripted-sbt" % scriptedSbt.value % scriptedConf.toString cross cross,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString
)
}
)
7 changes: 0 additions & 7 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
resolvers += Resolver.url(
"bintray-sbt-plugin-releases",
url("http://dl.bintray.com/content/sbt/sbt-plugin-releases"))(
Resolver.ivyStylePatterns)

// addSbtPlugin("me.lessis" % "ls-sbt" % "0.1.3")

addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "1.3.0")

Expand Down
9 changes: 0 additions & 9 deletions scripted.sbt

This file was deleted.

9 changes: 9 additions & 0 deletions src/main/scala-sbt-0.13/Compat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package bintray

import sbt._
import org.apache.ivy.plugins.resolver.DependencyResolver

object RawRepository {
def apply(resolver: DependencyResolver): RawRepository =
new RawRepository(resolver)
}
10 changes: 10 additions & 0 deletions src/main/scala-sbt-1.0/Compat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package bintray

import scala.language.reflectiveCalls

import sbt.librarymanagement.RawRepository

object RawRepository {
def apply(resolver: AnyRef): RawRepository =
new RawRepository(resolver, resolver.asInstanceOf[{ def getName(): String }].getName)
}
4 changes: 2 additions & 2 deletions src/main/scala/Bintray.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ object Bintray {

def publishTo(repo: Client#Repo, pkg: Client#Repo#Package, version: String,
mvnStyle: Boolean = true, isSbtPlugin: Boolean = false, release: Boolean = false): Resolver =
if (mvnStyle) new RawRepository(
if (mvnStyle) RawRepository(
BintrayMavenResolver(s"Bintray-Maven-Publish-${repo.subject}-${repo.repo}-${pkg.name}",
s"https://api.bintray.com/maven/${repo.subject}/${repo.repo}/${repo.repo}", pkg, release))
else new RawRepository(
else RawRepository(
BintrayIvyResolver(s"Bintray-${if (isSbtPlugin) "Sbt" else "Ivy"}-Publish-${repo.subject}-${repo.repo}-${pkg.name}",
pkg.version(version),
sbt.Resolver.ivyStylePatterns.artifactPatterns, release))
Expand Down
31 changes: 31 additions & 0 deletions src/sbt-test/sbt-bintray/jsonErrorTest/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
val jsonStr = taskKey[String]("")

// Reproduces issue: https://github.com/sbt/sbt-bintray/issues/104
jsonStr := {
import org.json4s.JsonDSL._
import org.json4s.native.JsonMethods

val jsonMethods = new JsonMethods {}
jsonMethods.compact(
jsonMethods.render(
("name" -> "randomName") ~
("desc" -> Option("basicDescription")) ~
("licenses" -> List("Apache", "MIT")) ~
("labels" -> List("label1", "label2")) ~
("vcs_url" -> Option("vcs"))
)
)
}

TaskKey[Unit]("check") := {
val expected =
"{" +
""""name":"randomName",""" +
""""desc":"basicDescription",""" +
""""licenses":["Apache","MIT"],""" +
""""labels":["label1","label2"],""" +
""""vcs_url":"vcs"""" +
"}"
val found = jsonStr.value
assert(expected == found, s"Expected: $expected but found: $found")
}
5 changes: 5 additions & 0 deletions src/sbt-test/sbt-bintray/jsonErrorTest/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sys.props.get("plugin.version") match {
case Some(x) => addSbtPlugin("org.foundweekends" % "sbt-bintray" % x)
case _ => sys.error("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
}
1 change: 1 addition & 0 deletions src/sbt-test/sbt-bintray/jsonErrorTest/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> check