Skip to content

Commit

Permalink
Update Scala to 2.13.8 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcarter97 authored May 23, 2022
1 parent 83b900d commit 517fddb
Show file tree
Hide file tree
Showing 57 changed files with 604 additions and 493 deletions.
44 changes: 41 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,45 @@
# SBT
# bloop and metals
.bloop
.bsp

# metals
project/metals.sbt
.metals

# vs code
.vscode

# scala 3
.tasty

# sbt
project/project/
project/target/
target/

# IDE
# eclipse
build/
.classpath
.project
.settings
.worksheet
bin/
.cache

# intellij idea
*.log
*.iml
*.ipr
*.iws
.idea

.pairs
# mac
.DS_Store

# other?
.history
.scala_dependencies
.cache-main

#general
*.class
21 changes: 21 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
rules = [
RemoveUnused,
NoAutoTupling,
DisableSyntax,
LeakingImplicitClassVal,
NoValInForComprehension,
ProcedureSyntax
]

OrganizeImports {
coalesceToWildcardImportThreshold = 8
expandRelative = true
groupedImports = Merge
importSelectorsOrder = SymbolsFirst
removeUnused = false
groups = [
"java."
"*"
"scala."
]
}
18 changes: 7 additions & 11 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
style = defaultWithAlign

align = most

maxColumn = 120
version = 3.4.3

align.preset = most
includeCurlyBraceInSelectChains = false

maxColumn = 120
newlines.sometimesBeforeColonInMethodReturnType = false

rewrite.rules = [SortImports, RedundantBraces, RedundantParens, PreferCurlyFors]

project.git = true

spaces.beforeContextBoundColon = true
rewrite.rules = [SortImports, RedundantBraces, RedundantParens, PreferCurlyFors]
runner.dialect = scala213
spaces.beforeContextBoundColon = Always
style = defaultWithAlign
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: scala

scala:
- 2.12.10
- 2.13.8
jdk:
- openjdk12
- openjdk17

# Avoid triggering a duplicate build for PRs
branches:
Expand All @@ -13,11 +13,14 @@ branches:
# https://www.scala-sbt.org/1.x/docs/Travis-CI-with-sbt.html
cache:
directories:
- $HOME/.cache/coursier
- $HOME/.ivy2/cache
- $HOME/.sbt/boot/
- $HOME/.sbt

before_cache:
- find $HOME/.ivy2 -name "ivydata-*.properties" -delete
- find $HOME/.sbt -name "*.lock" -delete
- rm -fv $HOME/.ivy2/.sbt.ivy.lock
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete

script:
- sbt ++$TRAVIS_SCALA_VERSION ciBuild
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017-2019, Sky CP Ltd
Copyright (c) 2017-2022, Sky CP Ltd
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
106 changes: 32 additions & 74 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,110 +2,68 @@ import com.typesafe.sbt.packager.docker.Cmd
import Aliases._
import Release._

scalafmtVersion in ThisBuild := "1.2.0"
scalafmtOnCompile in ThisBuild := true
ThisBuild / scalafmtOnCompile := true
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0"

val kafkaVersion = "2.6.0"
val akkaVersion = "2.5.23"
val catsVersion = "1.6.1"
val refinedVersion = "0.9.8"
val pureConfigVersion = "0.11.1"
val kamonVersion = "2.4.2"
Global / onChangedBuildSource := ReloadOnSourceChanges

val dependencies = Seq(
"uk.sky" %% "kafka-topic-loader" % "1.5.3",
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-stream-kafka" % "1.0.4",
"com.typesafe.akka" %% "akka-stream-contrib" % "0.10",
"io.monix" %% "monix-execution" % "3.0.0-RC3",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
"org.typelevel" %% "cats-core" % catsVersion,
"org.typelevel" %% "cats-testkit" % catsVersion,
"ch.qos.logback" % "logback-classic" % "1.2.3" % Runtime,
"net.logstash.logback" % "logstash-logback-encoder" % "6.1" % Runtime,
"org.codehaus.janino" % "janino" % "3.0.13" % Runtime,
"com.github.pureconfig" %% "pureconfig" % pureConfigVersion,
"com.github.pureconfig" %% "pureconfig-cats" % pureConfigVersion,
"io.kamon" %% "kamon-core" % kamonVersion,
"io.kamon" %% "kamon-akka" % kamonVersion,
"io.kamon" %% "kamon-prometheus" % kamonVersion,
"eu.timepit" %% "refined" % refinedVersion,
"eu.timepit" %% "refined-pureconfig" % refinedVersion,
"eu.timepit" %% "refined-scalacheck" % refinedVersion,
"org.apache.kafka" %% "kafka" % kafkaVersion % Test,
"org.scalatest" %% "scalatest" % "3.0.8" % Test,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test,
"com.danielasfregola" %% "random-data-generator" % "2.7" % Test,
"com.47deg" %% "scalacheck-toolbox-datetime" % "0.2.5" % Test,
"org.mockito" % "mockito-all" % "1.10.19" % Test,
"org.zalando" %% "grafter" % "2.6.1" % Test,
"io.github.embeddedkafka" %% "embedded-kafka" % "2.6.0" % Test
)
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oF")

