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

[Tech][RORDEV-1152] Migrate core and es813x to Scala 3 #1010

Merged
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
18 changes: 13 additions & 5 deletions audit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ crossBuild {
scalaVersionsCatalog = [
'2.11': '2.11.12',
'2.12': '2.12.19',
'2.13': '2.13.13'
'2.13': '2.13.13',
'3.3.0': '3.3.3'
]

builds {
v211
v212
v213
v3
}
}

Expand All @@ -64,7 +66,8 @@ dependencies {
crossBuildV211Implementation group: 'org.scala-lang', name: 'scala-library', version: '2.11.12'
crossBuildV212Implementation group: 'org.scala-lang', name: 'scala-library', version: '2.12.19'
crossBuildV213Implementation group: 'org.scala-lang', name: 'scala-library', version: '2.13.13'
compileOnly group: 'org.scala-lang', name: 'scala-library', version: '2.13.13'
crossBuildV3Implementation group: 'org.scala-lang', name: 'scala3-library_3', version: '3.3.3'
compileOnly group: 'org.scala-lang', name: 'scala3-library_3', version: '3.3.3'
}

test {
Expand All @@ -77,11 +80,16 @@ test {

compileScala {
options.compilerArgs.addAll(
"-unchecked",
"-Ywarn-macros:after",
"-feature",
"-Ymacro-annotations",
"-Xfatal-warnings",
"-Wunused:implicits",
"-Wunused:imports",
"-Wunused:explicits",
"-Wunused:strict-no-implicit-warn",
"-Wunused:locals",
"-Wunused:params",
"-Wunused:privates",
"-Wunused:nowarn",
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repositories {
}

dependencies {
implementation group: 'org.scala-lang', name: 'scala-library', version: '2.13.13'
implementation group: 'org.scala-lang', name: 'scala3-library_3', version: '3.3.3'
}

tasks.withType(ScalaCompile).configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ docker {

tasks.withType(ScalaCompile).configureEach {
scalaCompileOptions.additionalParameters = [
"-unchecked",
"-Ywarn-macros:after",
"-feature",
"-Ymacro-annotations",
"-Xfatal-warnings",
"-Ywarn-unused",
"-Wunused:nowarn"
"-Wunused:implicits",
"-Wunused:imports",
"-Wunused:explicits",
"-Wunused:strict-no-implicit-warn",
"-Wunused:locals",
"-Wunused:params",
"-Wunused:privates",
"-Wunused:nowarn",
]
}

Expand Down
92 changes: 46 additions & 46 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,63 +71,61 @@ dependencies {
api project(path: ':audit', configuration: 'default')
api project(path: ':ror-shadowed-libs', configuration: 'shadow')

api(group: 'com.softwaremill.sttp', name: 'async-http-client-backend-cats_2.13', version: '1.7.2') {
api(group: 'com.softwaremill.sttp.client3', name: 'async-http-client-backend-cats-ce2_3', version: '3.5.2') {
exclude group: 'io.netty', module: 'netty-tcnative-classes'
}
api group: 'com.github.pathikrit', name: 'better-files_2.13', version: '3.9.2'
api group: 'io.circe', name: 'circe-core_2.13', version: '0.14.4'
api group: 'io.circe', name: 'circe-generic_2.13', version: '0.14.4'
api group: 'io.circe', name: 'circe-generic-extras_2.13', version: '0.14.3'
api group: 'io.circe', name: 'circe-parser_2.13', version: '0.14.4'
api group: 'io.circe', name: 'circe-refined_2.13', version: '0.14.4'
api group: 'io.circe', name: 'circe-shapes_2.13', version: '0.14.4'
api group: 'commons-codec', name: 'commons-codec', version: '1.15'
api group: 'org.typelevel', name: 'cats-free_2.13', version: '2.1.1'
api group: 'com.softwaremill.sttp', name: 'core_2.13', version: '1.7.2'
api group: 'com.beachape', name: 'enumeratum_2.13', version: '1.7.3'
api group: 'com.hrakaroo', name: 'glob', version: '0.9.0'
api group: 'com.comcast', name: 'ip4s-core_2.13', version: '1.4.1'
api group: 'org.typelevel', name: 'jawn-parser_2.13', version: '1.4.0'
api group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
api group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
api(group: 'io.jsonwebtoken', name: 'jjwt-orgjson', version: '0.11.5') {
api group: 'com.github.pathikrit', name: 'better-files_3', version: '3.9.2'
api group: 'io.circe', name: 'circe-core_3', version: '0.14.6'
api group: 'io.circe', name: 'circe-generic_3', version: '0.14.6'
api group: 'io.circe', name: 'circe-parser_3', version: '0.14.6'
api group: 'io.circe', name: 'circe-refined_3', version: '0.14.6'
api group: 'commons-codec', name: 'commons-codec', version: '1.15'
api group: 'org.typelevel', name: 'cats-free_3', version: '2.10.0'
api group: 'com.softwaremill.sttp.client3', name: 'core_3', version: '3.5.2'
api group: 'com.beachape', name: 'enumeratum_3', version: '1.7.3'
api group: 'com.hrakaroo', name: 'glob', version: '0.9.0'
api group: 'com.comcast', name: 'ip4s-core_3', version: '2.0.4'
api group: 'org.typelevel', name: 'jawn-parser_3', version: '1.5.1'
api group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
api group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
api(group: 'io.jsonwebtoken', name: 'jjwt-orgjson', version: '0.11.5') {
// jjwt-orgjson:0.11.5 uses json version, which has known security vulnerabilities
exclude group: 'org.json', module: 'json'
}
api group: 'org.jooq', name: 'joor-java-8', version: '0.9.13'
api group: 'org.apache.logging.log4j', name: 'log4j-api-scala_2.13', version: '12.0'
api group: 'org.apache.logging.log4j', name: 'log4j-api-scala_3', version: '13.1.0'
api(group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.11.2') {
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
}
api group: 'io.monix', name: 'monix_2.13', version: '3.4.1'
api group: 'eu.timepit', name: 'refined_2.13', version: '0.9.5'
api group: 'org.reflections', name: 'reflections', version: '0.9.11'
api group: 'org.mozilla', name: 'rhino', version: '1.7.14'
api group: 'com.github.blemale', name: 'scaffeine_2.13', version: '3.1.0'
api group: 'com.github.tototoshi', name: 'scala-csv_2.13', version: '1.3.6'
api group: 'org.scala-lang.modules', name: 'scala-parallel-collections_2.13', version: '1.0.4'
api group: 'io.lemonlabs', name: 'scala-uri_2.13', version: '3.5.0'
api group: 'org.typelevel', name: 'squants_2.13', version: '1.8.3'
api group: 'com.unboundid', name: 'unboundid-ldapsdk', version: '6.0.11'
api group: 'com.lihaoyi', name: 'upickle_2.13', version: '3.1.0'
api group: 'io.monix', name: 'monix_3', version: '3.4.1'
api group: 'eu.timepit', name: 'refined_3', version: '0.11.1'
api group: 'org.reflections', name: 'reflections', version: '0.9.11'
api group: 'org.mozilla', name: 'rhino', version: '1.7.14'
api group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '2.9.3'
api group: 'com.github.tototoshi', name: 'scala-csv_3', version: '1.3.10'
api group: 'org.scala-lang.modules', name: 'scala-parallel-collections_3', version: '1.0.4'
api group: 'io.lemonlabs', name: 'scala-uri_3', version: '4.0.3'
api group: 'org.typelevel', name: 'squants_3', version: '1.8.3'
api group: 'com.unboundid', name: 'unboundid-ldapsdk', version: '6.0.11'
api group: 'com.lihaoyi', name: 'upickle_3', version: '3.3.0'
// https://www.bouncycastle.org/latest_releases.html#1.0.2.4-NONCERT
api group: 'org.bouncycastle', name: 'bc-noncert', version: '1.0.2.4'
api(group: 'org.bouncycastle', name: 'bctls-fips', version: '1.0.17') {
api group: 'org.bouncycastle', name: 'bc-noncert', version: '1.0.2.4'
api(group: 'org.bouncycastle', name: 'bctls-fips', version: '1.0.17') {
exclude group: 'org.bouncycastle', module: 'bc-fips'
}
api(group: 'org.bouncycastle', name: 'bcpkix-fips', version: '1.0.7') {
exclude group: 'org.bouncycastle', module: 'bc-fips'
}

testImplementation project(':tests-utils')
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.15.0'
testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.23.1'
testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.6'
testRuntimeOnly group: 'org.pegdown', name: 'pegdown', version: '1.4.2'
testImplementation group: 'com.typesafe.scala-logging', name: 'scala-logging_2.13', version: '3.9.2'
testImplementation group: 'org.scalamock', name: 'scalamock_2.13', version: '5.1.0'
testImplementation group: 'org.scalatestplus', name: 'scalacheck-1-14_2.13', version: '3.1.0.0'
testImplementation group: 'org.scalatest', name: 'scalatest_2.13', version: '3.2.16'
testImplementation group: 'com.dimafeng', name: 'testcontainers-scala_2.13', version: '0.40.16'
testImplementation group: 'com.typesafe.scala-logging', name: 'scala-logging_3', version: '3.9.5'
testImplementation group: 'org.scalamock', name: 'scalamock_3', version: '6.0.0'
testImplementation group: 'org.scalatestplus', name: 'scalacheck-1-16_3', version: '3.2.14.0'
testImplementation group: 'org.scalatest', name: 'scalatest_3', version: '3.2.16'
testImplementation group: 'com.dimafeng', name: 'testcontainers-scala_3', version: '0.41.3'

constraints {
api group: 'io.netty', name: 'netty-codec-http2', version: '4.1.108.Final'
Expand All @@ -136,8 +134,7 @@ dependencies {
api group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.108.Final'
api group: 'io.netty', name: 'netty-transport-native-kqueue', version: '4.1.108.Final'
api group: 'com.google.guava', name: 'guava', version: '32.0.1-jre'
api group: 'io.spray', name: 'spray-json_2.13', version: '1.3.5'
api group: 'org.scala-lang', name: 'scala-reflect', version: '2.13.13'
api group: 'io.spray', name: 'spray-json_3', version: '1.3.6'
api group: 'org.asynchttpclient', name: 'async-http-client', version: '2.10.5'
}
}
Expand Down Expand Up @@ -168,13 +165,16 @@ tasks.withType(ScalaCompile).configureEach {

// Add whatever flags you typically add
parameters += [
"-unchecked",
"-Ywarn-macros:after",
"-feature",
"-Ymacro-annotations",
"-Xfatal-warnings",
"-Ywarn-unused",
"-Wunused:-nowarn"
"-Wunused:implicits",
"-Wunused:imports",
"-Wunused:explicits",
"-Wunused:strict-no-implicit-warn",
"-Wunused:locals",
"-Wunused:params",
"-Wunused:privates",
"-Wunused:nowarn",
]

parameters -= ["-target:8"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private[audit] class AuditRequestContextBasedOnAclResult[B <: BlockContext](requ
}
override val `type`: String = requestContext.`type`.value
override val taskId: Long = requestContext.taskId
override val httpMethod: String = requestContext.method.m
override val httpMethod: String = requestContext.method.method
override val loggedInUserName: Option[String] = loggedUser.map(_.id.value.value)
override val impersonatedByUserName: Option[String] =
loggedUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ object Block {
extends HistoryItem[B]
}

final case class RuleDefinition[+T <: Rule](rule: T,
variableUsage: VariableUsage[T],
localUsersSupport: LocalUsersSupport[T],
impersonationWarnings: ImpersonationWarningSupport[T])
final case class RuleDefinition[T <: Rule](rule: T,
variableUsage: VariableUsage[T],
localUsersSupport: LocalUsersSupport[T],
impersonationWarnings: ImpersonationWarningSupport[T])
object RuleDefinition {
def create[T <: Rule : VariableUsage : LocalUsersSupport : ImpersonationWarningSupport](rule: T): RuleDefinition[T] = {
new RuleDefinition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import tech.beshu.ror.accesscontrol.blocks.BlockContext._
import tech.beshu.ror.accesscontrol.blocks.metadata.UserMetadata
import tech.beshu.ror.accesscontrol.domain._

import scala.annotation.nowarn

sealed trait BlockContextUpdater[B <: BlockContext] {

def emptyBlockContext(blockContext: B): B
Expand Down Expand Up @@ -311,7 +309,6 @@ object BlockContextUpdater {
}
}

@nowarn("msg=evidence parameter")
abstract class BlockContextWithIndicesUpdater[B <: BlockContext : HasIndices] {

def withIndices(blockContext: B, filteredIndices: Set[ClusterIndexName], allAllowedIndices: Set[ClusterIndexName]): B
Expand Down Expand Up @@ -360,7 +357,6 @@ object BlockContextWithIndicesUpdater {
}
}

@nowarn("msg=evidence parameter")
abstract class BlockContextWithIndexPacksUpdater[B <: BlockContext : HasIndexPacks] {

def withIndexPacks(blockContext: B, indexPacks: List[Indices]): B
Expand All @@ -386,7 +382,6 @@ object BlockContextWithIndexPacksUpdater {
}
}

@nowarn("msg=evidence parameter")
abstract class BlockContextWithFilterUpdater[B <: BlockContext : HasFilter] {

def withFilter(blockContext: B, filter: Filter): B
Expand All @@ -412,7 +407,6 @@ object BlockContextWithFilterUpdater {
}
}

@nowarn("msg=evidence parameter")
abstract class BlockContextWithFLSUpdater[B <: BlockContext : HasFieldLevelSecurity] {

def withFieldLevelSecurity(blockContext: B, fieldLevelSecurity: FieldLevelSecurity): B
Expand Down
Loading