Remove Scala 2.11 for Akka 2.6 (#26760)
* Remove Scala 2.11 for Akka 2.6 * Remove unused import * Update akka-actor/src/main/scala-2.13/akka/compat/Future.scala Co-Authored-By: chbatey <christopher.batey@gmail.com> * Update akka-actor/src/main/scala-2.13/akka/compat/Future.scala Co-Authored-By: chbatey <christopher.batey@gmail.com> * Remove last few bits of 2.11
This commit is contained in:
parent
d6eb1f237c
commit
0ab7a96ae2
22 changed files with 202 additions and 1053 deletions
|
|
@ -4,7 +4,6 @@ sudo: false
|
||||||
|
|
||||||
scala:
|
scala:
|
||||||
- "2.12.8"
|
- "2.12.8"
|
||||||
- "2.11.12"
|
|
||||||
- "2.13.0-M5"
|
- "2.13.0-M5"
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ validate binary compatibility of incoming pull requests. If your PR fails due to
|
||||||
an error like this:
|
an error like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
[info] akka-stream: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-stream_2.11:2.4.2 (filtered 222)
|
[info] akka-stream: found 1 potential binary incompatibilities while checking against com.typesafe.akka:akka-stream_2.12:2.4.2 (filtered 222)
|
||||||
[error] * method foldAsync(java.lang.Object,scala.Function2)akka.stream.scaladsl.FlowOps in trait akka.stream.scaladsl.FlowOps is present only in current version
|
[error] * method foldAsync(java.lang.Object,scala.Function2)akka.stream.scaladsl.FlowOps in trait akka.stream.scaladsl.FlowOps is present only in current version
|
||||||
[error] filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.scaladsl.FlowOps.foldAsync")
|
[error] filter with: ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.stream.scaladsl.FlowOps.foldAsync")
|
||||||
```
|
```
|
||||||
|
|
@ -439,8 +439,7 @@ Scala has proven the most viable way to do it, as long as you keep the following
|
||||||
1. Have methods in the `javadsl` package delegate to the methods in the Scala API, or the common internal implementation.
|
1. Have methods in the `javadsl` package delegate to the methods in the Scala API, or the common internal implementation.
|
||||||
The Akka Stream Scala instances for example have a `.asJava` method to convert to the `akka.stream.javadsl` counterparts.
|
The Akka Stream Scala instances for example have a `.asJava` method to convert to the `akka.stream.javadsl` counterparts.
|
||||||
|
|
||||||
1. When using Scala `object` instances, offer a `getInstance()` method and add a sealed abstract class
|
1. When using Scala `object` instances, offer a `getInstance()` method. See `akka.Done` for an example.
|
||||||
(to support Scala 2.11) to get the return type. See `akka.Done` for an example.
|
|
||||||
|
|
||||||
1. When the Scala API contains an `apply` method, use `create` or `of` for Java users.
|
1. When the Scala API contains an `apply` method, use `create` or `of` for Java users.
|
||||||
|
|
||||||
|
|
@ -450,9 +449,6 @@ Scala has proven the most viable way to do it, as long as you keep the following
|
||||||
|
|
||||||
1. Be careful to convert values within data structures (eg. for `scala.Long` vs. `java.lang.Long`, use `scala.Long.box(value)`)
|
1. Be careful to convert values within data structures (eg. for `scala.Long` vs. `java.lang.Long`, use `scala.Long.box(value)`)
|
||||||
|
|
||||||
1. When compiling with both Scala 2.11 and 2.12, some methods considered overloads in 2.11, become ambiguous in
|
|
||||||
2.12 as both may be functional interfaces.
|
|
||||||
|
|
||||||
1. Complement any methods with Scala collections with a Java collection version
|
1. Complement any methods with Scala collections with a Java collection version
|
||||||
|
|
||||||
1. Use the `akka.japi.Pair` class to return tuples
|
1. Use the `akka.japi.Pair` class to return tuples
|
||||||
|
|
@ -474,8 +470,6 @@ Scala has proven the most viable way to do it, as long as you keep the following
|
||||||
both Java and Scala APIs. Make such classes `private[akka]` and also, since that becomes `public` from Java's point of
|
both Java and Scala APIs. Make such classes `private[akka]` and also, since that becomes `public` from Java's point of
|
||||||
view, annotate with `@InternalApi` and add a scaladoc saying `INTERNAL API`
|
view, annotate with `@InternalApi` and add a scaladoc saying `INTERNAL API`
|
||||||
|
|
||||||
1. Companion objects (in Scala 2.11) cannot be accessed from Java if their companion is a trait, use an `abstract class` instead
|
|
||||||
|
|
||||||
1. Traits that are part of the Java API should only be used to define pure interfaces, as soon as there are implementations of methods, prefer
|
1. Traits that are part of the Java API should only be used to define pure interfaces, as soon as there are implementations of methods, prefer
|
||||||
`abstract class`.
|
`abstract class`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
### JDK 8 and JDK 9
|
### JDK 8 and JDK 11
|
||||||
|
|
||||||
Releasing Akka requires running on at least JDK 9, but also having JDK 8
|
Releasing Akka requires running on JDK 11, but also having JDK 8
|
||||||
installed. The reason for this is that we want the Akka artifacts to be
|
installed. The reason for this is that we want the Akka artifacts to be
|
||||||
usable with JRE 8, but also want to compile some classes with JDK9-specific
|
usable with JRE 8, but also want to compile some classes with JDK11-specific
|
||||||
types.
|
types.
|
||||||
|
|
||||||
When we stop supporting Scala 2.11 we might be able to update the build towork
|
In the future we might be able to update the build to work
|
||||||
without having JDK 8 installed, by using the `-release` option.
|
without having JDK 8 installed, by using the `-release` option.
|
||||||
|
|
||||||
### MinGW
|
### MinGW
|
||||||
|
|
|
||||||
|
|
@ -896,8 +896,7 @@ class ByteStringSpec extends WordSpec with Matchers with Checkers {
|
||||||
"serialize correctly" when {
|
"serialize correctly" when {
|
||||||
"parsing regular ByteString1C as compat" in {
|
"parsing regular ByteString1C as compat" in {
|
||||||
val oldSerd =
|
val oldSerd =
|
||||||
if (util.Properties.versionNumberString.startsWith("2.11") || util.Properties.versionNumberString.startsWith(
|
if (util.Properties.versionNumberString.startsWith("2.12"))
|
||||||
"2.12"))
|
|
||||||
"aced000573720021616b6b612e7574696c2e42797465537472696e672442797465537472696e67314336e9eed0afcfe4a40200015b000562797465737400025b427872001b616b6b612e7574696c2e436f6d7061637442797465537472696e67fa2925150f93468f0200007870757200025b42acf317f8060854e002000078700000000a74657374737472696e67"
|
"aced000573720021616b6b612e7574696c2e42797465537472696e672442797465537472696e67314336e9eed0afcfe4a40200015b000562797465737400025b427872001b616b6b612e7574696c2e436f6d7061637442797465537472696e67fa2925150f93468f0200007870757200025b42acf317f8060854e002000078700000000a74657374737472696e67"
|
||||||
else
|
else
|
||||||
// The data is the same, but the class hierarchy changed in 2.13:
|
// The data is the same, but the class hierarchy changed in 2.13:
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,8 @@ package akka.util
|
||||||
import akka.testkit.AkkaSpec
|
import akka.testkit.AkkaSpec
|
||||||
import akka.util.LineNumbers._
|
import akka.util.LineNumbers._
|
||||||
|
|
||||||
import scala.util.Properties
|
|
||||||
|
|
||||||
class LineNumberSpec extends AkkaSpec {
|
class LineNumberSpec extends AkkaSpec {
|
||||||
|
|
||||||
private val isScala211 = Properties.versionNumberString.startsWith("2.11")
|
|
||||||
|
|
||||||
"LineNumbers" when {
|
"LineNumbers" when {
|
||||||
|
|
||||||
"writing Scala" must {
|
"writing Scala" must {
|
||||||
|
|
@ -24,10 +20,6 @@ class LineNumberSpec extends AkkaSpec {
|
||||||
|
|
||||||
"work for larger functions" in {
|
"work for larger functions" in {
|
||||||
val result = LineNumbers(twoline)
|
val result = LineNumbers(twoline)
|
||||||
if (isScala211)
|
|
||||||
result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 15, 17))
|
|
||||||
else
|
|
||||||
// because how scala 2.12+ does the same as Java Lambdas
|
|
||||||
result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 15, 15))
|
result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 15, 15))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,10 +29,6 @@ class LineNumberSpec extends AkkaSpec {
|
||||||
|
|
||||||
"work for `def`" in {
|
"work for `def`" in {
|
||||||
val result = LineNumbers(method("foo"))
|
val result = LineNumbers(method("foo"))
|
||||||
if (isScala211)
|
|
||||||
result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 25, 27))
|
|
||||||
else
|
|
||||||
// because how scala 2.12 does the same as Java Lambdas
|
|
||||||
result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 26, 27))
|
result should ===(SourceFileLines("LineNumberSpecCodeForScala.scala", 26, 27))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,22 +175,6 @@ object BehaviorSpec {
|
||||||
/*
|
/*
|
||||||
* function converters for Java, to ease the pain on Scala 2.11
|
* function converters for Java, to ease the pain on Scala 2.11
|
||||||
*/
|
*/
|
||||||
def fs(f: (JActorContext[Command], Signal) => Behavior[Command]) =
|
|
||||||
new F2[JActorContext[Command], Signal, Behavior[Command]] {
|
|
||||||
override def apply(context: JActorContext[Command], sig: Signal) = f(context, sig)
|
|
||||||
}
|
|
||||||
def fc(f: (JActorContext[Command], Command) => Behavior[Command]) =
|
|
||||||
new F2[JActorContext[Command], Command, Behavior[Command]] {
|
|
||||||
override def apply(context: JActorContext[Command], command: Command) = f(context, command)
|
|
||||||
}
|
|
||||||
def ps(f: (JActorContext[Command], Signal) => Unit) =
|
|
||||||
new P2[JActorContext[Command], Signal] {
|
|
||||||
override def apply(context: JActorContext[Command], sig: Signal) = f(context, sig)
|
|
||||||
}
|
|
||||||
def pc(f: (JActorContext[Command], Command) => Unit) =
|
|
||||||
new P2[JActorContext[Command], Command] {
|
|
||||||
override def apply(context: JActorContext[Command], command: Command) = f(context, command)
|
|
||||||
}
|
|
||||||
def pf(f: PFBuilder[Command, Command] => PFBuilder[Command, Command]) =
|
def pf(f: PFBuilder[Command, Command] => PFBuilder[Command, Command]) =
|
||||||
new F1[PFBuilder[Command, Command], PFBuilder[Command, Command]] {
|
new F1[PFBuilder[Command, Command], PFBuilder[Command, Command]] {
|
||||||
override def apply(in: PFBuilder[Command, Command]) = f(in)
|
override def apply(in: PFBuilder[Command, Command]) = f(in)
|
||||||
|
|
@ -199,10 +183,6 @@ object BehaviorSpec {
|
||||||
new FI.Apply[Command, Command] {
|
new FI.Apply[Command, Command] {
|
||||||
override def apply(in: Command) = f(in)
|
override def apply(in: Command) = f(in)
|
||||||
}
|
}
|
||||||
def df(f: JActorContext[Command] => Behavior[Command]) =
|
|
||||||
new F1e[JActorContext[Command], Behavior[Command]] {
|
|
||||||
override def apply(in: JActorContext[Command]) = f(in)
|
|
||||||
}
|
|
||||||
|
|
||||||
trait Lifecycle extends Common {
|
trait Lifecycle extends Common {
|
||||||
"Lifecycle" must {
|
"Lifecycle" must {
|
||||||
|
|
@ -547,7 +527,7 @@ class ImmutableWithSignalJavaBehaviorSpec extends Messages with BecomeWithLifecy
|
||||||
override def behavior(monitor: ActorRef[Event]): (Behavior[Command], Aux) = behv(monitor) -> null
|
override def behavior(monitor: ActorRef[Event]): (Behavior[Command], Aux) = behv(monitor) -> null
|
||||||
def behv(monitor: ActorRef[Event], state: State = StateA): Behavior[Command] =
|
def behv(monitor: ActorRef[Event], state: State = StateA): Behavior[Command] =
|
||||||
JBehaviors.receive(
|
JBehaviors.receive(
|
||||||
fc((context, message) =>
|
(context, message) =>
|
||||||
message match {
|
message match {
|
||||||
case GetSelf =>
|
case GetSelf =>
|
||||||
monitor ! Self(context.getSelf)
|
monitor ! Self(context.getSelf)
|
||||||
|
|
@ -569,18 +549,17 @@ class ImmutableWithSignalJavaBehaviorSpec extends Messages with BecomeWithLifecy
|
||||||
SBehaviors.same
|
SBehaviors.same
|
||||||
case Stop => SBehaviors.stopped
|
case Stop => SBehaviors.stopped
|
||||||
case _: AuxPing => SBehaviors.unhandled
|
case _: AuxPing => SBehaviors.unhandled
|
||||||
}),
|
},
|
||||||
fs((_, sig) => {
|
(_, sig) => {
|
||||||
monitor ! ReceivedSignal(sig)
|
monitor ! ReceivedSignal(sig)
|
||||||
SBehaviors.same
|
SBehaviors.same
|
||||||
}))
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImmutableJavaBehaviorSpec extends Messages with Become with Stoppable {
|
class ImmutableJavaBehaviorSpec extends Messages with Become with Stoppable {
|
||||||
override def behavior(monitor: ActorRef[Event]): (Behavior[Command], Aux) = behv(monitor, StateA) -> null
|
override def behavior(monitor: ActorRef[Event]): (Behavior[Command], Aux) = behv(monitor, StateA) -> null
|
||||||
def behv(monitor: ActorRef[Event], state: State): Behavior[Command] =
|
def behv(monitor: ActorRef[Event], state: State): Behavior[Command] =
|
||||||
JBehaviors.receive {
|
JBehaviors.receive { (context, message) =>
|
||||||
fc((context, message) =>
|
|
||||||
message match {
|
message match {
|
||||||
case GetSelf =>
|
case GetSelf =>
|
||||||
monitor ! Self(context.getSelf)
|
monitor ! Self(context.getSelf)
|
||||||
|
|
@ -602,7 +581,7 @@ class ImmutableJavaBehaviorSpec extends Messages with Become with Stoppable {
|
||||||
SBehaviors.same
|
SBehaviors.same
|
||||||
case Stop => SBehaviors.stopped
|
case Stop => SBehaviors.stopped
|
||||||
case _: AuxPing => SBehaviors.unhandled
|
case _: AuxPing => SBehaviors.unhandled
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -621,10 +600,10 @@ class DeferredJavaBehaviorSpec extends ImmutableWithSignalJavaBehaviorSpec {
|
||||||
|
|
||||||
override def behavior(monitor: ActorRef[Event]): (Behavior[Command], Aux) = {
|
override def behavior(monitor: ActorRef[Event]): (Behavior[Command], Aux) = {
|
||||||
val inbox = TestInbox[Done]("deferredListener")
|
val inbox = TestInbox[Done]("deferredListener")
|
||||||
(JBehaviors.setup(df(_ => {
|
(JBehaviors.setup(_ => {
|
||||||
inbox.ref ! Done
|
inbox.ref ! Done
|
||||||
super.behavior(monitor)._1
|
super.behavior(monitor)._1
|
||||||
})), inbox)
|
}), inbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def checkAux(signal: Signal, aux: Aux): Unit =
|
override def checkAux(signal: Signal, aux: Aux): Unit =
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@ class ActorLoggingSpec extends ScalaTestWithActorTestKit("""
|
||||||
akka.loggers = ["akka.testkit.TestEventListener"]
|
akka.loggers = ["akka.testkit.TestEventListener"]
|
||||||
""") with WordSpecLike {
|
""") with WordSpecLike {
|
||||||
|
|
||||||
private val isScala211 = Properties.versionNumberString.startsWith("2.11")
|
|
||||||
|
|
||||||
val marker = LogMarker("marker")
|
val marker = LogMarker("marker")
|
||||||
val cause = new TestException("böö")
|
val cause = new TestException("böö")
|
||||||
|
|
||||||
|
|
@ -77,11 +75,6 @@ class ActorLoggingSpec extends ScalaTestWithActorTestKit("""
|
||||||
"contain the class name where the first log was called" in {
|
"contain the class name where the first log was called" in {
|
||||||
val eventFilter = EventFilter.custom({
|
val eventFilter = EventFilter.custom({
|
||||||
case l: LogEvent if l.logClass == classOf[ActorLoggingSpec] => true
|
case l: LogEvent if l.logClass == classOf[ActorLoggingSpec] => true
|
||||||
case l: LogEvent if isScala211 =>
|
|
||||||
// TODO remove in Akka 2.6 when we drop Scala 2.11
|
|
||||||
// the class with 2.11 is like
|
|
||||||
// ActorLoggingSpec$$anonfun$1$$anonfun$apply$mcV$sp$26$$anonfun$apply$6$$anonfun$apply$7
|
|
||||||
l.logClass.getName.startsWith(classOf[ActorLoggingSpec].getName)
|
|
||||||
case l: LogEvent =>
|
case l: LogEvent =>
|
||||||
println(l.logClass)
|
println(l.logClass)
|
||||||
false
|
false
|
||||||
|
|
@ -102,11 +95,6 @@ class ActorLoggingSpec extends ScalaTestWithActorTestKit("""
|
||||||
"contain the object class name where the first log was called" in {
|
"contain the object class name where the first log was called" in {
|
||||||
val eventFilter = EventFilter.custom({
|
val eventFilter = EventFilter.custom({
|
||||||
case l: LogEvent if l.logClass == WhereTheBehaviorIsDefined.getClass => true
|
case l: LogEvent if l.logClass == WhereTheBehaviorIsDefined.getClass => true
|
||||||
case l: LogEvent if isScala211 =>
|
|
||||||
// TODO remove in Akka 2.6 when we drop Scala 2.11
|
|
||||||
// the class with 2.11 is like
|
|
||||||
// WhereTheBehaviorIsDefined$$anonfun$behavior$1
|
|
||||||
l.logClass.getName.startsWith(WhereTheBehaviorIsDefined.getClass.getName)
|
|
||||||
case l: LogEvent =>
|
case l: LogEvent =>
|
||||||
println(l.logClass)
|
println(l.logClass)
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2009-2019 Lightbend Inc. <https://www.lightbend.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
package akka.compat
|
|
||||||
|
|
||||||
import akka.annotation.InternalApi
|
|
||||||
import scala.concurrent.{ ExecutionContext, Future => SFuture }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* INTERNAL API
|
|
||||||
*
|
|
||||||
* Compatibility wrapper for `scala.concurrent.Future` to be able to compile the same code
|
|
||||||
* against Scala 2.11, 2.12, 2.13
|
|
||||||
*
|
|
||||||
* Remove these classes as soon as support for Scala 2.11 is dropped!
|
|
||||||
*/
|
|
||||||
@InternalApi private[akka] object Future {
|
|
||||||
def fold[T, R](futures: TraversableOnce[SFuture[T]])(zero: R)(op: (R, T) => R)(
|
|
||||||
implicit executor: ExecutionContext): SFuture[R] =
|
|
||||||
SFuture.fold[T, R](futures)(zero)(op)(executor)
|
|
||||||
|
|
||||||
def reduce[T, R >: T](futures: TraversableOnce[SFuture[T]])(op: (R, T) => R)(
|
|
||||||
implicit executor: ExecutionContext): SFuture[R] =
|
|
||||||
SFuture.reduce[T, R](futures)(op)(executor)
|
|
||||||
|
|
||||||
def find[T](futures: TraversableOnce[SFuture[T]])(p: T => Boolean)(
|
|
||||||
implicit executor: ExecutionContext): SFuture[Option[T]] =
|
|
||||||
SFuture.find[T](futures)(p)(executor)
|
|
||||||
}
|
|
||||||
|
|
@ -1,687 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2009-2019 Lightbend Inc. <https://www.lightbend.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
package akka.util
|
|
||||||
|
|
||||||
import akka.util.Collections.EmptyImmutableSeq
|
|
||||||
|
|
||||||
import java.nio.{ ByteBuffer, ByteOrder }
|
|
||||||
|
|
||||||
import scala.annotation.tailrec
|
|
||||||
import scala.collection.LinearSeq
|
|
||||||
import scala.collection.mutable.ListBuffer
|
|
||||||
import scala.reflect.ClassTag
|
|
||||||
|
|
||||||
object ByteIterator {
|
|
||||||
object ByteArrayIterator {
|
|
||||||
|
|
||||||
protected[akka] def apply(array: Array[Byte]): ByteArrayIterator =
|
|
||||||
new ByteArrayIterator(array, 0, array.length)
|
|
||||||
|
|
||||||
protected[akka] def apply(array: Array[Byte], from: Int, until: Int): ByteArrayIterator =
|
|
||||||
new ByteArrayIterator(array, from, until)
|
|
||||||
|
|
||||||
val empty: ByteArrayIterator = apply(Array.emptyByteArray)
|
|
||||||
}
|
|
||||||
|
|
||||||
class ByteArrayIterator private (private var array: Array[Byte], private var from: Int, private var until: Int)
|
|
||||||
extends ByteIterator {
|
|
||||||
iterator =>
|
|
||||||
|
|
||||||
@inline final def len: Int = until - from
|
|
||||||
|
|
||||||
@inline final def hasNext: Boolean = from < until
|
|
||||||
|
|
||||||
@inline final def head: Byte = array(from)
|
|
||||||
|
|
||||||
final def next(): Byte = {
|
|
||||||
if (!hasNext) EmptyImmutableSeq.iterator.next()
|
|
||||||
else {
|
|
||||||
val i = from; from = from + 1; array(i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def clear(): Unit = { this.array = Array.emptyByteArray; from = 0; until = from }
|
|
||||||
|
|
||||||
final override def length: Int = { val l = len; clear(); l }
|
|
||||||
|
|
||||||
final override def ++(that: TraversableOnce[Byte]): ByteIterator = that match {
|
|
||||||
case that: ByteIterator =>
|
|
||||||
if (that.isEmpty) this
|
|
||||||
else if (this.isEmpty) that
|
|
||||||
else
|
|
||||||
that match {
|
|
||||||
case that: ByteArrayIterator =>
|
|
||||||
if ((this.array eq that.array) && (this.until == that.from)) {
|
|
||||||
this.until = that.until
|
|
||||||
that.clear()
|
|
||||||
this
|
|
||||||
} else {
|
|
||||||
val result = MultiByteArrayIterator(List(this, that))
|
|
||||||
this.clear()
|
|
||||||
result
|
|
||||||
}
|
|
||||||
case that: MultiByteArrayIterator => this ++: that
|
|
||||||
}
|
|
||||||
case _ => super.++(that)
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def clone: ByteArrayIterator = new ByteArrayIterator(array, from, until)
|
|
||||||
|
|
||||||
final override def take(n: Int): this.type = {
|
|
||||||
if (n < len) until = { if (n > 0) (from + n) else from }
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def drop(n: Int): this.type = {
|
|
||||||
if (n > 0) from = { if (n < len) (from + n) else until }
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def takeWhile(p: Byte => Boolean): this.type = {
|
|
||||||
val prev = from
|
|
||||||
dropWhile(p)
|
|
||||||
until = from; from = prev
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def dropWhile(p: Byte => Boolean): this.type = {
|
|
||||||
var stop = false
|
|
||||||
while (!stop && hasNext) {
|
|
||||||
if (p(array(from))) {
|
|
||||||
from = from + 1
|
|
||||||
} else {
|
|
||||||
stop = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def copyToArray[B >: Byte](xs: Array[B], start: Int, len: Int): Unit = {
|
|
||||||
val n = 0 max ((xs.length - start) min this.len min len)
|
|
||||||
Array.copy(this.array, from, xs, start, n)
|
|
||||||
this.drop(n)
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def toByteString: ByteString = {
|
|
||||||
val result =
|
|
||||||
if ((from == 0) && (until == array.length)) ByteString.ByteString1C(array)
|
|
||||||
else ByteString.ByteString1(array, from, len)
|
|
||||||
clear()
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
def getBytes(xs: Array[Byte], offset: Int, n: Int): this.type = {
|
|
||||||
if (n <= this.len) {
|
|
||||||
Array.copy(this.array, this.from, xs, offset, n)
|
|
||||||
this.drop(n)
|
|
||||||
} else EmptyImmutableSeq.iterator.next()
|
|
||||||
}
|
|
||||||
|
|
||||||
private def wrappedByteBuffer: ByteBuffer = ByteBuffer.wrap(array, from, len).asReadOnlyBuffer
|
|
||||||
|
|
||||||
def getShorts(xs: Array[Short], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = {
|
|
||||||
wrappedByteBuffer.order(byteOrder).asShortBuffer.get(xs, offset, n); drop(2 * n)
|
|
||||||
}
|
|
||||||
|
|
||||||
def getInts(xs: Array[Int], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = {
|
|
||||||
wrappedByteBuffer.order(byteOrder).asIntBuffer.get(xs, offset, n); drop(4 * n)
|
|
||||||
}
|
|
||||||
|
|
||||||
def getLongs(xs: Array[Long], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = {
|
|
||||||
wrappedByteBuffer.order(byteOrder).asLongBuffer.get(xs, offset, n); drop(8 * n)
|
|
||||||
}
|
|
||||||
|
|
||||||
def getFloats(xs: Array[Float], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = {
|
|
||||||
wrappedByteBuffer.order(byteOrder).asFloatBuffer.get(xs, offset, n); drop(4 * n)
|
|
||||||
}
|
|
||||||
|
|
||||||
def getDoubles(xs: Array[Double], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type = {
|
|
||||||
wrappedByteBuffer.order(byteOrder).asDoubleBuffer.get(xs, offset, n); drop(8 * n)
|
|
||||||
}
|
|
||||||
|
|
||||||
def copyToBuffer(buffer: ByteBuffer): Int = {
|
|
||||||
val copyLength = math.min(buffer.remaining, len)
|
|
||||||
if (copyLength > 0) {
|
|
||||||
buffer.put(array, from, copyLength)
|
|
||||||
drop(copyLength)
|
|
||||||
}
|
|
||||||
copyLength
|
|
||||||
}
|
|
||||||
|
|
||||||
def asInputStream: java.io.InputStream = new java.io.InputStream {
|
|
||||||
override def available: Int = iterator.len
|
|
||||||
|
|
||||||
def read: Int = if (hasNext) (next().toInt & 0xff) else -1
|
|
||||||
|
|
||||||
override def read(b: Array[Byte], off: Int, len: Int): Int = {
|
|
||||||
if ((off < 0) || (len < 0) || (off + len > b.length)) throw new IndexOutOfBoundsException
|
|
||||||
if (len == 0) 0
|
|
||||||
else if (!isEmpty) {
|
|
||||||
val nRead = math.min(available, len)
|
|
||||||
copyToArray(b, off, nRead)
|
|
||||||
nRead
|
|
||||||
} else -1
|
|
||||||
}
|
|
||||||
|
|
||||||
override def skip(n: Long): Long = {
|
|
||||||
val nSkip = math.min(iterator.len, n.toInt)
|
|
||||||
iterator.drop(nSkip)
|
|
||||||
nSkip
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object MultiByteArrayIterator {
|
|
||||||
protected val clearedList: List[ByteArrayIterator] = List(ByteArrayIterator.empty)
|
|
||||||
|
|
||||||
val empty: MultiByteArrayIterator = new MultiByteArrayIterator(Nil)
|
|
||||||
|
|
||||||
protected[akka] def apply(iterators: LinearSeq[ByteArrayIterator]): MultiByteArrayIterator =
|
|
||||||
new MultiByteArrayIterator(iterators)
|
|
||||||
}
|
|
||||||
|
|
||||||
class MultiByteArrayIterator private (private var iterators: LinearSeq[ByteArrayIterator]) extends ByteIterator {
|
|
||||||
// After normalization:
|
|
||||||
// * iterators.isEmpty == false
|
|
||||||
// * (!iterator.head.isEmpty || iterators.tail.isEmpty) == true
|
|
||||||
private def normalize(): this.type = {
|
|
||||||
@tailrec def norm(xs: LinearSeq[ByteArrayIterator]): LinearSeq[ByteArrayIterator] = {
|
|
||||||
if (xs.isEmpty) MultiByteArrayIterator.clearedList
|
|
||||||
else if (xs.head.isEmpty) norm(xs.tail)
|
|
||||||
else xs
|
|
||||||
}
|
|
||||||
iterators = norm(iterators)
|
|
||||||
this
|
|
||||||
}
|
|
||||||
normalize()
|
|
||||||
|
|
||||||
@inline private def current: ByteArrayIterator = iterators.head
|
|
||||||
@inline private def dropCurrent(): Unit = { iterators = iterators.tail }
|
|
||||||
@inline def clear(): Unit = { iterators = MultiByteArrayIterator.empty.iterators }
|
|
||||||
|
|
||||||
@inline final def hasNext: Boolean = current.hasNext
|
|
||||||
|
|
||||||
@inline final def head: Byte = current.head
|
|
||||||
|
|
||||||
final def next(): Byte = {
|
|
||||||
val result = current.next()
|
|
||||||
normalize()
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def len: Int = iterators.foldLeft(0) { _ + _.len }
|
|
||||||
|
|
||||||
final override def length: Int = {
|
|
||||||
val result = len
|
|
||||||
clear()
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
private[akka] def ++:(that: ByteArrayIterator): this.type = {
|
|
||||||
iterators = that +: iterators
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def ++(that: TraversableOnce[Byte]): ByteIterator = that match {
|
|
||||||
case that: ByteIterator =>
|
|
||||||
if (that.isEmpty) this
|
|
||||||
else if (this.isEmpty) that
|
|
||||||
else {
|
|
||||||
that match {
|
|
||||||
case that: ByteArrayIterator =>
|
|
||||||
iterators = this.iterators :+ that
|
|
||||||
that.clear()
|
|
||||||
this
|
|
||||||
case that: MultiByteArrayIterator =>
|
|
||||||
iterators = this.iterators ++ that.iterators
|
|
||||||
that.clear()
|
|
||||||
this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case _ => super.++(that)
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def clone: MultiByteArrayIterator = {
|
|
||||||
val clonedIterators: List[ByteArrayIterator] = iterators.map(_.clone)(collection.breakOut)
|
|
||||||
new MultiByteArrayIterator(clonedIterators)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** For performance sensitive code, call take() directly on ByteString (it's optimised there) */
|
|
||||||
final override def take(n: Int): this.type = {
|
|
||||||
var rest = n
|
|
||||||
val builder = new ListBuffer[ByteArrayIterator]
|
|
||||||
while ((rest > 0) && !iterators.isEmpty) {
|
|
||||||
current.take(rest)
|
|
||||||
if (current.hasNext) {
|
|
||||||
rest -= current.len
|
|
||||||
builder += current
|
|
||||||
}
|
|
||||||
iterators = iterators.tail
|
|
||||||
}
|
|
||||||
iterators = builder.result
|
|
||||||
normalize()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** For performance sensitive code, call drop() directly on ByteString (it's optimised there) */
|
|
||||||
final override def drop(n: Int): this.type =
|
|
||||||
if ((n > 0) && !isEmpty) {
|
|
||||||
val nCurrent = math.min(n, current.len)
|
|
||||||
current.drop(n)
|
|
||||||
val rest = n - nCurrent
|
|
||||||
assert(current.isEmpty || (rest == 0))
|
|
||||||
normalize()
|
|
||||||
drop(rest)
|
|
||||||
} else this
|
|
||||||
|
|
||||||
final override def takeWhile(p: Byte => Boolean): this.type = {
|
|
||||||
var stop = false
|
|
||||||
var builder = new ListBuffer[ByteArrayIterator]
|
|
||||||
while (!stop && !iterators.isEmpty) {
|
|
||||||
val lastLen = current.len
|
|
||||||
current.takeWhile(p)
|
|
||||||
if (current.hasNext) builder += current
|
|
||||||
if (current.len < lastLen) stop = true
|
|
||||||
dropCurrent()
|
|
||||||
}
|
|
||||||
iterators = builder.result
|
|
||||||
normalize()
|
|
||||||
}
|
|
||||||
|
|
||||||
@tailrec final override def dropWhile(p: Byte => Boolean): this.type =
|
|
||||||
if (!isEmpty) {
|
|
||||||
current.dropWhile(p)
|
|
||||||
val dropMore = current.isEmpty
|
|
||||||
normalize()
|
|
||||||
if (dropMore) dropWhile(p) else this
|
|
||||||
} else this
|
|
||||||
|
|
||||||
final override def copyToArray[B >: Byte](xs: Array[B], start: Int, len: Int): Unit = {
|
|
||||||
var pos = start
|
|
||||||
var rest = len
|
|
||||||
while ((rest > 0) && !iterators.isEmpty) {
|
|
||||||
val n = 0 max ((xs.length - pos) min current.len min rest)
|
|
||||||
current.copyToArray(xs, pos, n)
|
|
||||||
pos += n
|
|
||||||
rest -= n
|
|
||||||
if (current.isEmpty) {
|
|
||||||
dropCurrent()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
normalize()
|
|
||||||
}
|
|
||||||
|
|
||||||
override def foreach[@specialized U](f: Byte => U): Unit = {
|
|
||||||
iterators.foreach { _.foreach(f) }
|
|
||||||
clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
final override def toByteString: ByteString = {
|
|
||||||
if (iterators.tail.isEmpty) iterators.head.toByteString
|
|
||||||
else {
|
|
||||||
val result = iterators.foldLeft(ByteString.empty) { _ ++ _.toByteString }
|
|
||||||
clear()
|
|
||||||
result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@tailrec protected final def getToArray[A](xs: Array[A], offset: Int, n: Int, elemSize: Int)(getSingle: => A)(
|
|
||||||
getMult: (Array[A], Int, Int) => Unit): this.type =
|
|
||||||
if (n <= 0) this
|
|
||||||
else {
|
|
||||||
if (isEmpty) EmptyImmutableSeq.iterator.next()
|
|
||||||
val nDone = if (current.len >= elemSize) {
|
|
||||||
val nCurrent = math.min(n, current.len / elemSize)
|
|
||||||
getMult(xs, offset, nCurrent)
|
|
||||||
nCurrent
|
|
||||||
} else {
|
|
||||||
xs(offset) = getSingle
|
|
||||||
1
|
|
||||||
}
|
|
||||||
normalize()
|
|
||||||
getToArray(xs, offset + nDone, n - nDone, elemSize)(getSingle)(getMult)
|
|
||||||
}
|
|
||||||
|
|
||||||
def getBytes(xs: Array[Byte], offset: Int, n: Int): this.type =
|
|
||||||
getToArray(xs, offset, n, 1) { getByte } { current.getBytes(_, _, _) }
|
|
||||||
|
|
||||||
def getShorts(xs: Array[Short], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getToArray(xs, offset, n, 2) { getShort(byteOrder) } { current.getShorts(_, _, _)(byteOrder) }
|
|
||||||
|
|
||||||
def getInts(xs: Array[Int], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getToArray(xs, offset, n, 4) { getInt(byteOrder) } { current.getInts(_, _, _)(byteOrder) }
|
|
||||||
|
|
||||||
def getLongs(xs: Array[Long], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getToArray(xs, offset, n, 8) { getLong(byteOrder) } { current.getLongs(_, _, _)(byteOrder) }
|
|
||||||
|
|
||||||
def getFloats(xs: Array[Float], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getToArray(xs, offset, n, 8) { getFloat(byteOrder) } { current.getFloats(_, _, _)(byteOrder) }
|
|
||||||
|
|
||||||
def getDoubles(xs: Array[Double], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getToArray(xs, offset, n, 8) { getDouble(byteOrder) } { current.getDoubles(_, _, _)(byteOrder) }
|
|
||||||
|
|
||||||
/** For performance sensitive code, call copyToBuffer() directly on ByteString (it's optimised there) */
|
|
||||||
override def copyToBuffer(buffer: ByteBuffer): Int = {
|
|
||||||
// the fold here is better than indexing into the LinearSeq
|
|
||||||
val n = iterators.foldLeft(0) { _ + _.copyToBuffer(buffer) }
|
|
||||||
normalize()
|
|
||||||
n
|
|
||||||
}
|
|
||||||
|
|
||||||
def asInputStream: java.io.InputStream = new java.io.InputStream {
|
|
||||||
override def available: Int = current.len
|
|
||||||
|
|
||||||
def read: Int = if (hasNext) (next().toInt & 0xff) else -1
|
|
||||||
|
|
||||||
override def read(b: Array[Byte], off: Int, len: Int): Int = {
|
|
||||||
val nRead = current.asInputStream.read(b, off, len)
|
|
||||||
normalize()
|
|
||||||
nRead
|
|
||||||
}
|
|
||||||
|
|
||||||
override def skip(n: Long): Long = {
|
|
||||||
@tailrec def skipImpl(n: Long, skipped: Long): Long =
|
|
||||||
if (n > 0) {
|
|
||||||
if (!isEmpty) {
|
|
||||||
val m = current.asInputStream.skip(n)
|
|
||||||
normalize()
|
|
||||||
val newN = n - m
|
|
||||||
val newSkipped = skipped + m
|
|
||||||
if (newN > 0) skipImpl(newN, newSkipped)
|
|
||||||
else newSkipped
|
|
||||||
} else 0
|
|
||||||
} else 0
|
|
||||||
|
|
||||||
skipImpl(n, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An iterator over a ByteString.
|
|
||||||
*/
|
|
||||||
abstract class ByteIterator extends BufferedIterator[Byte] {
|
|
||||||
def len: Int
|
|
||||||
|
|
||||||
def head: Byte
|
|
||||||
|
|
||||||
def next(): Byte
|
|
||||||
|
|
||||||
protected def clear(): Unit
|
|
||||||
|
|
||||||
def ++(that: TraversableOnce[Byte]): ByteIterator =
|
|
||||||
if (that.isEmpty) this else ByteIterator.ByteArrayIterator(that.toArray)
|
|
||||||
|
|
||||||
// *must* be overridden by derived classes. This construction is necessary
|
|
||||||
// to specialize the return type, as the method is already implemented in
|
|
||||||
// the parent class.
|
|
||||||
override def clone: ByteIterator =
|
|
||||||
throw new UnsupportedOperationException("Method clone is not implemented in ByteIterator")
|
|
||||||
|
|
||||||
override def duplicate: (ByteIterator, ByteIterator) = (this, clone)
|
|
||||||
|
|
||||||
// *must* be overridden by derived classes. This construction is necessary
|
|
||||||
// to specialize the return type, as the method is already implemented in
|
|
||||||
// the parent class.
|
|
||||||
override def take(n: Int): this.type =
|
|
||||||
throw new UnsupportedOperationException("Method take is not implemented in ByteIterator")
|
|
||||||
|
|
||||||
// *must* be overridden by derived classes. This construction is necessary
|
|
||||||
// to specialize the return type, as the method is already implemented in
|
|
||||||
// the parent class.
|
|
||||||
override def drop(n: Int): this.type =
|
|
||||||
throw new UnsupportedOperationException("Method drop is not implemented in ByteIterator")
|
|
||||||
|
|
||||||
override def slice(from: Int, until: Int): this.type = {
|
|
||||||
if (from > 0) drop(from).take(until - from)
|
|
||||||
else take(until)
|
|
||||||
}
|
|
||||||
|
|
||||||
// *must* be overridden by derived classes. This construction is necessary
|
|
||||||
// to specialize the return type, as the method is already implemented in
|
|
||||||
// the parent class.
|
|
||||||
override def takeWhile(p: Byte => Boolean): this.type =
|
|
||||||
throw new UnsupportedOperationException("Method takeWhile is not implemented in ByteIterator")
|
|
||||||
|
|
||||||
// *must* be overridden by derived classes. This construction is necessary
|
|
||||||
// to specialize the return type, as the method is already implemented in
|
|
||||||
// the parent class.
|
|
||||||
override def dropWhile(p: Byte => Boolean): this.type =
|
|
||||||
throw new UnsupportedOperationException("Method dropWhile is not implemented in ByteIterator")
|
|
||||||
|
|
||||||
override def span(p: Byte => Boolean): (ByteIterator, ByteIterator) = {
|
|
||||||
val that = clone
|
|
||||||
this.takeWhile(p)
|
|
||||||
that.drop(this.len)
|
|
||||||
(this, that)
|
|
||||||
}
|
|
||||||
|
|
||||||
override def indexWhere(p: Byte => Boolean): Int = indexWhere(p, 0)
|
|
||||||
def indexWhere(p: Byte => Boolean, from: Int): Int = {
|
|
||||||
var index = 0
|
|
||||||
while (index < from) {
|
|
||||||
next()
|
|
||||||
index += 1
|
|
||||||
}
|
|
||||||
var found = false
|
|
||||||
while (!found && hasNext) if (p(next())) {
|
|
||||||
found = true
|
|
||||||
} else {
|
|
||||||
index += 1
|
|
||||||
}
|
|
||||||
if (found) index else -1
|
|
||||||
}
|
|
||||||
|
|
||||||
def indexOf(elem: Byte): Int = indexOf(elem, 0)
|
|
||||||
def indexOf(elem: Byte, from: Int): Int = indexWhere(_ == elem, from)
|
|
||||||
|
|
||||||
override def indexOf[B >: Byte](elem: B): Int = indexOf[B](elem, 0)
|
|
||||||
def indexOf[B >: Byte](elem: B, from: Int): Int = indexWhere(_ == elem, from)
|
|
||||||
|
|
||||||
def toByteString: ByteString
|
|
||||||
|
|
||||||
override def toSeq: ByteString = toByteString
|
|
||||||
|
|
||||||
override def foreach[@specialized U](f: Byte => U): Unit =
|
|
||||||
while (hasNext) f(next())
|
|
||||||
|
|
||||||
override def foldLeft[@specialized B](z: B)(op: (B, Byte) => B): B = {
|
|
||||||
var acc = z
|
|
||||||
foreach { byte =>
|
|
||||||
acc = op(acc, byte)
|
|
||||||
}
|
|
||||||
acc
|
|
||||||
}
|
|
||||||
|
|
||||||
override def toArray[B >: Byte](implicit arg0: ClassTag[B]): Array[B] = {
|
|
||||||
val target = new Array[B](len)
|
|
||||||
copyToArray(target)
|
|
||||||
target
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a single Byte from this iterator. Identical to next().
|
|
||||||
*/
|
|
||||||
def getByte: Byte = next()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a single Short from this iterator.
|
|
||||||
*/
|
|
||||||
def getShort(implicit byteOrder: ByteOrder): Short = {
|
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
((next() & 0xff) << 8 | (next() & 0xff) << 0).toShort
|
|
||||||
else if (byteOrder == ByteOrder.LITTLE_ENDIAN)
|
|
||||||
((next() & 0xff) << 0 | (next() & 0xff) << 8).toShort
|
|
||||||
else throw new IllegalArgumentException("Unknown byte order " + byteOrder)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a single Int from this iterator.
|
|
||||||
*/
|
|
||||||
def getInt(implicit byteOrder: ByteOrder): Int = {
|
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
((next() & 0xff) << 24
|
|
||||||
| (next() & 0xff) << 16
|
|
||||||
| (next() & 0xff) << 8
|
|
||||||
| (next() & 0xff) << 0)
|
|
||||||
else if (byteOrder == ByteOrder.LITTLE_ENDIAN)
|
|
||||||
((next() & 0xff) << 0
|
|
||||||
| (next() & 0xff) << 8
|
|
||||||
| (next() & 0xff) << 16
|
|
||||||
| (next() & 0xff) << 24)
|
|
||||||
else throw new IllegalArgumentException("Unknown byte order " + byteOrder)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a single Long from this iterator.
|
|
||||||
*/
|
|
||||||
def getLong(implicit byteOrder: ByteOrder): Long = {
|
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN)
|
|
||||||
((next().toLong & 0xff) << 56
|
|
||||||
| (next().toLong & 0xff) << 48
|
|
||||||
| (next().toLong & 0xff) << 40
|
|
||||||
| (next().toLong & 0xff) << 32
|
|
||||||
| (next().toLong & 0xff) << 24
|
|
||||||
| (next().toLong & 0xff) << 16
|
|
||||||
| (next().toLong & 0xff) << 8
|
|
||||||
| (next().toLong & 0xff) << 0)
|
|
||||||
else if (byteOrder == ByteOrder.LITTLE_ENDIAN)
|
|
||||||
((next().toLong & 0xff) << 0
|
|
||||||
| (next().toLong & 0xff) << 8
|
|
||||||
| (next().toLong & 0xff) << 16
|
|
||||||
| (next().toLong & 0xff) << 24
|
|
||||||
| (next().toLong & 0xff) << 32
|
|
||||||
| (next().toLong & 0xff) << 40
|
|
||||||
| (next().toLong & 0xff) << 48
|
|
||||||
| (next().toLong & 0xff) << 56)
|
|
||||||
else throw new IllegalArgumentException("Unknown byte order " + byteOrder)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a Long from this iterator where only the least significant `n`
|
|
||||||
* bytes were encoded.
|
|
||||||
*/
|
|
||||||
def getLongPart(n: Int)(implicit byteOrder: ByteOrder): Long = {
|
|
||||||
if (byteOrder == ByteOrder.BIG_ENDIAN) {
|
|
||||||
var x = 0L
|
|
||||||
(1 to n).foreach(_ => x = (x << 8) | (next() & 0xff))
|
|
||||||
x
|
|
||||||
} else if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
|
|
||||||
var x = 0L
|
|
||||||
(0 until n).foreach(i => x |= (next() & 0xff) << 8 * i)
|
|
||||||
x
|
|
||||||
} else throw new IllegalArgumentException("Unknown byte order " + byteOrder)
|
|
||||||
}
|
|
||||||
|
|
||||||
def getFloat(implicit byteOrder: ByteOrder): Float =
|
|
||||||
java.lang.Float.intBitsToFloat(getInt(byteOrder))
|
|
||||||
|
|
||||||
def getDouble(implicit byteOrder: ByteOrder): Double =
|
|
||||||
java.lang.Double.longBitsToDouble(getLong(byteOrder))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a specific number of Bytes from this iterator. In contrast to
|
|
||||||
* copyToArray, this method will fail if this.len < xs.length.
|
|
||||||
*/
|
|
||||||
def getBytes(xs: Array[Byte]): this.type = getBytes(xs, 0, xs.length)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a specific number of Bytes from this iterator. In contrast to
|
|
||||||
* copyToArray, this method will fail if length < n or if (xs.length - offset) < n.
|
|
||||||
*/
|
|
||||||
def getBytes(xs: Array[Byte], offset: Int, n: Int): this.type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a specific number of Bytes from this iterator. In contrast to
|
|
||||||
* copyToArray, this method will fail if this.len < n.
|
|
||||||
*/
|
|
||||||
def getBytes(n: Int): Array[Byte] = {
|
|
||||||
val bytes = new Array[Byte](n)
|
|
||||||
getBytes(bytes, 0, n)
|
|
||||||
bytes
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a ByteString with specific number of Bytes from this iterator. In contrast to
|
|
||||||
* copyToArray, this method will fail if this.len < n.
|
|
||||||
*/
|
|
||||||
def getByteString(n: Int): ByteString = {
|
|
||||||
val bs = clone.take(n).toByteString
|
|
||||||
drop(n)
|
|
||||||
bs
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Shorts from this iterator.
|
|
||||||
*/
|
|
||||||
def getShorts(xs: Array[Short])(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getShorts(xs, 0, xs.length)(byteOrder)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Shorts from this iterator.
|
|
||||||
*/
|
|
||||||
def getShorts(xs: Array[Short], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Ints from this iterator.
|
|
||||||
*/
|
|
||||||
def getInts(xs: Array[Int])(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getInts(xs, 0, xs.length)(byteOrder)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Ints from this iterator.
|
|
||||||
*/
|
|
||||||
def getInts(xs: Array[Int], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Longs from this iterator.
|
|
||||||
*/
|
|
||||||
def getLongs(xs: Array[Long])(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getLongs(xs, 0, xs.length)(byteOrder)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Longs from this iterator.
|
|
||||||
*/
|
|
||||||
def getLongs(xs: Array[Long], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Floats from this iterator.
|
|
||||||
*/
|
|
||||||
def getFloats(xs: Array[Float])(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getFloats(xs, 0, xs.length)(byteOrder)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Floats from this iterator.
|
|
||||||
*/
|
|
||||||
def getFloats(xs: Array[Float], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Doubles from this iterator.
|
|
||||||
*/
|
|
||||||
def getDoubles(xs: Array[Double])(implicit byteOrder: ByteOrder): this.type =
|
|
||||||
getDoubles(xs, 0, xs.length)(byteOrder)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a number of Doubles from this iterator.
|
|
||||||
*/
|
|
||||||
def getDoubles(xs: Array[Double], offset: Int, n: Int)(implicit byteOrder: ByteOrder): this.type
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy as many bytes as possible to a ByteBuffer, starting from it's
|
|
||||||
* current position. This method will not overflow the buffer.
|
|
||||||
*
|
|
||||||
* @param buffer a ByteBuffer to copy bytes to
|
|
||||||
* @return the number of bytes actually copied
|
|
||||||
*/
|
|
||||||
/** For performance sensitive code, call take() directly on ByteString (it's optimised there) */
|
|
||||||
def copyToBuffer(buffer: ByteBuffer): Int
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Directly wraps this ByteIterator in an InputStream without copying.
|
|
||||||
* Read and skip operations on the stream will advance the iterator
|
|
||||||
* accordingly.
|
|
||||||
*/
|
|
||||||
def asInputStream: java.io.InputStream
|
|
||||||
}
|
|
||||||
|
|
@ -15,9 +15,9 @@ import com.github.ghik.silencer.silent
|
||||||
* INTERNAL API
|
* INTERNAL API
|
||||||
*
|
*
|
||||||
* Compatibility wrapper for `scala.concurrent.Future` to be able to compile the same code
|
* Compatibility wrapper for `scala.concurrent.Future` to be able to compile the same code
|
||||||
* against Scala 2.11, 2.12, 2.13
|
* against Scala 2.12, 2.13
|
||||||
*
|
*
|
||||||
* Remove these classes as soon as support for Scala 2.11 is dropped!
|
* Remove these classes as soon as support for Scala 2.12 is dropped!
|
||||||
*/
|
*/
|
||||||
@silent @InternalApi private[akka] object Future {
|
@silent @InternalApi private[akka] object Future {
|
||||||
def fold[T, R](futures: IterableOnce[SFuture[T]])(zero: R)(op: (R, T) => R)(
|
def fold[T, R](futures: IterableOnce[SFuture[T]])(zero: R)(op: (R, T) => R)(
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ import scala.collection.immutable
|
||||||
* INTERNAL API
|
* INTERNAL API
|
||||||
*
|
*
|
||||||
* Compatibility wrapper for `scala.concurrent.Future` to be able to compile the same code
|
* Compatibility wrapper for `scala.concurrent.Future` to be able to compile the same code
|
||||||
* against Scala 2.11, 2.12, 2.13
|
* against Scala 2.12, 2.13
|
||||||
*
|
*
|
||||||
* Remove these classes as soon as support for Scala 2.11 is dropped!
|
* Remove these classes as soon as support for Scala 2.12 is dropped!
|
||||||
*/
|
*/
|
||||||
@InternalApi private[akka] object Future {
|
@InternalApi private[akka] object Future {
|
||||||
def fold[T, R](futures: IterableOnce[SFuture[T]])(zero: R)(op: (R, T) => R)(
|
def fold[T, R](futures: IterableOnce[SFuture[T]])(zero: R)(op: (R, T) => R)(
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ and Java counterparts. The artifact can be included in Maven builds using:
|
||||||
```
|
```
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.scala-lang.modules</groupId>
|
<groupId>org.scala-lang.modules</groupId>
|
||||||
<artifactId>scala-java8-compat_2.11</artifactId>
|
<artifactId>scala-java8-compat_2.12</artifactId>
|
||||||
<version>0.7.0</version>
|
<version>0.7.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Migration Guide 2.5.x to 2.6.x
|
||||||
|
|
||||||
|
## Scala 2.11 no longer supported
|
||||||
|
|
||||||
|
If you are still using Scala 2.11 then you must upgrade to 2.12 or 2.13
|
||||||
|
|
@ -33,8 +33,6 @@ private[akka] final class DaemonMsgCreateSerializer(val system: ExtendedActorSys
|
||||||
import ProtobufSerializer.deserializeActorRef
|
import ProtobufSerializer.deserializeActorRef
|
||||||
import Deploy.NoDispatcherGiven
|
import Deploy.NoDispatcherGiven
|
||||||
|
|
||||||
private val scala212OrLater = !scala.util.Properties.versionNumberString.startsWith("2.11")
|
|
||||||
|
|
||||||
private lazy val serialization = SerializationExtension(system)
|
private lazy val serialization = SerializationExtension(system)
|
||||||
|
|
||||||
override val includeManifest: Boolean = false
|
override val includeManifest: Boolean = false
|
||||||
|
|
@ -207,8 +205,7 @@ private[akka] final class DaemonMsgCreateSerializer(val system: ExtendedActorSys
|
||||||
"null"
|
"null"
|
||||||
} else {
|
} else {
|
||||||
val className = m.getClass.getName
|
val className = m.getClass.getName
|
||||||
if (scala212OrLater && m.isInstanceOf[java.io.Serializable] && m.getClass.isSynthetic && className.contains(
|
if (m.isInstanceOf[java.io.Serializable] && m.getClass.isSynthetic && className.contains("$Lambda$")) {
|
||||||
"$Lambda$")) {
|
|
||||||
// When the additional-protobuf serializers are not enabled
|
// When the additional-protobuf serializers are not enabled
|
||||||
// the serialization of the parameters is based on passing class name instead of
|
// the serialization of the parameters is based on passing class name instead of
|
||||||
// serializerId and manifest as we usually do. With Scala 2.12 the functions are generated as
|
// serializerId and manifest as we usually do. With Scala 2.12 the functions are generated as
|
||||||
|
|
|
||||||
249
build.sbt
249
build.sbt
|
|
@ -1,6 +1,11 @@
|
||||||
import akka.{ AutomaticModuleName, CopyrightHeaderForBuild, ParadoxSupport, ScalafixIgnoreFilePlugin }
|
import akka.{ AutomaticModuleName, CopyrightHeaderForBuild, ParadoxSupport, ScalafixIgnoreFilePlugin }
|
||||||
|
|
||||||
enablePlugins(UnidocRoot, TimeStampede, UnidocWithPrValidation, NoPublish, CopyrightHeader,
|
enablePlugins(
|
||||||
|
UnidocRoot,
|
||||||
|
TimeStampede,
|
||||||
|
UnidocWithPrValidation,
|
||||||
|
NoPublish,
|
||||||
|
CopyrightHeader,
|
||||||
CopyrightHeaderInPr,
|
CopyrightHeaderInPr,
|
||||||
ScalafixIgnoreFilePlugin,
|
ScalafixIgnoreFilePlugin,
|
||||||
JavaFormatterPlugin)
|
JavaFormatterPlugin)
|
||||||
|
|
@ -23,66 +28,66 @@ initialize := {
|
||||||
}
|
}
|
||||||
|
|
||||||
akka.AkkaBuild.buildSettings
|
akka.AkkaBuild.buildSettings
|
||||||
shellPrompt := { s => Project.extract(s).currentProject.id + " > " }
|
shellPrompt := { s =>
|
||||||
|
Project.extract(s).currentProject.id + " > "
|
||||||
|
}
|
||||||
resolverSettings
|
resolverSettings
|
||||||
|
|
||||||
def isScala211: Boolean = System.getProperty("akka.build.scalaVersion", "").startsWith("2.11")
|
|
||||||
|
|
||||||
// When this is updated the set of modules in ActorSystem.allModules should also be updated
|
// When this is updated the set of modules in ActorSystem.allModules should also be updated
|
||||||
lazy val aggregatedProjects: Seq[ProjectReference] = List[ProjectReference](
|
lazy val aggregatedProjects: Seq[ProjectReference] = List[ProjectReference](
|
||||||
actor, actorTests,
|
actor,
|
||||||
|
actorTests,
|
||||||
|
actorTestkitTyped,
|
||||||
|
actorTyped,
|
||||||
|
actorTypedTests,
|
||||||
agent,
|
agent,
|
||||||
benchJmh,
|
benchJmh,
|
||||||
|
benchJmhTyped,
|
||||||
camel,
|
camel,
|
||||||
cluster, clusterMetrics, clusterSharding, clusterTools,
|
cluster,
|
||||||
|
clusterMetrics,
|
||||||
|
clusterSharding,
|
||||||
|
clusterShardingTyped,
|
||||||
|
clusterTools,
|
||||||
|
clusterTyped,
|
||||||
contrib,
|
contrib,
|
||||||
|
coordination,
|
||||||
|
discovery,
|
||||||
distributedData,
|
distributedData,
|
||||||
|
docs,
|
||||||
multiNodeTestkit,
|
multiNodeTestkit,
|
||||||
osgi,
|
osgi,
|
||||||
persistence, persistenceQuery, persistenceShared, persistenceTck,
|
persistence,
|
||||||
protobuf,
|
persistenceQuery,
|
||||||
remote, remoteTests,
|
persistenceShared,
|
||||||
slf4j,
|
persistenceTck,
|
||||||
stream, streamTestkit, streamTests, streamTestsTck,
|
|
||||||
testkit,
|
|
||||||
discovery,
|
|
||||||
coordination
|
|
||||||
) ++
|
|
||||||
(if (isScala211) List.empty[ProjectReference]
|
|
||||||
else List[ProjectReference](
|
|
||||||
docs,
|
|
||||||
actorTyped, actorTypedTests, actorTestkitTyped,
|
|
||||||
persistenceTyped,
|
persistenceTyped,
|
||||||
clusterTyped, clusterShardingTyped,
|
protobuf,
|
||||||
benchJmhTyped,
|
remote,
|
||||||
streamTyped
|
remoteTests,
|
||||||
))
|
slf4j,
|
||||||
|
stream,
|
||||||
|
streamTestkit,
|
||||||
|
streamTests,
|
||||||
|
streamTestsTck,
|
||||||
|
streamTyped,
|
||||||
|
testkit)
|
||||||
|
|
||||||
lazy val root = Project(
|
lazy val root = Project(id = "akka", base = file("."))
|
||||||
id = "akka",
|
.aggregate(aggregatedProjects: _*)
|
||||||
base = file(".")
|
|
||||||
).aggregate(aggregatedProjects: _*)
|
|
||||||
.settings(rootSettings: _*)
|
.settings(rootSettings: _*)
|
||||||
.settings(unidocRootIgnoreProjects :=
|
.settings(unidocRootIgnoreProjects := Seq(remoteTests, benchJmh, benchJmhTyped, protobuf, akkaScalaNightly, docs))
|
||||||
(CrossVersion.partialVersion(scalaVersion.value) match {
|
.settings(unmanagedSources in (Compile, headerCreate) := (baseDirectory.value / "project").**("*.scala").get)
|
||||||
case Some((2, n)) if n == 11 => aggregatedProjects // ignore all, don't unidoc when scalaVersion is 2.11
|
.enablePlugins(CopyrightHeaderForBuild)
|
||||||
case _ => Seq(remoteTests, benchJmh, benchJmhTyped, protobuf, akkaScalaNightly, docs)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.settings(
|
|
||||||
unmanagedSources in(Compile, headerCreate) := (baseDirectory.value / "project").**("*.scala").get
|
|
||||||
).enablePlugins(CopyrightHeaderForBuild)
|
|
||||||
|
|
||||||
lazy val actor = akkaModule("akka-actor")
|
lazy val actor = akkaModule("akka-actor")
|
||||||
.settings(Dependencies.actor)
|
.settings(Dependencies.actor)
|
||||||
.settings(OSGi.actor)
|
.settings(OSGi.actor)
|
||||||
.settings(AutomaticModuleName.settings("akka.actor"))
|
.settings(AutomaticModuleName.settings("akka.actor"))
|
||||||
.settings(
|
.settings(unmanagedSourceDirectories in Compile += {
|
||||||
unmanagedSourceDirectories in Compile += {
|
|
||||||
val ver = scalaVersion.value.take(4)
|
val ver = scalaVersion.value.take(4)
|
||||||
(scalaSource in Compile).value.getParentFile / s"scala-$ver"
|
(scalaSource in Compile).value.getParentFile / s"scala-$ver"
|
||||||
}
|
})
|
||||||
)
|
|
||||||
.settings(VersionGenerator.settings)
|
.settings(VersionGenerator.settings)
|
||||||
.enablePlugins(BoilerplatePlugin)
|
.enablePlugins(BoilerplatePlugin)
|
||||||
|
|
||||||
|
|
@ -101,37 +106,25 @@ lazy val agent = akkaModule("akka-agent")
|
||||||
|
|
||||||
lazy val akkaScalaNightly = akkaModule("akka-scala-nightly")
|
lazy val akkaScalaNightly = akkaModule("akka-scala-nightly")
|
||||||
// remove dependencies that we have to build ourselves (Scala STM)
|
// remove dependencies that we have to build ourselves (Scala STM)
|
||||||
.aggregate(aggregatedProjects diff List[ProjectReference](agent, docs): _*)
|
.aggregate(aggregatedProjects.diff(List[ProjectReference](agent, docs)): _*)
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
.disablePlugins(ValidatePullRequest, MimaPlugin, CopyrightHeaderInPr)
|
.disablePlugins(ValidatePullRequest, MimaPlugin, CopyrightHeaderInPr)
|
||||||
|
|
||||||
lazy val benchJmh = akkaModule("akka-bench-jmh")
|
lazy val benchJmh = akkaModule("akka-bench-jmh")
|
||||||
.dependsOn(
|
.dependsOn(Seq(actor, stream, streamTests, persistence, distributedData, testkit).map(
|
||||||
Seq(
|
_ % "compile->compile;compile->test"): _*)
|
||||||
actor,
|
|
||||||
stream, streamTests,
|
|
||||||
persistence, distributedData,
|
|
||||||
testkit
|
|
||||||
).map(_ % "compile->compile;compile->test"): _*
|
|
||||||
)
|
|
||||||
.settings(Dependencies.benchJmh)
|
.settings(Dependencies.benchJmh)
|
||||||
.enablePlugins(JmhPlugin, ScaladocNoVerificationOfDiagrams, NoPublish, CopyrightHeader)
|
.enablePlugins(JmhPlugin, ScaladocNoVerificationOfDiagrams, NoPublish, CopyrightHeader)
|
||||||
.disablePlugins(MimaPlugin, WhiteSourcePlugin, ValidatePullRequest, CopyrightHeaderInPr)
|
.disablePlugins(MimaPlugin, WhiteSourcePlugin, ValidatePullRequest, CopyrightHeaderInPr)
|
||||||
|
|
||||||
// typed benchmarks only on 2.12+
|
// typed benchmarks only on 2.12+
|
||||||
lazy val benchJmhTyped = akkaModule("akka-bench-jmh-typed")
|
lazy val benchJmhTyped = akkaModule("akka-bench-jmh-typed")
|
||||||
.dependsOn(
|
.dependsOn(Seq(persistenceTyped, distributedData, clusterTyped, testkit, benchJmh).map(
|
||||||
Seq(
|
_ % "compile->compile;compile->test"): _*)
|
||||||
persistenceTyped,
|
|
||||||
distributedData, clusterTyped,
|
|
||||||
testkit, benchJmh
|
|
||||||
).map(_ % "compile->compile;compile->test"): _*
|
|
||||||
)
|
|
||||||
.settings(Dependencies.benchJmh)
|
.settings(Dependencies.benchJmh)
|
||||||
.enablePlugins(JmhPlugin, ScaladocNoVerificationOfDiagrams, NoPublish, CopyrightHeader)
|
.enablePlugins(JmhPlugin, ScaladocNoVerificationOfDiagrams, NoPublish, CopyrightHeader)
|
||||||
.disablePlugins(MimaPlugin, WhiteSourcePlugin, ValidatePullRequest, CopyrightHeaderInPr)
|
.disablePlugins(MimaPlugin, WhiteSourcePlugin, ValidatePullRequest, CopyrightHeaderInPr)
|
||||||
|
|
||||||
|
|
||||||
lazy val camel = akkaModule("akka-camel")
|
lazy val camel = akkaModule("akka-camel")
|
||||||
.dependsOn(actor, slf4j, testkit % "test->test")
|
.dependsOn(actor, slf4j, testkit % "test->test")
|
||||||
.settings(Dependencies.camel)
|
.settings(Dependencies.camel)
|
||||||
|
|
@ -144,13 +137,10 @@ lazy val cluster = akkaModule("akka-cluster")
|
||||||
.settings(AutomaticModuleName.settings("akka.cluster"))
|
.settings(AutomaticModuleName.settings("akka.cluster"))
|
||||||
.settings(OSGi.cluster)
|
.settings(OSGi.cluster)
|
||||||
.settings(Protobuf.settings)
|
.settings(Protobuf.settings)
|
||||||
.settings(
|
.settings(parallelExecution in Test := false)
|
||||||
parallelExecution in Test := false
|
|
||||||
)
|
|
||||||
.configs(MultiJvm)
|
.configs(MultiJvm)
|
||||||
.enablePlugins(MultiNodeScalaTest)
|
.enablePlugins(MultiNodeScalaTest)
|
||||||
|
|
||||||
|
|
||||||
lazy val clusterMetrics = akkaModule("akka-cluster-metrics")
|
lazy val clusterMetrics = akkaModule("akka-cluster-metrics")
|
||||||
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", slf4j % "test->compile")
|
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", slf4j % "test->compile")
|
||||||
.settings(OSGi.clusterMetrics)
|
.settings(OSGi.clusterMetrics)
|
||||||
|
|
@ -158,9 +148,7 @@ lazy val clusterMetrics = akkaModule("akka-cluster-metrics")
|
||||||
.settings(AutomaticModuleName.settings("akka.cluster.metrics"))
|
.settings(AutomaticModuleName.settings("akka.cluster.metrics"))
|
||||||
.settings(Protobuf.settings)
|
.settings(Protobuf.settings)
|
||||||
.settings(SigarLoader.sigarSettings)
|
.settings(SigarLoader.sigarSettings)
|
||||||
.settings(
|
.settings(parallelExecution in Test := false)
|
||||||
parallelExecution in Test := false
|
|
||||||
)
|
|
||||||
.configs(MultiJvm)
|
.configs(MultiJvm)
|
||||||
.enablePlugins(MultiNodeScalaTest)
|
.enablePlugins(MultiNodeScalaTest)
|
||||||
|
|
||||||
|
|
@ -173,8 +161,7 @@ lazy val clusterSharding = akkaModule("akka-cluster-sharding")
|
||||||
cluster % "compile->compile;test->test;multi-jvm->multi-jvm",
|
cluster % "compile->compile;test->test;multi-jvm->multi-jvm",
|
||||||
distributedData,
|
distributedData,
|
||||||
persistence % "compile->compile",
|
persistence % "compile->compile",
|
||||||
clusterTools % "compile->compile;test->test"
|
clusterTools % "compile->compile;test->test")
|
||||||
)
|
|
||||||
.settings(Dependencies.clusterSharding)
|
.settings(Dependencies.clusterSharding)
|
||||||
.settings(AutomaticModuleName.settings("akka.cluster.sharding"))
|
.settings(AutomaticModuleName.settings("akka.cluster.sharding"))
|
||||||
.settings(OSGi.clusterSharding)
|
.settings(OSGi.clusterSharding)
|
||||||
|
|
@ -183,10 +170,7 @@ lazy val clusterSharding = akkaModule("akka-cluster-sharding")
|
||||||
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
|
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
|
||||||
|
|
||||||
lazy val clusterTools = akkaModule("akka-cluster-tools")
|
lazy val clusterTools = akkaModule("akka-cluster-tools")
|
||||||
.dependsOn(
|
.dependsOn(cluster % "compile->compile;test->test;multi-jvm->multi-jvm", coordination)
|
||||||
cluster % "compile->compile;test->test;multi-jvm->multi-jvm",
|
|
||||||
coordination
|
|
||||||
)
|
|
||||||
.settings(Dependencies.clusterTools)
|
.settings(Dependencies.clusterTools)
|
||||||
.settings(AutomaticModuleName.settings("akka.cluster.tools"))
|
.settings(AutomaticModuleName.settings("akka.cluster.tools"))
|
||||||
.settings(OSGi.clusterTools)
|
.settings(OSGi.clusterTools)
|
||||||
|
|
@ -199,8 +183,7 @@ lazy val contrib = akkaModule("akka-contrib")
|
||||||
.settings(Dependencies.contrib)
|
.settings(Dependencies.contrib)
|
||||||
.settings(AutomaticModuleName.settings("akka.contrib"))
|
.settings(AutomaticModuleName.settings("akka.contrib"))
|
||||||
.settings(OSGi.contrib)
|
.settings(OSGi.contrib)
|
||||||
.settings(
|
.settings(description :=
|
||||||
description :=
|
|
||||||
"""|
|
"""|
|
||||||
|This subproject provides a home to modules contributed by external
|
|This subproject provides a home to modules contributed by external
|
||||||
|developers which may or may not move into the officially supported code
|
|developers which may or may not move into the officially supported code
|
||||||
|
|
@ -210,8 +193,7 @@ lazy val contrib = akkaModule("akka-contrib")
|
||||||
|simplify based on your feedback. A module may be dropped in any release
|
|simplify based on your feedback. A module may be dropped in any release
|
||||||
|without prior deprecation. The Lightbend subscription does not cover
|
|without prior deprecation. The Lightbend subscription does not cover
|
||||||
|support for these modules.
|
|support for these modules.
|
||||||
|""".stripMargin
|
|""".stripMargin)
|
||||||
)
|
|
||||||
.configs(MultiJvm)
|
.configs(MultiJvm)
|
||||||
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
|
.enablePlugins(MultiNode, ScaladocNoVerificationOfDiagrams)
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
|
|
@ -227,7 +209,17 @@ lazy val distributedData = akkaModule("akka-distributed-data")
|
||||||
|
|
||||||
lazy val docs = akkaModule("akka-docs")
|
lazy val docs = akkaModule("akka-docs")
|
||||||
.dependsOn(
|
.dependsOn(
|
||||||
actor, cluster, clusterMetrics, slf4j, agent, osgi, persistenceTck, persistenceQuery, distributedData, stream, actorTyped,
|
actor,
|
||||||
|
cluster,
|
||||||
|
clusterMetrics,
|
||||||
|
slf4j,
|
||||||
|
agent,
|
||||||
|
osgi,
|
||||||
|
persistenceTck,
|
||||||
|
persistenceQuery,
|
||||||
|
distributedData,
|
||||||
|
stream,
|
||||||
|
actorTyped,
|
||||||
camel % "compile->compile;test->test",
|
camel % "compile->compile;test->test",
|
||||||
clusterTools % "compile->compile;test->test",
|
clusterTools % "compile->compile;test->test",
|
||||||
clusterSharding % "compile->compile;test->test",
|
clusterSharding % "compile->compile;test->test",
|
||||||
|
|
@ -239,14 +231,14 @@ lazy val docs = akkaModule("akka-docs")
|
||||||
clusterTyped % "compile->compile;test->test",
|
clusterTyped % "compile->compile;test->test",
|
||||||
clusterShardingTyped % "compile->compile;test->test",
|
clusterShardingTyped % "compile->compile;test->test",
|
||||||
actorTypedTests % "compile->compile;test->test",
|
actorTypedTests % "compile->compile;test->test",
|
||||||
streamTestkit % "compile->compile;test->test"
|
streamTestkit % "compile->compile;test->test")
|
||||||
)
|
|
||||||
.settings(Dependencies.docs)
|
.settings(Dependencies.docs)
|
||||||
.settings(
|
.settings(
|
||||||
name in (Compile, paradox) := "Akka",
|
name in (Compile, paradox) := "Akka",
|
||||||
Compile / paradoxProperties ++= Map(
|
Compile / paradoxProperties ++= Map(
|
||||||
"canonical.base_url" -> "https://doc.akka.io/docs/akka/current",
|
"canonical.base_url" -> "https://doc.akka.io/docs/akka/current",
|
||||||
"github.base_url" -> GitHub.url(version.value), // for links like this: @github[#1](#1) or @github[83986f9](83986f9)
|
"github.base_url" -> GitHub
|
||||||
|
.url(version.value), // for links like this: @github[#1](#1) or @github[83986f9](83986f9)
|
||||||
"extref.akka.http.base_url" -> "https://doc.akka.io/docs/akka-http/current/%s",
|
"extref.akka.http.base_url" -> "https://doc.akka.io/docs/akka-http/current/%s",
|
||||||
"extref.wikipedia.base_url" -> "https://en.wikipedia.org/wiki/%s",
|
"extref.wikipedia.base_url" -> "https://en.wikipedia.org/wiki/%s",
|
||||||
"extref.github.base_url" -> (GitHub.url(version.value) + "/%s"), // for links to our sources
|
"extref.github.base_url" -> (GitHub.url(version.value) + "/%s"), // for links to our sources
|
||||||
|
|
@ -266,15 +258,16 @@ lazy val docs = akkaModule("akka-docs")
|
||||||
"google.analytics.domain.name" -> "akka.io",
|
"google.analytics.domain.name" -> "akka.io",
|
||||||
"signature.akka.base_dir" -> (baseDirectory in ThisBuild).value.getAbsolutePath,
|
"signature.akka.base_dir" -> (baseDirectory in ThisBuild).value.getAbsolutePath,
|
||||||
"fiddle.code.base_dir" -> (sourceDirectory in Test).value.getAbsolutePath,
|
"fiddle.code.base_dir" -> (sourceDirectory in Test).value.getAbsolutePath,
|
||||||
"fiddle.akka.base_dir" -> (baseDirectory in ThisBuild).value.getAbsolutePath,
|
"fiddle.akka.base_dir" -> (baseDirectory in ThisBuild).value.getAbsolutePath),
|
||||||
),
|
|
||||||
Compile / paradoxGroups := Map("Language" -> Seq("Scala", "Java")),
|
Compile / paradoxGroups := Map("Language" -> Seq("Scala", "Java")),
|
||||||
resolvers += Resolver.jcenterRepo,
|
resolvers += Resolver.jcenterRepo,
|
||||||
apidocRootPackage := "akka",
|
apidocRootPackage := "akka",
|
||||||
deployRsyncArtifact := List((paradox in Compile).value -> s"www/docs/akka/${version.value}")
|
deployRsyncArtifact := List((paradox in Compile).value -> s"www/docs/akka/${version.value}"))
|
||||||
)
|
|
||||||
.enablePlugins(
|
.enablePlugins(
|
||||||
AkkaParadoxPlugin, DeployRsync, NoPublish, ParadoxBrowse,
|
AkkaParadoxPlugin,
|
||||||
|
DeployRsync,
|
||||||
|
NoPublish,
|
||||||
|
ParadoxBrowse,
|
||||||
ScaladocNoVerificationOfDiagrams,
|
ScaladocNoVerificationOfDiagrams,
|
||||||
StreamOperatorsIndexGenerator)
|
StreamOperatorsIndexGenerator)
|
||||||
.settings(ParadoxSupport.paradoxWithCustomDirectives)
|
.settings(ParadoxSupport.paradoxWithCustomDirectives)
|
||||||
|
|
@ -292,9 +285,7 @@ lazy val osgi = akkaModule("akka-osgi")
|
||||||
.settings(Dependencies.osgi)
|
.settings(Dependencies.osgi)
|
||||||
.settings(AutomaticModuleName.settings("akka.osgi"))
|
.settings(AutomaticModuleName.settings("akka.osgi"))
|
||||||
.settings(OSGi.osgi)
|
.settings(OSGi.osgi)
|
||||||
.settings(
|
.settings(parallelExecution in Test := false)
|
||||||
parallelExecution in Test := false
|
|
||||||
)
|
|
||||||
|
|
||||||
lazy val persistence = akkaModule("akka-persistence")
|
lazy val persistence = akkaModule("akka-persistence")
|
||||||
.dependsOn(actor, testkit % "test->test", protobuf)
|
.dependsOn(actor, testkit % "test->test", protobuf)
|
||||||
|
|
@ -302,31 +293,21 @@ lazy val persistence = akkaModule("akka-persistence")
|
||||||
.settings(AutomaticModuleName.settings("akka.persistence"))
|
.settings(AutomaticModuleName.settings("akka.persistence"))
|
||||||
.settings(OSGi.persistence)
|
.settings(OSGi.persistence)
|
||||||
.settings(Protobuf.settings)
|
.settings(Protobuf.settings)
|
||||||
.settings(
|
.settings(fork in Test := true)
|
||||||
fork in Test := true
|
|
||||||
)
|
|
||||||
|
|
||||||
lazy val persistenceQuery = akkaModule("akka-persistence-query")
|
lazy val persistenceQuery = akkaModule("akka-persistence-query")
|
||||||
.dependsOn(
|
.dependsOn(stream, persistence % "compile->compile;test->test", streamTestkit % "test")
|
||||||
stream,
|
|
||||||
persistence % "compile->compile;test->test",
|
|
||||||
streamTestkit % "test"
|
|
||||||
)
|
|
||||||
.settings(Dependencies.persistenceQuery)
|
.settings(Dependencies.persistenceQuery)
|
||||||
.settings(AutomaticModuleName.settings("akka.persistence.query"))
|
.settings(AutomaticModuleName.settings("akka.persistence.query"))
|
||||||
.settings(OSGi.persistenceQuery)
|
.settings(OSGi.persistenceQuery)
|
||||||
.settings(
|
.settings(fork in Test := true)
|
||||||
fork in Test := true
|
|
||||||
)
|
|
||||||
.enablePlugins(ScaladocNoVerificationOfDiagrams)
|
.enablePlugins(ScaladocNoVerificationOfDiagrams)
|
||||||
|
|
||||||
lazy val persistenceShared = akkaModule("akka-persistence-shared")
|
lazy val persistenceShared = akkaModule("akka-persistence-shared")
|
||||||
.dependsOn(persistence % "test->test", testkit % "test->test", remote % "test", protobuf)
|
.dependsOn(persistence % "test->test", testkit % "test->test", remote % "test", protobuf)
|
||||||
.settings(Dependencies.persistenceShared)
|
.settings(Dependencies.persistenceShared)
|
||||||
.settings(AutomaticModuleName.settings("akka.persistence.shared"))
|
.settings(AutomaticModuleName.settings("akka.persistence.shared"))
|
||||||
.settings(
|
.settings(fork in Test := true)
|
||||||
fork in Test := true
|
|
||||||
)
|
|
||||||
.enablePlugins(NoPublish)
|
.enablePlugins(NoPublish)
|
||||||
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
|
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
|
||||||
|
|
||||||
|
|
@ -335,9 +316,7 @@ lazy val persistenceTck = akkaModule("akka-persistence-tck")
|
||||||
.settings(Dependencies.persistenceTck)
|
.settings(Dependencies.persistenceTck)
|
||||||
.settings(AutomaticModuleName.settings("akka.persistence.tck"))
|
.settings(AutomaticModuleName.settings("akka.persistence.tck"))
|
||||||
//.settings(OSGi.persistenceTck) TODO: we do need to export this as OSGi bundle too?
|
//.settings(OSGi.persistenceTck) TODO: we do need to export this as OSGi bundle too?
|
||||||
.settings(
|
.settings(fork in Test := true)
|
||||||
fork in Test := true
|
|
||||||
)
|
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
|
|
||||||
lazy val protobuf = akkaModule("akka-protobuf")
|
lazy val protobuf = akkaModule("akka-protobuf")
|
||||||
|
|
@ -352,17 +331,13 @@ lazy val remote = akkaModule("akka-remote")
|
||||||
.settings(AutomaticModuleName.settings("akka.remote"))
|
.settings(AutomaticModuleName.settings("akka.remote"))
|
||||||
.settings(OSGi.remote)
|
.settings(OSGi.remote)
|
||||||
.settings(Protobuf.settings)
|
.settings(Protobuf.settings)
|
||||||
.settings(
|
.settings(parallelExecution in Test := false)
|
||||||
parallelExecution in Test := false
|
|
||||||
)
|
|
||||||
|
|
||||||
lazy val remoteTests = akkaModule("akka-remote-tests")
|
lazy val remoteTests = akkaModule("akka-remote-tests")
|
||||||
.dependsOn(actorTests % "test->test", remote % "test->test", streamTestkit % "test", multiNodeTestkit)
|
.dependsOn(actorTests % "test->test", remote % "test->test", streamTestkit % "test", multiNodeTestkit)
|
||||||
.settings(Dependencies.remoteTests)
|
.settings(Dependencies.remoteTests)
|
||||||
.settings(Protobuf.settings)
|
.settings(Protobuf.settings)
|
||||||
.settings(
|
.settings(parallelExecution in Test := false)
|
||||||
parallelExecution in Test := false
|
|
||||||
)
|
|
||||||
.configs(MultiJvm)
|
.configs(MultiJvm)
|
||||||
.enablePlugins(MultiNodeScalaTest, NoPublish)
|
.enablePlugins(MultiNodeScalaTest, NoPublish)
|
||||||
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
|
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
|
||||||
|
|
@ -402,8 +377,7 @@ lazy val streamTestsTck = akkaModule("akka-stream-tests-tck")
|
||||||
// is causing long GC pauses when running with G1 on
|
// is causing long GC pauses when running with G1 on
|
||||||
// the CI build servers. Therefore we fork these tests
|
// the CI build servers. Therefore we fork these tests
|
||||||
// to run with small heap without G1.
|
// to run with small heap without G1.
|
||||||
fork in Test := true
|
fork in Test := true)
|
||||||
)
|
|
||||||
.enablePlugins(NoPublish)
|
.enablePlugins(NoPublish)
|
||||||
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
|
.disablePlugins(MimaPlugin, WhiteSourcePlugin)
|
||||||
|
|
||||||
|
|
@ -412,17 +386,14 @@ lazy val testkit = akkaModule("akka-testkit")
|
||||||
.settings(Dependencies.testkit)
|
.settings(Dependencies.testkit)
|
||||||
.settings(AutomaticModuleName.settings("akka.actor.testkit"))
|
.settings(AutomaticModuleName.settings("akka.actor.testkit"))
|
||||||
.settings(OSGi.testkit)
|
.settings(OSGi.testkit)
|
||||||
.settings(
|
.settings(initialCommands += "import akka.testkit._")
|
||||||
initialCommands += "import akka.testkit._"
|
|
||||||
)
|
|
||||||
|
|
||||||
lazy val actorTyped = akkaModule("akka-actor-typed")
|
lazy val actorTyped = akkaModule("akka-actor-typed")
|
||||||
.dependsOn(actor)
|
.dependsOn(actor)
|
||||||
.settings(AkkaBuild.mayChangeSettings)
|
.settings(AkkaBuild.mayChangeSettings)
|
||||||
.settings(AutomaticModuleName.settings("akka.actor.typed")) // fine for now, eventually new module name to become typed.actor
|
.settings(AutomaticModuleName.settings("akka.actor.typed")) // fine for now, eventually new module name to become typed.actor
|
||||||
.settings(OSGi.actorTyped)
|
.settings(OSGi.actorTyped)
|
||||||
.settings(
|
.settings(initialCommands :=
|
||||||
initialCommands :=
|
|
||||||
"""
|
"""
|
||||||
import akka.actor.typed._
|
import akka.actor.typed._
|
||||||
import akka.actor.typed.scaladsl.Behaviors
|
import akka.actor.typed.scaladsl.Behaviors
|
||||||
|
|
@ -430,8 +401,7 @@ lazy val actorTyped = akkaModule("akka-actor-typed")
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import akka.util.Timeout
|
import akka.util.Timeout
|
||||||
implicit val timeout = Timeout(5.seconds)
|
implicit val timeout = Timeout(5.seconds)
|
||||||
"""
|
""")
|
||||||
)
|
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
|
|
||||||
lazy val persistenceTyped = akkaModule("akka-persistence-typed")
|
lazy val persistenceTyped = akkaModule("akka-persistence-typed")
|
||||||
|
|
@ -440,8 +410,7 @@ lazy val persistenceTyped = akkaModule("akka-persistence-typed")
|
||||||
persistence % "compile->compile;test->test",
|
persistence % "compile->compile;test->test",
|
||||||
persistenceQuery % "test",
|
persistenceQuery % "test",
|
||||||
actorTypedTests % "test->test",
|
actorTypedTests % "test->test",
|
||||||
actorTestkitTyped % "compile->compile;test->test"
|
actorTestkitTyped % "compile->compile;test->test")
|
||||||
)
|
|
||||||
.settings(Dependencies.persistenceShared)
|
.settings(Dependencies.persistenceShared)
|
||||||
.settings(AkkaBuild.mayChangeSettings)
|
.settings(AkkaBuild.mayChangeSettings)
|
||||||
.settings(AutomaticModuleName.settings("akka.persistence.typed"))
|
.settings(AutomaticModuleName.settings("akka.persistence.typed"))
|
||||||
|
|
@ -459,8 +428,7 @@ lazy val clusterTyped = akkaModule("akka-cluster-typed")
|
||||||
protobuf,
|
protobuf,
|
||||||
actorTestkitTyped % "test->test",
|
actorTestkitTyped % "test->test",
|
||||||
actorTypedTests % "test->test",
|
actorTypedTests % "test->test",
|
||||||
remoteTests % "test->test"
|
remoteTests % "test->test")
|
||||||
)
|
|
||||||
.settings(AkkaBuild.mayChangeSettings)
|
.settings(AkkaBuild.mayChangeSettings)
|
||||||
.settings(AutomaticModuleName.settings("akka.cluster.typed"))
|
.settings(AutomaticModuleName.settings("akka.cluster.typed"))
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
|
|
@ -475,8 +443,7 @@ lazy val clusterShardingTyped = akkaModule("akka-cluster-sharding-typed")
|
||||||
actorTestkitTyped % "test->test",
|
actorTestkitTyped % "test->test",
|
||||||
actorTypedTests % "test->test",
|
actorTypedTests % "test->test",
|
||||||
persistenceTyped % "test->test",
|
persistenceTyped % "test->test",
|
||||||
remoteTests % "test->test"
|
remoteTests % "test->test")
|
||||||
)
|
|
||||||
.settings(AkkaBuild.mayChangeSettings)
|
.settings(AkkaBuild.mayChangeSettings)
|
||||||
.settings(AutomaticModuleName.settings("akka.cluster.sharding.typed"))
|
.settings(AutomaticModuleName.settings("akka.cluster.sharding.typed"))
|
||||||
// To be able to import ContainerFormats.proto
|
// To be able to import ContainerFormats.proto
|
||||||
|
|
@ -491,8 +458,7 @@ lazy val streamTyped = akkaModule("akka-stream-typed")
|
||||||
stream,
|
stream,
|
||||||
streamTestkit % "test->test",
|
streamTestkit % "test->test",
|
||||||
actorTestkitTyped % "test->test",
|
actorTestkitTyped % "test->test",
|
||||||
actorTypedTests % "test->test"
|
actorTypedTests % "test->test")
|
||||||
)
|
|
||||||
.settings(AkkaBuild.mayChangeSettings)
|
.settings(AkkaBuild.mayChangeSettings)
|
||||||
.settings(AutomaticModuleName.settings("akka.stream.typed"))
|
.settings(AutomaticModuleName.settings("akka.stream.typed"))
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
|
|
@ -505,38 +471,25 @@ lazy val actorTestkitTyped = akkaModule("akka-actor-testkit-typed")
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
|
|
||||||
lazy val actorTypedTests = akkaModule("akka-actor-typed-tests")
|
lazy val actorTypedTests = akkaModule("akka-actor-typed-tests")
|
||||||
.dependsOn(
|
.dependsOn(actorTyped, actorTestkitTyped % "compile->compile;test->test")
|
||||||
actorTyped,
|
|
||||||
actorTestkitTyped % "compile->compile;test->test"
|
|
||||||
)
|
|
||||||
.settings(AkkaBuild.mayChangeSettings)
|
.settings(AkkaBuild.mayChangeSettings)
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
.enablePlugins(NoPublish)
|
.enablePlugins(NoPublish)
|
||||||
|
|
||||||
lazy val discovery = akkaModule("akka-discovery")
|
lazy val discovery = akkaModule("akka-discovery")
|
||||||
.dependsOn(
|
.dependsOn(actor, testkit % "test->test", actorTests % "test->test")
|
||||||
actor,
|
|
||||||
testkit % "test->test",
|
|
||||||
actorTests % "test->test"
|
|
||||||
)
|
|
||||||
.settings(Dependencies.discovery)
|
.settings(Dependencies.discovery)
|
||||||
.settings(AutomaticModuleName.settings("akka.discovery"))
|
.settings(AutomaticModuleName.settings("akka.discovery"))
|
||||||
.settings(OSGi.discovery)
|
.settings(OSGi.discovery)
|
||||||
|
|
||||||
lazy val coordination = akkaModule("akka-coordination")
|
lazy val coordination = akkaModule("akka-coordination")
|
||||||
.dependsOn(
|
.dependsOn(actor, testkit % "test->test", actorTests % "test->test", cluster % "test->test")
|
||||||
actor,
|
|
||||||
testkit % "test->test",
|
|
||||||
actorTests % "test->test",
|
|
||||||
cluster % "test->test"
|
|
||||||
)
|
|
||||||
.settings(Dependencies.coordination)
|
.settings(Dependencies.coordination)
|
||||||
.settings(AutomaticModuleName.settings("akka.coordination"))
|
.settings(AutomaticModuleName.settings("akka.coordination"))
|
||||||
.settings(OSGi.coordination)
|
.settings(OSGi.coordination)
|
||||||
.settings(AkkaBuild.mayChangeSettings)
|
.settings(AkkaBuild.mayChangeSettings)
|
||||||
.disablePlugins(MimaPlugin)
|
.disablePlugins(MimaPlugin)
|
||||||
|
|
||||||
|
|
||||||
def akkaModule(name: String): Project =
|
def akkaModule(name: String): Project =
|
||||||
Project(id = name, base = file(name))
|
Project(id = name, base = file(name))
|
||||||
.enablePlugins(ReproducibleBuildsPlugin)
|
.enablePlugins(ReproducibleBuildsPlugin)
|
||||||
|
|
@ -560,17 +513,17 @@ addCommandAlias("allClusterCore", commandValue(cluster))
|
||||||
addCommandAlias("allClusterMetrics", commandValue(clusterMetrics))
|
addCommandAlias("allClusterMetrics", commandValue(clusterMetrics))
|
||||||
addCommandAlias("allClusterSharding", commandValue(clusterSharding))
|
addCommandAlias("allClusterSharding", commandValue(clusterSharding))
|
||||||
addCommandAlias("allClusterTools", commandValue(clusterTools))
|
addCommandAlias("allClusterTools", commandValue(clusterTools))
|
||||||
addCommandAlias("allCluster", Seq(
|
addCommandAlias(
|
||||||
commandValue(cluster),
|
"allCluster",
|
||||||
commandValue(distributedData),
|
Seq(commandValue(cluster), commandValue(distributedData), commandValue(clusterSharding), commandValue(clusterTools)).mkString)
|
||||||
commandValue(clusterSharding),
|
|
||||||
commandValue(clusterTools)).mkString)
|
|
||||||
addCommandAlias("allCoordination", commandValue(coordination))
|
addCommandAlias("allCoordination", commandValue(coordination))
|
||||||
addCommandAlias("allDistributedData", commandValue(distributedData))
|
addCommandAlias("allDistributedData", commandValue(distributedData))
|
||||||
addCommandAlias("allPersistence", commandValue(persistence))
|
addCommandAlias("allPersistence", commandValue(persistence))
|
||||||
addCommandAlias("allStream", commandValue(stream, Some(streamTests)))
|
addCommandAlias("allStream", commandValue(stream, Some(streamTests)))
|
||||||
addCommandAlias("allDiscovery", commandValue(discovery))
|
addCommandAlias("allDiscovery", commandValue(discovery))
|
||||||
addCommandAlias("allTyped", Seq(
|
addCommandAlias(
|
||||||
|
"allTyped",
|
||||||
|
Seq(
|
||||||
commandValue(actorTyped, Some(actorTypedTests)),
|
commandValue(actorTyped, Some(actorTypedTests)),
|
||||||
commandValue(actorTestkitTyped),
|
commandValue(actorTestkitTyped),
|
||||||
commandValue(clusterTyped),
|
commandValue(clusterTyped),
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,6 @@ object AkkaBuild {
|
||||||
scalacOptions in Compile ++= (
|
scalacOptions in Compile ++= (
|
||||||
if (JavaVersion.isJdk8)
|
if (JavaVersion.isJdk8)
|
||||||
Seq("-target:jvm-1.8")
|
Seq("-target:jvm-1.8")
|
||||||
else
|
|
||||||
if (scalaBinaryVersion.value == "2.11")
|
|
||||||
Seq("-target:jvm-1.8", "-javabootclasspath", CrossJava.Keys.fullJavaHomes.value("8") + "/jre/lib/rt.jar")
|
|
||||||
else
|
else
|
||||||
// -release 8 is not enough, for some reason we need the 8 rt.jar explicitly #25330
|
// -release 8 is not enough, for some reason we need the 8 rt.jar explicitly #25330
|
||||||
Seq("-release", "8", "-javabootclasspath", CrossJava.Keys.fullJavaHomes.value("8") + "/jre/lib/rt.jar")),
|
Seq("-release", "8", "-javabootclasspath", CrossJava.Keys.fullJavaHomes.value("8") + "/jre/lib/rt.jar")),
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,7 @@ object AkkaDisciplinePlugin extends AutoPlugin with ScalafixSupport {
|
||||||
lazy val scalaFixSettings = Seq(Compile / scalacOptions += "-Yrangepos")
|
lazy val scalaFixSettings = Seq(Compile / scalacOptions += "-Yrangepos")
|
||||||
|
|
||||||
lazy val scoverageSettings =
|
lazy val scoverageSettings =
|
||||||
Seq(coverageMinimum := 70, coverageFailOnMinimum := false, coverageOutputHTML := true, coverageHighlighting := {
|
Seq(coverageMinimum := 70, coverageFailOnMinimum := false, coverageOutputHTML := true, coverageHighlighting := true)
|
||||||
import sbt.librarymanagement.{ SemanticSelector, VersionNumber }
|
|
||||||
!VersionNumber(scalaVersion.value).matchesSemVer(SemanticSelector("<=2.11.1"))
|
|
||||||
})
|
|
||||||
|
|
||||||
lazy val silencerSettings = {
|
lazy val silencerSettings = {
|
||||||
val silencerVersion = "1.3.1"
|
val silencerVersion = "1.3.1"
|
||||||
|
|
@ -55,7 +52,7 @@ object AkkaDisciplinePlugin extends AutoPlugin with ScalafixSupport {
|
||||||
silencerSettings ++
|
silencerSettings ++
|
||||||
scoverageSettings ++ Seq(
|
scoverageSettings ++ Seq(
|
||||||
Compile / scalacOptions ++= (
|
Compile / scalacOptions ++= (
|
||||||
if (!scalaVersion.value.startsWith("2.11") && !nonFatalWarningsFor(name.value)) Seq("-Xfatal-warnings")
|
if (!nonFatalWarningsFor(name.value)) Seq("-Xfatal-warnings")
|
||||||
else Seq.empty
|
else Seq.empty
|
||||||
),
|
),
|
||||||
Test / scalacOptions --= testUndicipline,
|
Test / scalacOptions --= testUndicipline,
|
||||||
|
|
@ -74,12 +71,6 @@ object AkkaDisciplinePlugin extends AutoPlugin with ScalafixSupport {
|
||||||
case _ =>
|
case _ =>
|
||||||
Nil
|
Nil
|
||||||
}).toSeq,
|
}).toSeq,
|
||||||
Compile / doc / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
|
|
||||||
case Some((2, 11)) =>
|
|
||||||
Seq("-no-link-warnings")
|
|
||||||
case _ =>
|
|
||||||
Seq.empty
|
|
||||||
}),
|
|
||||||
Compile / scalacOptions --=
|
Compile / scalacOptions --=
|
||||||
(if (strictProjects.contains(name.value)) Seq.empty
|
(if (strictProjects.contains(name.value)) Seq.empty
|
||||||
else undisciplineScalacOptions.toSeq),
|
else undisciplineScalacOptions.toSeq),
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,12 @@ object Dependencies {
|
||||||
crossScalaVersions := Seq("2.12.8", "2.13.0-M5"),
|
crossScalaVersions := Seq("2.12.8", "2.13.0-M5"),
|
||||||
scalaVersion := System.getProperty("akka.build.scalaVersion", crossScalaVersions.value.head),
|
scalaVersion := System.getProperty("akka.build.scalaVersion", crossScalaVersions.value.head),
|
||||||
scalaStmVersion := sys.props.get("akka.build.scalaStmVersion").getOrElse("0.9"),
|
scalaStmVersion := sys.props.get("akka.build.scalaStmVersion").getOrElse("0.9"),
|
||||||
scalaCheckVersion := sys.props
|
scalaCheckVersion := sys.props.get("akka.build.scalaCheckVersion").getOrElse("1.14.0"),
|
||||||
.get("akka.build.scalaCheckVersion")
|
|
||||||
.getOrElse(CrossVersion.partialVersion(scalaVersion.value) match {
|
|
||||||
case Some((2, n)) if n >= 12 => "1.14.0" // does not work for 2.11
|
|
||||||
case _ => "1.13.2"
|
|
||||||
}),
|
|
||||||
scalaTestVersion := "3.0.7",
|
scalaTestVersion := "3.0.7",
|
||||||
java8CompatVersion := {
|
java8CompatVersion := {
|
||||||
CrossVersion.partialVersion(scalaVersion.value) match {
|
CrossVersion.partialVersion(scalaVersion.value) match {
|
||||||
case Some((2, n)) if n >= 13 => "0.9.0"
|
case Some((2, n)) if n >= 13 => "0.9.0"
|
||||||
case Some((2, n)) if n == 12 => "0.8.0"
|
case _ => "0.8.0"
|
||||||
case _ => "0.7.0"
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,6 @@ object Jdk9 extends AutoPlugin {
|
||||||
|
|
||||||
lazy val CompileJdk9 = config("CompileJdk9").extend(Compile)
|
lazy val CompileJdk9 = config("CompileJdk9").extend(Compile)
|
||||||
|
|
||||||
def notOnScala211[T](scalaBinaryVersion: String, values: Seq[T]): Seq[T] = scalaBinaryVersion match {
|
|
||||||
case "2.11" => Seq()
|
|
||||||
case _ => values
|
|
||||||
}
|
|
||||||
|
|
||||||
val SCALA_SOURCE_DIRECTORY = "scala-jdk-9"
|
val SCALA_SOURCE_DIRECTORY = "scala-jdk-9"
|
||||||
val SCALA_TEST_SOURCE_DIRECTORY = "scala-jdk9-only"
|
val SCALA_TEST_SOURCE_DIRECTORY = "scala-jdk9-only"
|
||||||
val JAVA_SOURCE_DIRECTORY = "java-jdk-9"
|
val JAVA_SOURCE_DIRECTORY = "java-jdk-9"
|
||||||
|
|
@ -25,15 +20,11 @@ object Jdk9 extends AutoPlugin {
|
||||||
val compileJdk9Settings = Seq(
|
val compileJdk9Settings = Seq(
|
||||||
// following the scala-2.12, scala-sbt-1.0, ... convention
|
// following the scala-2.12, scala-sbt-1.0, ... convention
|
||||||
unmanagedSourceDirectories := notOnJdk8(
|
unmanagedSourceDirectories := notOnJdk8(
|
||||||
notOnScala211(
|
|
||||||
scalaBinaryVersion.value,
|
|
||||||
Seq(
|
Seq(
|
||||||
(Compile / sourceDirectory).value / SCALA_SOURCE_DIRECTORY,
|
(Compile / sourceDirectory).value / SCALA_SOURCE_DIRECTORY,
|
||||||
(Compile / sourceDirectory).value / JAVA_SOURCE_DIRECTORY))),
|
(Compile / sourceDirectory).value / JAVA_SOURCE_DIRECTORY)),
|
||||||
scalacOptions := AkkaBuild.DefaultScalacOptions ++ notOnJdk8(
|
scalacOptions := AkkaBuild.DefaultScalacOptions ++ notOnJdk8(Seq("-release", "11")),
|
||||||
notOnScala211(scalaBinaryVersion.value, Seq("-release", "11"))),
|
javacOptions := AkkaBuild.DefaultJavacOptions ++ notOnJdk8(Seq("--release", "11")))
|
||||||
javacOptions := AkkaBuild.DefaultJavacOptions ++ notOnJdk8(
|
|
||||||
notOnScala211(scalaBinaryVersion.value, Seq("--release", "11"))))
|
|
||||||
|
|
||||||
val compileSettings = Seq(
|
val compileSettings = Seq(
|
||||||
// It might have been more 'neat' to add the jdk9 products to the jar via packageBin/mappings, but that doesn't work with the OSGi plugin,
|
// It might have been more 'neat' to add the jdk9 products to the jar via packageBin/mappings, but that doesn't work with the OSGi plugin,
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,6 @@ object MiMa extends AutoPlugin {
|
||||||
val akka2519NewArtifacts = Seq("akka-discovery")
|
val akka2519NewArtifacts = Seq("akka-discovery")
|
||||||
|
|
||||||
scalaBinaryVersion match {
|
scalaBinaryVersion match {
|
||||||
case "2.11" =>
|
|
||||||
if (akka2519NewArtifacts.contains(projectName))
|
|
||||||
akka25DiscoveryVersions
|
|
||||||
else if (akka250NewArtifacts.contains(projectName)) akka25Versions
|
|
||||||
else {
|
|
||||||
if (!akka242NewArtifacts.contains(projectName)) akka24NoStreamVersions
|
|
||||||
else Seq.empty
|
|
||||||
} ++ akka24StreamVersions ++ akka24WithScala212 ++ akka25Versions
|
|
||||||
|
|
||||||
case "2.12" =>
|
case "2.12" =>
|
||||||
if (akka2519NewArtifacts.contains(projectName))
|
if (akka2519NewArtifacts.contains(projectName))
|
||||||
akka25DiscoveryVersions
|
akka25DiscoveryVersions
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ else
|
||||||
RELEASE_OPT="-Dakka.genjavadoc.enabled=true"
|
RELEASE_OPT="-Dakka.genjavadoc.enabled=true"
|
||||||
fi
|
fi
|
||||||
try sbt $RELEASE_OPT +buildRelease
|
try sbt $RELEASE_OPT +buildRelease
|
||||||
try sbt -Dakka.build.scalaVersion=2.11.12 -D$RELEASE_OPT buildRelease
|
try sbt -Dakka.build.scalaVersion=2.12.8 -D$RELEASE_OPT buildRelease
|
||||||
try sbt $RELEASE_OPT buildDocs
|
try sbt $RELEASE_OPT buildDocs
|
||||||
echolog "Successfully created local release"
|
echolog "Successfully created local release"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ exec scala "$0" "$@"
|
||||||
* or if on non unixy os:
|
* or if on non unixy os:
|
||||||
* scala authors.scala tag1 tag2
|
* scala authors.scala tag1 tag2
|
||||||
*
|
*
|
||||||
* requires scala 2.11.x+ and command line git on path
|
* requires scala 2.12.x+ and command line git on path
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import scala.sys.process._
|
import scala.sys.process._
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue