Skip to content

Commit

Permalink
Merge pull request #119 from alexarchambault/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
alexarchambault authored Mar 22, 2019
2 parents 5190906 + c7a0633 commit 88f2f79
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 68 deletions.
18 changes: 11 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
language: scala
jdk:
- oraclejdk8
before_install:
- git fetch --tags
jdk: openjdk8
git:
depth: false
script: scripts/travis.sh
sudo: false
branches:
only:
- master
- /^v\d+\.\d+.*$/ # tagged versions
cache:
directories:
- $HOME/.cache
- $HOME/.coursier
- $HOME/.ivy2/cache
- $HOME/.sbt
stages:
Expand All @@ -18,10 +20,12 @@ stages:

jobs:
include:
- scala: 2.13.0-M5
jdk: openjdk9
script: sbt ++$TRAVIS_SCALA_VERSION test # can't get tut to work in 2.13
- scala: 2.12.8
jdk: oraclejdk9
jdk: openjdk9
- scala: 2.11.12
- scala: 2.10.7
- scala: 2.11.12
dist: trusty
sudo: required
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ case class Second(s: String) extends Base
val f: Base = First(2)

f.asJson.nospaces
f.asJson.nospaces == """{"type":"First","i":2}"""
// instead of the default """{"First":{"i":2}}"""
f.asJson.nospaces == """{"type":"First","i":2}"""
```


Expand Down Expand Up @@ -252,11 +252,10 @@ object instances {

import instances._

// works
val encode = EncodeJson.of[Base]
// fails
// val encodeFirst = EncodeJson.of[First]

// works
val encode = EncodeJson.of[Base]
```

You'll have to add the additional object after all the instances of a sealed trait, [see #5](https://github.com/travisbrown/circe#warnings-and-known-issues).
Expand Down
9 changes: 3 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
Deps.argonaut.value,
Deps.shapeless.value
),
keepNameAsModuleName,
scala211_12Sources
keepNameAsModuleName
)

lazy val coreJVM = core.jvm
Expand All @@ -53,8 +52,7 @@ lazy val coreTest = crossProject(JVMPlatform, JSPlatform)
shared,
dontPublish,
utest,
libs += Deps.scalacheckShapeless.value % "test",
scala211_12TestSources
libs += Deps.scalacheckShapeless.value % Test
)

lazy val coreTestJVM = coreTest.jvm
Expand All @@ -66,8 +64,7 @@ lazy val `refined-test` = project
shared,
dontPublish,
utest,
libs += Deps.scalacheckShapeless.value % "test",
scala211_12TestSources
libs += Deps.scalacheckShapeless.value % Test
)

lazy val doc = project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import shapeless._

import derive._

import org.scalacheck.Shapeless._
import org.scalacheck.ScalacheckShapeless._

import argonaut.Argonaut._
import argonaut.ArgonautShapeless._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object ShapelessTests extends TestSuite {
toFromJson(t).result == Right(t)
}.validate

import org.scalacheck.Shapeless._
import org.scalacheck.ScalacheckShapeless._
import argonaut.ArgonautShapeless._