val commonSettings = Seq(
organization := "com.sky",
scalaVersion := "2.12.10",
libraryDependencies += "com.sksamuel.avro4s" %% "avro4s-core" % "2.0.2"
scalaVersion := "2.13.8"
)

val compilerSettings = Seq(
// Compiler option not provided by sbt-tpolecat
scalacOptions += "-Ymacro-annotations",
tpolecatScalacOptions ~= { opts =>
opts.filterNot(Set(ScalacOptions.warnValueDiscard))
}
)

lazy val dockerSettings = Seq(
packageName in Docker := "kafka-message-scheduler",
dockerBaseImage := "alpine:3.13.2",
dockerRepository := Some("skyuk"),
dockerLabels := Map("maintainer" -> "Sky"),
dockerUpdateLatest := true,
Docker / packageName := "kafka-message-scheduler",
dockerBaseImage := "eclipse-temurin:17-jdk-alpine",
dockerRepository := Some("skyuk"),
dockerLabels := Map("maintainer" -> "Sky"),
dockerUpdateLatest := true,
dockerCommands ++= Seq(
Cmd("USER", "root"),
Cmd("RUN", "apk add --no-cache bash eudev openjdk11-jre")
Cmd("RUN", "apk add --no-cache bash")
)
)

val buildInfoSettings = Seq(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "com.sky"
)

lazy val scheduler = (project in file("scheduler"))
.enablePlugins(BuildInfoPlugin, JavaAppPackaging, UniversalDeployPlugin, JavaAgent, DockerPlugin)
.settings(commonSettings)
.settings(compilerSettings)
.settings(
libraryDependencies ++= dependencies,
dependencyOverrides ++= Seq("org.apache.kafka" % "kafka-clients" % kafkaVersion,
"org.scalacheck" %% "scalacheck" % "1.13.5"),
resolvers ++= Seq(
"jitpack" at "https://jitpack.io",
Resolver.bintrayRepo("cakesolutions", "maven")
),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full),
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.10"),
scalacOptions ++= Seq(
"-language:implicitConversions",
"-language:postfixOps",
"-Xfatal-warnings",
"-Ywarn-dead-code",
"-Ywarn-unused",
"-deprecation",
"-Ypartial-unification",
"-encoding",
"utf-8"
),
fork in run := true,
fork in Test := true,
javaAgents += "io.kamon" % "kanela-agent" % "1.0.7",
libraryDependencies ++= Dependencies.all,
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full),
run / fork := true,
Test / fork := true,
javaAgents += "io.kamon" % "kanela-agent" % "1.0.14",
buildInfoSettings,
dockerSettings,
releaseSettings,
parallelExecution in Test := false
Test / parallelExecution := false
)

val schema = inputKey[Unit]("Generate the Avro schema file for the Schedule schema.")

lazy val avro = (project in file("avro"))
.settings(commonSettings)
.settings(schema := (run in Compile).toTask("").value)
.settings(compilerSettings)
.settings(libraryDependencies += Dependencies.avro4s)
.settings(schema := (Compile / run).toTask("").value)
.dependsOn(scheduler % "compile->compile")
.disablePlugins(ReleasePlugin)

Expand Down
41 changes: 0 additions & 41 deletions docker-compose.yml

This file was deleted.

78 changes: 40 additions & 38 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
version: '3.3'
services:

zookeeper:
image: confluentinc/cp-zookeeper:3.3.0
environment:
ZOOKEEPER_CLIENT_PORT: '2181'

kafka:
image: confluentinc/cp-kafka:3.3.0
ports:
- "9093:9093"
depends_on:
- zookeeper
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: '1'
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,OUTSIDE://localhost:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,OUTSIDE:PLAINTEXT

kms:
image: skyuk/kafka-message-scheduler:latest<localBuild>
depends_on:
- kafka
environment:
KAFKA_BROKERS: kafka:9092
SCHEDULE_TOPICS: schedules
ports:
- "9095:9095"

prometheus:
image: prom/prometheus:v2.25.2
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
version: '3.8'

services:

kms:
image: skyuk/kafka-message-scheduler:latest<localBuild>
depends_on:
- kafka
- zookeeper
environment:
KAFKA_BROKERS: kafka:9092
SCHEDULE_TOPICS: schedules
ports:
- "9095:9095"

zookeeper:
image: confluentinc/cp-zookeeper:7.0.1
environment:
ZOOKEEPER_CLIENT_PORT: '2181'

kafka:
image: confluentinc/cp-kafka:7.0.1
ports:
- "9093:9093"
depends_on:
- zookeeper
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: '1'
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,OUTSIDE://localhost:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,OUTSIDE:PLAINTEXT

prometheus:
image: prom/prometheus:v2.33.4
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
Loading

0 comments on commit 517fddb

Please sign in to comment.