Skip to content

Commit

Permalink
finatra: all on 2.13
Browse files Browse the repository at this point in the history
Problem/Solution

Enable cross-building scala 2.13 for all finatra projects including examples.

JIRA Issues: CSL-10597

Differential Revision: https://phabricator.twitter.biz/D613483
  • Loading branch information
yufangong authored and jenkins committed Feb 5, 2021
1 parent 8295734 commit 7deb115
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 47 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Unreleased
Changed
~~~~~~~

* finatra: all subprojects cross-building with 2.13.1. ``PHAB_ID=D613483``

* kafkaStreams: Enables cross-build for 2.13.1 for projects kafkaStreamsStaticPartitioning,
kafkaStreamsPrerestore, and kafkaStreamsQueryableThrift. ``PHAB_ID=D608958``

Expand Down
88 changes: 42 additions & 46 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ val releaseVersion = "21.2.0-SNAPSHOT"
lazy val buildSettings = Seq(
version := releaseVersion,
scalaVersion := "2.12.11",
crossScalaVersions := Seq("2.11.12", "2.12.11"),
crossScalaVersions := Seq("2.11.12", "2.12.11", "2.13.1"),
scalaModuleInfo := scalaModuleInfo.value.map(_.withOverrideScalaVersion(true)),
fork in Test := true, // We have to fork to get the JavaOptions
javaOptions in Test ++= travisTestJavaOptions
javaOptions in Test ++= travisTestJavaOptions,
scalacOptions := {
val previous = scalacOptions.value
if (scalaVersion.value.startsWith("2.11")) {
previous.filterNot(_ == "-Ywarn-unused:imports") ++ Seq("-Ywarn-unused-import")
} else previous
},
libraryDependencies += scalaCollectionCompat
)