val tests = TestSuite {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import utest._

import argonaut.Argonaut._
import argonaut.ArgonautShapeless._
import org.scalacheck.Shapeless._
import org.scalacheck.ScalacheckShapeless._

import shapeless._

Expand Down
10 changes: 5 additions & 5 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ case class Second(s: String) extends Base
val f: Base = First(2)
f.asJson.nospaces
f.asJson.nospaces == """{"type":"First","i":2}"""
// instead of the default """{"First":{"i":2}}"""
f.asJson.nospaces == """{"type":"First","i":2}"""
```

```tut:invisible
Expand Down Expand Up @@ -317,11 +317,10 @@ object instances {
import instances._
// works
val encode = EncodeJson.of[Base]
// fails
// val encodeFirst = EncodeJson.of[First]
// works
val encode = EncodeJson.of[Base]
```

You'll have to add the additional object after all the instances of a sealed trait, [see #5](https://github.com/travisbrown/circe#warnings-and-known-issues).
Expand Down Expand Up @@ -368,7 +367,8 @@ CC(

```tut:invisible
assert("""{"i": 7, "s": "Abcd"}""".decodeOption[CC] == Some(CC(refineMV(7), refineMV("Abcd"))))
assert("""{"i": 4, "s": "Abcd"}""".decodeOption[CC] == None // fails as the provided `i` doesn't meet the predicate ``GreaterThan[W.`5`.T]``)
// fails as the provided `i` doesn't meet the predicate ``GreaterThan[W.`5`.T]``)
assert("""{"i": 4, "s": "Abcd"}""".decodeOption[CC] == None)
```

## See also
Expand Down
6 changes: 3 additions & 3 deletions project/Deps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import sbt.Def.setting
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._

object Deps {
def argonaut = setting("io.argonaut" %%% "argonaut" % "6.2.2")
def refined = "eu.timepit" %% "refined" % "0.9.2"
def argonaut = setting("io.argonaut" %%% "argonaut" % "6.2.3")
def refined = "eu.timepit" %% "refined" % "0.9.4"
def shapeless = setting("com.chuusai" %%% "shapeless" % "2.3.3")

def scalacheckShapeless = setting("com.github.alexarchambault" %%% "scalacheck-shapeless_1.13" % "1.1.8")
def scalacheckShapeless = setting("com.github.alexarchambault" %%% "scalacheck-shapeless_1.14" % "1.2.1")
def utest = setting("com.lihaoyi" %%% "utest" % "0.6.6")
}
60 changes: 23 additions & 37 deletions project/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,33 @@ import Aliases._

object Settings {

private val scala210 = "2.10.7"
private val scala211 = "2.11.12"
private val scala212 = "2.12.8"
private val scala213 = "2.13.0-M5"

lazy val shared = Seq(
scalaVersion := scala211,
crossScalaVersions := Seq(scala212, scala211, scala210),
scalacOptions += "-target:jvm-1.7",
resolvers += Resolver.sonatypeRepo("releases"),
libraryDependencies +=
compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.patch)
scalaVersion := scala212,
crossScalaVersions := Seq(scala213, scala212, scala211),
scalacOptions += "-target:jvm-1.8",
scalacOptions ++= {
val sbv = scalaBinaryVersion.value
if (sbv.startsWith("2.11") || sbv.startsWith("2.12"))
Nil
else
Seq("-Ymacro-annotations")
},
javacOptions ++= Seq(
"-source", "1.8",
"-target", "1.8"
),
libraryDependencies ++= {
if (scalaVersion.value.startsWith("2.13."))
Nil
else
Seq(
compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.patch)
)
}
)

lazy val dontPublish = Seq(
Expand All @@ -24,36 +40,6 @@ object Settings {
publishArtifact := false
)

lazy val scala211_12Sources = {
unmanagedSourceDirectories.in(Compile) ++= {
scalaBinaryVersion.value match {
case "2.11" | "2.12" =>
unmanagedSourceDirectories
.in(Compile)
.value
.filter(_.getName == "scala")
.map(_.getParentFile / "scala-2.11_2.12")
case _ =>
Seq()
}
}
}

lazy val scala211_12TestSources = {
unmanagedSourceDirectories.in(Test) ++= {
scalaBinaryVersion.value match {
case "2.11" | "2.12" =>
unmanagedSourceDirectories
.in(Test)
.value
.filter(_.getName == "scala")
.map(_.getParentFile / "scala-2.11_2.12")
case _ =>
Seq()
}
}
}

lazy val utest = Seq(
libs += Deps.utest.value % "test",
testFrameworks += new TestFramework("utest.runner.Framework")
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.3")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.10")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.26")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.8")
Expand Down
2 changes: 1 addition & 1 deletion project/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.1.0-M13-2")
2 changes: 1 addition & 1 deletion scripts/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ else
SBT_COMMANDS+=("validate")
fi

if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$JAVA_HOME" == "$(jdk_switcher home oraclejdk8)" && "$TRAVIS_BRANCH" == "master" ]]; then
if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$JAVA_HOME" == "$(jdk_switcher home openjdk8)" && "$TRAVIS_BRANCH" == "master" ]]; then
if [[ "$NATIVE" = 1 ]]; then
SBT_COMMANDS+=("native/publish")
else
Expand Down

0 comments on commit 88f2f79

Please sign in to comment.