Skip to content

Commit 1591dac

Browse files
authored
Backport 2.12 to 0.7.x branch (#274)
* Backport 2.12 to 0.7.x branch * Fix the binary version for mima * Fix closure cleaner tests * Bump sbt-release plugin version
1 parent 383f8f9 commit 1591dac

14 files changed

Lines changed: 292 additions & 85 deletions

File tree

.travis.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
11
language: scala
22
sudo: false
3-
scala:
4-
- 2.10.5
5-
- 2.11.7
6-
jdk:
7-
- openjdk6
8-
- oraclejdk7
9-
- oraclejdk8
10-
script: ./sbt ++$TRAVIS_SCALA_VERSION clean test doc
3+
matrix:
4+
include:
5+
- scala: 2.10.6
6+
script: ./sbt ++$TRAVIS_SCALA_VERSION clean test mimaReportBinaryIssues
117

8+
- scala: 2.11.8
9+
script: ./sbt ++$TRAVIS_SCALA_VERSION clean coverage test coverageReport mimaReportBinaryIssues
10+
after_success:
11+
- bash <(curl -s https://codecov.io/bash)
12+
13+
- scala: 2.12.1
14+
jdk: oraclejdk8
15+
script: ./sbt "+++$TRAVIS_SCALA_VERSION clean" "+++$TRAVIS_SCALA_VERSION test" # "+++$TRAVIS_SCALA_VERSION mimaReportBinaryIssues"
16+
17+
cache:
18+
directories:
19+
- $HOME/.sbt/0.13/dependency
20+
- $HOME/.sbt/boot/scala*
21+
- $HOME/.sbt/launchers
22+
- $HOME/.ivy2/cache
23+
- $HOME/.nvm
24+
25+
before_cache:
26+
- du -h -d 1 $HOME/.ivy2/cache
27+
- du -h -d 2 $HOME/.sbt/
28+
- find $HOME/.sbt -name "*.lock" -type f -delete
29+
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete
30+
31+
notifications:
32+
webhooks:
33+
urls:
34+
- https://webhooks.gitter.im/e/70c0a6999346c4692935
35+
on_success: change
36+
on_failure: always
37+
on_start: never

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
## Chill [![Build Status](https://secure.travis-ci.org/twitter/chill.png)](http://travis-ci.org/twitter/chill)
1+
## Chill
2+
3+
[![Build Status](https://secure.travis-ci.org/twitter/chill.png)](http://travis-ci.org/twitter/chill)
4+
[![Codecov branch](https://img.shields.io/codecov/c/github/twitter/chill/develop.svg?maxAge=3600)](https://codecov.io/github/twitter/chill)
5+
[![Latest version](https://index.scala-lang.org/twitter/chill/chill/latest.svg?color=orange)](https://index.scala-lang.org/twitter/chill/chill)
6+
[![Chat](https://badges.gitter.im/twitter/chill.svg)](https://gitter.im/twitter/chill?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
27

38
Extensions for the [Kryo serialization library](https://github.com/EsotericSoftware/kryo) including
49
serializers and a set of classes to ease configuration of Kryo in systems like Hadoop, Storm,
@@ -157,9 +162,21 @@ The latest ScalaDocs are hosted on Chill's [Github Project Page](http://twitter.
157162

158163
Discussion occurs primarily on the [Chill mailing list](https://groups.google.com/forum/#!forum/chill-user). Issues should be reported on the [GitHub issue tracker](https://github.com/twitter/chill/issues).
159164

165+
## Get Involved + Code of Conduct
166+
167+
Pull requests and bug reports are always welcome!
168+
169+
We use a lightweight form of project governance inspired by the one used by Apache projects.
170+
Please see [Contributing and Committership](https://github.com/twitter/analytics-infra-governance#contributing-and-committership) for our code of conduct and our pull request review process.
171+
The TL;DR is send us a pull request, iterate on the feedback + discussion, and get a +1 from a [Committer](COMMITTERS.md) in order to get your PR accepted.
172+
173+
The current list of active committers (who can +1 a pull request) can be found here: [Committers](COMMITTERS.md)
174+
175+
A list of contributors to the project can be found here: [Contributors](https://github.com/twitter/chill/graphs/contributors)
176+
160177
## Maven
161178

162-
Chill modules are available on Maven Central. The current groupid and version for all modules is, respectively, `"com.twitter"` and `0.7.4` and each scala project is published for `2.10` and `2.11`. Search [search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Cchill) when in doubt.
179+
Chill modules are available on Maven Central. The current groupid and version for all modules is, respectively, `"com.twitter"` and `0.8.0` and each scala project is published for `2.10`, `2.11` and `2.12`. Search [search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Cchill) when in doubt.
163180

164181
## Authors
165182

@@ -171,4 +188,4 @@ Chill modules are available on Maven Central. The current groupid and version fo
171188

172189
Copyright 2012 Twitter, Inc.
173190

174-
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
191+
Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

build.sbt

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
1-
import ReleaseTransformations._
2-
import com.typesafe.sbt.SbtScalariform._
3-
import com.typesafe.tools.mima.plugin.MimaKeys._
41
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
5-
import scala.collection.JavaConverters._
6-
import scalariform.formatter.preferences._
72

83
val kryoVersion = "2.21"
9-
val bijectionVersion = "0.9.0"
4+
val bijectionVersion = "0.9.4"
105
val algebirdVersion = "0.12.0"
6+
val akkaVersion = "2.3.6"
117

12-
def isScala210x(scalaVersion: String) = scalaVersion match {
13-
case version if version startsWith "2.10" => true
14-
case _ => false
15-
}
16-
17-
val sharedSettings = Project.defaultSettings ++ mimaDefaultSettings ++ scalariformSettings ++ Seq(
8+
val sharedSettings = mimaDefaultSettings ++ scalariformSettings ++ Seq(
189
organization := "com.twitter",
19-
scalaVersion := "2.10.5",
20-
crossScalaVersions := Seq("2.10.5", "2.11.7"),
10+
scalaVersion := "2.11.8",
11+
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1"),
2112
scalacOptions ++= Seq("-unchecked", "-deprecation"),
2213
ScalariformKeys.preferences := formattingPreferences,
2314

@@ -30,8 +21,8 @@ val sharedSettings = Project.defaultSettings ++ mimaDefaultSettings ++ scalarifo
3021
Opts.resolver.sonatypeReleases
3122
),
3223
libraryDependencies ++= Seq(
33-
"org.scalacheck" %% "scalacheck" % "1.11.5" % "test",
34-
"org.scalatest" %% "scalatest" % "2.2.2" % "test",
24+
"org.scalacheck" %% "scalacheck" % "1.11.6" % "test",
25+
"org.scalatest" %% "scalatest" % "3.0.0" % "test",
3526
"com.esotericsoftware.kryo" % "kryo" % kryoVersion
3627
),
3728

@@ -44,15 +35,12 @@ val sharedSettings = Project.defaultSettings ++ mimaDefaultSettings ++ scalarifo
4435
publishArtifact in Test := false,
4536
pomIncludeRepository := { x => false },
4637

47-
publishTo <<= version { v =>
48-
Some(
49-
if (v.trim.toUpperCase.endsWith("SNAPSHOT"))
38+
publishTo := Some(
39+
if (version.value.trim.toUpperCase.endsWith("SNAPSHOT"))
5040
Opts.resolver.sonatypeSnapshots
5141
else
5242
Opts.resolver.sonatypeStaging
53-
//"twttr" at "http://artifactory.local.twitter.com/libs-releases-local"
54-
)
55-
},
43+
),
5644
pomExtra := (
5745
<url>https://github.com/twitter/chill</url>
5846
<licenses>
@@ -86,11 +74,9 @@ lazy val chillAll = Project(
8674
id = "chill-all",
8775
base = file("."),
8876
settings = sharedSettings
89-
).settings(
90-
test := { },
91-
publish := { },
92-
publishLocal := { }
93-
).aggregate(
77+
).enablePlugins(CrossPerProjectPlugin)
78+
.settings(noPublishSettings)
79+
.aggregate(
9480
chill,
9581
chillBijection,
9682
chillScrooge,
@@ -111,32 +97,49 @@ lazy val formattingPreferences = {
11197
setPreference(PreserveSpaceBeforeArguments, true)
11298
}
11399

100+
lazy val noPublishSettings = Seq(
101+
publish := (),
102+
publishLocal := (),
103+
test := (),
104+
publishArtifact := false
105+
)
106+
114107
/**
115108
* This returns the youngest jar we released that is compatible
116109
* with the current.
117110
*/
118111
val unreleasedModules = Set[String]("akka")
119112
val javaOnly = Set[String]("storm", "java", "hadoop", "thrift", "protobuf")
113+
val binaryCompatVersion = "0.7.4"
120114

121115
def youngestForwardCompatible(subProj: String) =
122116
Some(subProj)
123117
.filterNot(unreleasedModules.contains(_))
124118
.map { s =>
125-
val suffix = if (javaOnly.contains(s)) "" else "_2.10"
126-
"com.twitter" % ("chill-" + s + suffix) % "0.7.2"
119+
if (javaOnly.contains(s))
120+
"com.twitter" % ("chill-" + s) % binaryCompatVersion
121+
else
122+
"com.twitter" %% ("chill-" + s) % binaryCompatVersion
127123
}
128124

125+
val ignoredABIProblems = {
126+
import com.typesafe.tools.mima.core._
127+
import com.typesafe.tools.mima.core.ProblemFilters._
128+
Seq(
129+
ProblemFilters.exclude[MissingTypesProblem]("com.twitter.chill.storm.BlizzardKryoFactory")
130+
)
131+
}
132+
129133
def module(name: String) = {
130134
val id = "chill-%s".format(name)
131135
Project(id = id, base = file(id), settings = sharedSettings ++ Seq(
132136
Keys.name := id,
133-
previousArtifact := youngestForwardCompatible(name),
137+
mimaPreviousArtifacts := youngestForwardCompatible(name).toSet,
138+
mimaBinaryIssueFilters ++= ignoredABIProblems,
134139
// Disable cross publishing for java artifacts
135-
publishArtifact <<= (scalaVersion) { scalaVersion =>
136-
if(javaOnly.contains(name) && scalaVersion.startsWith("2.11")) false else true
137-
}
138-
)
139-
)
140+
publishArtifact :=
141+
(if (javaOnly.contains(name) && scalaVersion.value.startsWith("2.11")) false else true)
142+
))
140143
}
141144

142145
// We usually do the pattern of having a core module, but we don't want to cause
@@ -147,14 +150,15 @@ lazy val chill = Project(
147150
settings = sharedSettings
148151
).settings(
149152
name := "chill",
150-
previousArtifact := Some("com.twitter" % "chill_2.10" % "0.7.2")
153+
mimaPreviousArtifacts := Set("com.twitter" %% "chill" % binaryCompatVersion)
151154
).dependsOn(chillJava)
152155

153156
lazy val chillAkka = module("akka").settings(
154-
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
157+
resolvers += Resolver.typesafeRepo("releases"),
158+
crossScalaVersions := crossScalaVersions.value.filterNot(_.startsWith("2.12")),
155159
libraryDependencies ++= Seq(
156160
"com.typesafe" % "config" % "1.2.1",
157-
"com.typesafe.akka" %% "akka-actor" % "2.3.6" % "provided"
161+
"com.typesafe.akka" %% "akka-actor" % akkaVersion % "provided"
158162
)
159163
).dependsOn(chill % "test->test;compile->compile")
160164

@@ -202,6 +206,7 @@ lazy val chillThrift = module("thrift").settings(
202206
)
203207

204208
lazy val chillScrooge = module("scrooge").settings(
209+
crossScalaVersions := crossScalaVersions.value.filterNot(_.startsWith("2.12")),
205210
libraryDependencies ++= Seq(
206211
"org.apache.thrift" % "libthrift" % "0.6.1" exclude("junit", "junit"),
207212
"com.twitter" %% "scrooge-serializer" % "3.20.0"
@@ -225,6 +230,7 @@ lazy val chillAvro = module("avro").settings(
225230
).dependsOn(chill,chillJava, chillBijection)
226231

227232
lazy val chillAlgebird = module("algebird").settings(
233+
crossScalaVersions := crossScalaVersions.value.filterNot(_.startsWith("2.12")),
228234
libraryDependencies ++= Seq(
229235
"com.twitter" %% "algebird-core" % algebirdVersion
230236
)

chill-akka/src/main/scala/com/twitter/chill/akka/ActorRefSerializer.scala

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ package com.twitter.chill.akka
1717
* ****************************************************************************
1818
*/
1919

20-
import akka.actor.ExtendedActorSystem
21-
import akka.actor.ActorRef
20+
import akka.actor.{ ActorRef, ActorPath, ExtendedActorSystem }
2221
import akka.serialization.Serialization
23-
import com.esotericsoftware.kryo.Kryo
24-
import com.esotericsoftware.kryo.Serializer
25-
import com.esotericsoftware.kryo.io.Input
26-
import com.esotericsoftware.kryo.io.Output
22+
import com.esotericsoftware.kryo.{ Kryo, Serializer }
23+
import com.esotericsoftware.kryo.io.{ Input, Output }
24+
25+
import com.twitter.chill.{ toRich, IKryoRegistrar }
2726

2827
/**
2928
* *
@@ -32,9 +31,6 @@ import com.esotericsoftware.kryo.io.Output
3231
* @author Roman Levenstein
3332
* @author P. Oscar Boykin
3433
*/
35-
36-
import com.twitter.chill.{ toRich, IKryoRegistrar }
37-
3834
class ActorRefSerializer(system: ExtendedActorSystem) extends Serializer[ActorRef] with IKryoRegistrar {
3935

4036
def apply(kryo: Kryo): Unit = {
@@ -45,8 +41,8 @@ class ActorRefSerializer(system: ExtendedActorSystem) extends Serializer[ActorRe
4541
}
4642

4743
override def read(kryo: Kryo, input: Input, typ: Class[ActorRef]): ActorRef = {
48-
val path = input.readString()
49-
system.actorFor(path)
44+
val path = ActorPath.fromString(input.readString())
45+
system.provider.resolveActorRef(path)
5046
}
5147

5248
override def write(kryo: Kryo, output: Output, obj: ActorRef) = {

chill-akka/src/test/scala/com/twitter/chill/akka/AkkaTests.scala

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,23 @@ package com.twitter.chill.akka
1818

1919
import org.scalatest._
2020

21-
import akka.actor.{ ActorRef, ActorSystem }
21+
import akka.actor.{ Actor, ActorRef, ActorSystem, Props }
22+
import akka.util.Timeout
23+
import scala.concurrent.Await
24+
import scala.concurrent.duration._
2225
import akka.serialization._
2326
import com.typesafe.config.ConfigFactory
2427

2528
class AkkaTests extends WordSpec with Matchers {
29+
object IncActor {
30+
def props: Props = Props(IncActor())
31+
}
32+
33+
case class IncActor() extends Actor {
34+
def receive = {
35+
case x: Int => sender() ! (x + 1)
36+
}
37+
}
2638

2739
val system = ActorSystem("example", ConfigFactory.parseString("""
2840
akka.actor.serializers {
@@ -45,21 +57,22 @@ class AkkaTests extends WordSpec with Matchers {
4557
serializer.getClass.equals(classOf[AkkaSerializer]) should equal(true)
4658
}
4759

60+
def actorRef(i: Int) = system.actorOf(IncActor.props, "incActor" + i)
61+
4862
"be selected for ActorRef" in {
49-
val serializer = serialization.findSerializerFor(system.actorFor("akka://test-system/test-actor"))
63+
val serializer = serialization.findSerializerFor(actorRef(1))
5064
serializer.getClass.equals(classOf[AkkaSerializer]) should equal(true)
5165
}
5266

5367
"serialize and deserialize ActorRef successfully" in {
54-
val actorRef = system.actorFor("akka://test-system/test-actor")
55-
56-
val serialized = serialization.serialize(actorRef)
68+
val actor = actorRef(2)
69+
val serialized = serialization.serialize(actor)
5770
serialized.isSuccess should equal(true)
5871

5972
val deserialized = serialization.deserialize(serialized.get, classOf[ActorRef])
6073
deserialized.isSuccess should equal(true)
6174

62-
deserialized.get.equals(actorRef) should equal(true)
75+
deserialized.get.equals(actor) should equal(true)
6376
}
6477

6578
}

0 commit comments

Comments
 (0)