Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support cross-building for scala 3 #544

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
java: [21]
scala: [2.13.13]
scala: [2.13.13, 3.4.1]
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ import com.netflix.atlas.core.validation.CompositeTagRule
import com.netflix.atlas.core.validation.Rule
import com.netflix.atlas.core.validation.TagRule
import com.netflix.atlas.core.validation.ValidationResult
import com.netflix.iep.config.NetflixEnvironment
import com.netflix.iep.config.ConfigListener
import com.netflix.iep.config.ConfigManager
import com.netflix.spectator.api.Id
import com.netflix.spectator.api.NoopRegistry
import com.netflix.spectator.api.Tag
import com.netflix.spectator.atlas.impl.Parser
import com.netflix.spectator.atlas.impl.Query
import com.netflix.spectator.atlas.impl.QueryIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ abstract class CloudWatchMetricsProcessor(
publishRouter.publish(atlasDp)
}
}
case (_, _) => // no-op
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,20 +272,23 @@ class RedisClusterCloudWatchMetricsProcessor(
Using.resource(jedis.getClusterNodes.get(node).getResource) { jedis =>
try {
var cursor: Array[Byte] = ScanParams.SCAN_POINTER_START_BINARY
do {
while ({
// do
val scanResult = jedis.executeCommand(commandObjects.scan(cursor, scanParams))
val keys = scanResult.getResult.asScala.toSeq
logger.debug(s"Scanned keys ${keys.size} from node ${node}")
if (keys.nonEmpty) {
keys.foreach(k => {
keys.foreach { k =>
val slot = JedisClusterCRC16.getSlot(k)
val slotKeys = slotToKeys.getOrElseUpdate(slot, new ArrayBuffer[Array[Byte]]())
slotKeys += k
})
}
sum += keys.size
}
cursor = scanResult.getCursorAsBytes
} while (!util.Arrays.equals(cursor, ScanParams.SCAN_POINTER_START_BINARY))
// while
!util.Arrays.equals(cursor, ScanParams.SCAN_POINTER_START_BINARY)
}) ()
true
} catch {
case ex: Exception =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import scala.concurrent.Future
import scala.concurrent.duration.*

trait MarkerService {
var queue: SourceQueue[Report]
def queue: SourceQueue[Report]
}

class MarkerServiceImpl(
Expand All @@ -66,7 +66,9 @@ class MarkerServiceImpl(
private implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.global
private var killSwitch: KillSwitch = _

override var queue: SourceQueue[Report] = _
private var sourceQueue: SourceQueue[Report] = _

override def queue: SourceQueue[Report] = sourceQueue

override def startImpl(): Unit = {
val sizeLimit = config.getInt("iep.lwc.fwding-admin.queue-size-limit")
Expand Down Expand Up @@ -94,7 +96,7 @@ class MarkerServiceImpl(
.toMat(Sink.ignore)(Keep.left)
.run()

queue = q
sourceQueue = q
killSwitch = k

logger.info("MarkerService started")
Expand All @@ -113,7 +115,7 @@ object MarkerServiceImpl extends StrictLogging {
scalingPolicies: ActorSelection
)(implicit ec: ExecutionContext): Flow[Report, ScalingPolicyStatus, NotUsed] = {
import ScalingPolicies.*
implicit val askTimeout = Timeout(15.seconds)
implicit val askTimeout: Timeout = Timeout(15.seconds)

Flow[Report]
.mapAsync(1) { r =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class MarkerServiceTest(implicit

var result = List.newBuilder[Report]

override var queue: SourceQueue[Report] = StreamOps
override val queue: SourceQueue[Report] = StreamOps
.blockingQueue[Report](new NoopRegistry(), "fwdingAdminCwReports", 1)
.map(result += _)
.toMat(Sink.ignore)(Keep.left)
Expand Down
9 changes: 6 additions & 3 deletions project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ object BuildSettings {
val compilerFlags = Seq(
"-deprecation",
"-unchecked",
"-Xlint:_,-infer-any",
"-feature",
"-release", "21",
"-Xsource:3"
)

lazy val checkLicenseHeaders = taskKey[Unit]("Check the license headers for all source files.")
Expand All @@ -20,7 +18,12 @@ object BuildSettings {
lazy val buildSettings = baseSettings ++ Seq(
organization := "com.netflix.iep-apps",
scalaVersion := Dependencies.Versions.scala,
scalacOptions ++= compilerFlags,
scalacOptions := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => compilerFlags ++ Seq("-Xlint:_,-infer-any", "-Xsource:3")
case _ => compilerFlags ++ Seq("-source", "3.3")
}
},
javacOptions ++= Seq("--release", "21"),
crossPaths := true,
crossScalaVersions := Dependencies.Versions.crossScala,
Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Dependencies {
val spring = "6.0.7"
val avroV = "1.11.3"

val crossScala = Seq(scala)
val crossScala = Seq(scala, "3.4.1")
}

import Versions._
Expand Down Expand Up @@ -59,7 +59,7 @@ object Dependencies {
val log4jJul = "org.apache.logging.log4j" % "log4j-jul" % log4j
val log4jSlf4j = "org.apache.logging.log4j" % "log4j-slf4j-impl" % log4j
val mockitoCore = "org.mockito" % "mockito-core" % "5.10.0"
val mockitoScala = "org.mockito" % "mockito-scala_2.13" % "1.17.30"
val mockitoScala = "org.mockito" %% "mockito-scala" % "1.17.30" // https://github.com/mockito/mockito-scala/issues/364
val munit = "org.scalameta" %% "munit" % "0.7.29"
val openHFT = "net.openhft" % "zero-allocation-hashing" % "0.16"
val pekkoActor = "org.apache.pekko" %% "pekko-actor" % pekko
Expand Down
Loading