lazy val noPublishSettings = Seq(
Expand Down Expand Up @@ -118,17 +125,6 @@ lazy val versions = new {

lazy val scalaCollectionCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.1.2"

lazy val withTwoThirteen = Seq(
crossScalaVersions += "2.13.1",
libraryDependencies += scalaCollectionCompat,
scalacOptions := {
val previous = scalacOptions.value
if (scalaVersion.value.startsWith("2.13")) {
previous.filterNot(_ == "-Ywarn-unused-import") ++ Seq("-Ywarn-unused:imports")
} else previous
}
)

lazy val scalaCompilerOptions = scalacOptions ++= Seq(
"-deprecation",
"-encoding",
Expand All @@ -141,7 +137,7 @@ lazy val scalaCompilerOptions = scalacOptions ++= Seq(
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Xlint",
"-Ywarn-unused-import"
"-Ywarn-unused:imports"
)

lazy val testDependenciesSettings = Seq(
Expand Down Expand Up @@ -382,7 +378,7 @@ lazy val injectCoreTestJarSources =
"com/twitter/inject/WhenReadyMixin"
)
lazy val injectCore = (project in file("inject/inject-core"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-core",
moduleName := "inject-core",
Expand Down Expand Up @@ -420,7 +416,7 @@ lazy val injectCore = (project in file("inject/inject-core"))
)

lazy val injectStack = (project in file("inject/inject-stack"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-stack",
moduleName := "inject-stack",
Expand All @@ -430,7 +426,7 @@ lazy val injectStack = (project in file("inject/inject-stack"))
)

lazy val injectLogback = (project in file("inject/inject-logback"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-logback",
moduleName := "inject-logback",
Expand All @@ -455,7 +451,7 @@ lazy val injectLogback = (project in file("inject/inject-logback"))
lazy val injectModulesTestJarSources =
Seq("com/twitter/inject/modules/InMemoryStatsReceiverModule")
lazy val injectModules = (project in file("inject/inject-modules"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-modules",
moduleName := "inject-modules",
Expand Down Expand Up @@ -494,7 +490,7 @@ lazy val injectAppTestJarSources =
"com/twitter/inject/app/TestInjector"
)
lazy val injectApp = (project in file("inject/inject-app"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-app",
moduleName := "inject-app",
Expand Down Expand Up @@ -534,7 +530,7 @@ lazy val injectApp = (project in file("inject/inject-app"))
)

lazy val injectDtab = (project in file("inject/inject-dtab"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-dtab",
moduleName := "inject-dtab",
Expand All @@ -546,7 +542,7 @@ lazy val injectDtab = (project in file("inject/inject-dtab"))
)

lazy val injectPorts = (project in file("inject/inject-ports"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-ports",
moduleName := "inject-ports",
Expand All @@ -571,7 +567,7 @@ lazy val injectServerTestJarSources =
"com/twitter/inject/server/package"
)
lazy val injectServer = (project in file("inject/inject-server"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-server",
moduleName := "inject-server",
Expand Down Expand Up @@ -603,7 +599,7 @@ lazy val injectServer = (project in file("inject/inject-server"))
)

lazy val injectMdc = (project in file("inject/inject-mdc"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-mdc",
moduleName := "inject-mdc",
Expand All @@ -620,7 +616,7 @@ lazy val injectMdc = (project in file("inject/inject-mdc"))
)

lazy val injectSlf4j = (project in file("inject/inject-slf4j"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-slf4j",
moduleName := "inject-slf4j",
Expand All @@ -633,7 +629,7 @@ lazy val injectSlf4j = (project in file("inject/inject-slf4j"))
)

lazy val injectRequestScope = (project in file("inject/inject-request-scope"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-request-scope",
moduleName := "inject-request-scope",
Expand All @@ -647,7 +643,7 @@ lazy val injectRequestScope = (project in file("inject/inject-request-scope"))
)

lazy val injectThrift = (project in file("inject/inject-thrift"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-thrift",
moduleName := "inject-thrift",
Expand All @@ -667,7 +663,7 @@ lazy val injectThrift = (project in file("inject/inject-thrift"))
)

lazy val injectThriftClient = (project in file("inject/inject-thrift-client"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-thrift-client",
moduleName := "inject-thrift-client",
Expand All @@ -693,7 +689,7 @@ lazy val injectThriftClient = (project in file("inject/inject-thrift-client"))
)

lazy val injectUtils = (project in file("inject/inject-utils"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-utils",
moduleName := "inject-utils",
Expand Down Expand Up @@ -730,7 +726,7 @@ lazy val injectUtils = (project in file("inject/inject-utils"))
* optimizations.
*/
lazy val benchmarks = project
.settings(baseServerSettings, withTwoThirteen)
.settings(baseServerSettings)
.enablePlugins(JmhPlugin)
.settings(
libraryDependencies ++= Seq("org.slf4j" % "slf4j-simple" % versions.slf4j % Test)
Expand All @@ -747,7 +743,7 @@ lazy val benchmarks = project
lazy val utilsTestJarSources =
Seq("com/twitter/finatra/modules/", "com/twitter/finatra/test/")
lazy val utils = project
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-utils",
moduleName := "finatra-utils",
Expand Down Expand Up @@ -786,7 +782,7 @@ lazy val validationTestJarSources =
"com/twitter/finatra/validation/ValidatorTest"
)
lazy val validation = project
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-validation",
moduleName := "finatra-validation",
Expand Down Expand Up @@ -828,7 +824,7 @@ lazy val jacksonTestJarSources =
"com/twitter/finatra/json/JsonDiff"
)
lazy val jackson = project
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-jackson",
moduleName := "finatra-jackson",
Expand Down Expand Up @@ -872,7 +868,7 @@ lazy val jackson = project
)

lazy val jsonAnnotations = (project in file("json-annotations"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-json-annotations",
moduleName := "finatra-json-annotations",
Expand All @@ -882,7 +878,7 @@ lazy val jsonAnnotations = (project in file("json-annotations"))
)

lazy val mustache = project
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-mustache",
moduleName := "finatra-mustache",
Expand Down Expand Up @@ -913,7 +909,7 @@ lazy val httpTestJarSources =
"com/twitter/finatra/http/response/DefaultResponseBuilder"
)
lazy val http = project
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-http",
moduleName := "finatra-http",
Expand Down Expand Up @@ -958,7 +954,7 @@ lazy val http = project
)

lazy val httpAnnotations = (project in file("http-annotations"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-http-annotations",
moduleName := "finatra-http-annotations"
Expand All @@ -967,7 +963,7 @@ lazy val httpAnnotations = (project in file("http-annotations"))
)

lazy val httpMustache = (project in file("http-mustache"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-http-mustache",
moduleName := "finatra-http-mustache",
Expand All @@ -991,7 +987,7 @@ lazy val httpMustache = (project in file("http-mustache"))
lazy val httpclientTestJarSources =
Seq("com/twitter/finatra/httpclient/test/")
lazy val httpclient = project
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-httpclient",
moduleName := "finatra-httpclient",
Expand Down Expand Up @@ -1029,7 +1025,7 @@ lazy val thriftTestJarSources =
"com/twitter/finatra/thrift/ThriftClient",
"com/twitter/finatra/thrift/ThriftTest")
lazy val thrift = project
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-thrift",
moduleName := "finatra-thrift",
Expand Down Expand Up @@ -1071,7 +1067,7 @@ lazy val thrift = project
)

lazy val injectThriftClientHttpMapper = (project in file("inject-thrift-client-http-mapper"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "inject-thrift-client-http-mapper",
moduleName := "inject-thrift-client-http-mapper",
Expand Down Expand Up @@ -1138,7 +1134,7 @@ def crossVersionKafka(
}

lazy val kafka = (project in file("kafka"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-kafka",
moduleName := "finatra-kafka",
Expand Down Expand Up @@ -1184,7 +1180,7 @@ lazy val kafka = (project in file("kafka"))

lazy val kafkaStreamsQueryableThriftClient =
(project in file("kafka-streams/kafka-streams-queryable-thrift-client"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-kafka-streams-queryable-thrift-client",
moduleName := "finatra-kafka-streams-queryable-thrift-client",
Expand All @@ -1206,7 +1202,7 @@ lazy val kafkaStreamsQueryableThriftClient =

lazy val kafkaStreamsStaticPartitioning =
(project in file("kafka-streams/kafka-streams-static-partitioning"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-kafka-streams-static-partitioning",
moduleName := "finatra-kafka-streams-static-partitioning",
Expand Down Expand Up @@ -1240,7 +1236,7 @@ lazy val kafkaStreamsStaticPartitioning =
)

lazy val kafkaStreamsPrerestore = (project in file("kafka-streams/kafka-streams-prerestore"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-kafka-streams-prerestore",
moduleName := "finatra-kafka-streams-prerestore",
Expand All @@ -1258,7 +1254,7 @@ lazy val kafkaStreamsPrerestore = (project in file("kafka-streams/kafka-streams-

lazy val kafkaStreamsQueryableThrift =
(project in file("kafka-streams/kafka-streams-queryable-thrift"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-kafka-streams-queryable-thrift",
moduleName := "finatra-kafka-streams-queryable-thrift",
Expand All @@ -1278,7 +1274,7 @@ lazy val kafkaStreamsQueryableThrift =
)

lazy val kafkaStreams = (project in file("kafka-streams/kafka-streams"))
.settings(projectSettings, withTwoThirteen)
.settings(projectSettings)
.settings(
name := "finatra-kafka-streams",
moduleName := "finatra-kafka-streams",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ class SampleApp extends App {
queue += 6
}

def getQueue: Seq[Int] = this.queue
def getQueue: Seq[Int] = this.queue.toSeq
}

0 comments on commit 7deb115

Please sign in to comment.