Skip to content

Commit 972920f

Browse files
Matteo Seclìagilelab-tmnd1991
authored andcommitted
[!466] - Feature/583 java 17 upgrade
# New features and improvements Test Wasp vs Java 17: - `--add-opens=java.base/java.lang=ALL-UNNAMED` - `--add-exports=java.base/sun.nio.ch=ALL-UNNAMED` - `--add-opens=java.base/sun.util.calendar=ALL-UNNAMED` - `--add-opens=java.base/java.lang.reflect=ALL-UNNAMED` - `--add-opens=java.base/java.util=ALL-UNNAMED` - `--add-opens=java.base/java.net=ALL-UNNAMED` - `--add-opens=java.xml/com.sun.org.apache.xerces.internal.jaxp=ALL-UNNAMED` # Breaking changes You need a JRE 17 to build wasp locally or need to tweak the `.jvmopts` file in the root? # Migration None. # Bug fixes None. # How this feature was tested Existing pipelines. # Related issue Closes #583
1 parent cdee941 commit 972920f

File tree

8 files changed

+54
-32
lines changed

8 files changed

+54
-32
lines changed

.gitlab-ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cache:
2727
test-kernel:
2828
stage: test
2929
interruptible: true
30-
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-8u432-b06-jdk-jammy"
30+
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-17.0.13_11-jdk-jammy"
3131
parallel:
3232
matrix:
3333
- WASP_FLAVOR: [ "VANILLA2_2_12"]
@@ -54,7 +54,7 @@ test-kernel:
5454
test-plugin:
5555
stage: test
5656
interruptible: true
57-
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-8u432-b06-jdk-jammy"
57+
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-17.0.13_11-jdk-jammy"
5858
parallel:
5959
matrix:
6060
- WASP_FLAVOR: [ "VANILLA2_2_12"]
@@ -81,7 +81,7 @@ test-plugin:
8181
test-repo:
8282
stage: test
8383
interruptible: true
84-
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-8u432-b06-jdk-jammy"
84+
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-17.0.13_11-jdk-jammy"
8585
parallel:
8686
matrix:
8787
- WASP_FLAVOR: [ "VANILLA2_2_12"]
@@ -108,7 +108,7 @@ test-repo:
108108
compile-whitelabel:
109109
stage: deploy
110110
interruptible: true
111-
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-8u432-b06-jdk-jammy"
111+
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-17.0.13_11-jdk-jammy"
112112
parallel:
113113
matrix:
114114
- WASP_FLAVOR: [ "VANILLA2_2_12"]
@@ -133,7 +133,7 @@ censor:
133133
generate-open-api:
134134
stage: test
135135
interruptible: true
136-
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-8u432-b06-jdk-jammy"
136+
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-17.0.13_11-jdk-jammy"
137137
script:
138138
- ./run-sbt-unprivileged.sh "generateOpenApi"
139139
tags:
@@ -169,7 +169,7 @@ waspctl:
169169
snapshot:
170170
interruptible: false
171171
stage: deploy
172-
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-8u432-b06-jdk-jammy"
172+
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-17.0.13_11-jdk-jammy"
173173
parallel:
174174
matrix:
175175
- WASP_FLAVOR: [ "VANILLA2_2_12"]
@@ -193,7 +193,7 @@ snapshot:
193193
release:
194194
interruptible: false
195195
stage: deploy
196-
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-8u432-b06-jdk-jammy"
196+
image: "registry.gitlab.com/agilefactory/agile.wasp2/sbt:1.10.7-17.0.13_11-jdk-jammy"
197197
parallel:
198198
matrix:
199199
- WASP_FLAVOR: [ "VANILLA2_2_12"]

.jvmopts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@
66
-Xss2M
77
-Duser.timezone=GMT
88
-XX:ReservedCodeCacheSize=1G
9+
--add-opens=java.base/java.lang=ALL-UNNAMED
10+
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED
11+
--add-opens=java.base/sun.util.calendar=ALL-UNNAMED
12+
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
13+
--add-opens=java.base/java.util=ALL-UNNAMED
14+
--add-opens=java.base/java.net=ALL-UNNAMED
15+
--add-opens=java.xml/com.sun.org.apache.xerces.internal.jaxp=ALL-UNNAMED

consumers-spark/src/test/scala/it/agilelab/bigdata/wasp/consumers/spark/utils/SparkSuite.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import java.nio.file.Files
99
trait SparkSuite extends Suite {
1010

1111
lazy val spark: SparkSession = {
12-
System.setSecurityManager(null)
1312
SparkSuite.spark.newSession()
1413
}
1514

plugin-postgresql-spark/src/main/scala/it/agilelab/bigdata/wasp/consumers/spark/plugins/postgresql/JDBCPooledConnectionSupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ trait JDBCPooledConnectionSupport {
6060

6161
private def registerDriver(driverClassName: String): Unit = {
6262
val driverClass = this.getClass.getClassLoader.loadClass(driverClassName)
63-
val driverInstance = driverClass.newInstance().asInstanceOf[Driver]
63+
val driverInstance = driverClass.getConstructor().newInstance().asInstanceOf[Driver]
6464
DriverManager.registerDriver(driverInstance)
6565
}
6666

project/Flavor.scala

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@ sealed trait Flavor {
99
object Flavor {
1010

1111
case object Vanilla2_2_12 extends Flavor {
12-
private val versions = new Vanilla2Versions()
13-
val postfix: Option[String] = None
14-
override val scalaVersion: ScalaVersion = ScalaVersion.parseScalaVersion(versions.scala)
15-
override val settings: Settings = new BasicSettings(new BasicResolvers(), versions.jdk, scalaVersion)
16-
override val dependencies: Dependencies = new Vanilla2Dependencies(versions)
17-
override val id: String = "VANILLA2_2_12"
12+
private val versions = new Vanilla2Versions()
13+
val postfix: Option[String] = None
14+
override val scalaVersion: ScalaVersion = ScalaVersion.parseScalaVersion(versions.scala)
15+
override val dependencies: Vanilla2Dependencies = new Vanilla2Dependencies(versions)
16+
override val settings: Settings = new BasicSettings(
17+
resolver = new BasicResolvers(),
18+
jdkVersionValue = versions.jdk,
19+
scalaVersionValue = scalaVersion,
20+
// this is needed because otherwise parallel-write-plugin,
21+
// only during tests with coverage enabled will wrongly put
22+
// in the classpath version 3.3.5 (that we can't understand where it
23+
// comes from, since it's nowhere to be found in the dependencyTree).
24+
// the exception thrown is:
25+
// java.lang.NoSuchMethodError: 'org.apache.hadoop.fs.FSBuilder org.apache.hadoop.fs.FutureDataInputStreamBuilder.opt(java.lang.String, long)
26+
overrideDep = Seq(dependencies.hadoopClientApi)
27+
)
28+
override val id: String = "VANILLA2_2_12"
1829
}
1930

2031
case object CDP719 extends Flavor {
@@ -36,21 +47,27 @@ object Flavor {
3647
case object EMR613 extends Flavor {
3748
override val scalaVersion: ScalaVersion = ScalaVersion.parseScalaVersion(versions.scala)
3849
override lazy val settings: Settings =
39-
new BasicSettings(new BasicResolvers(), versions.jdk, scalaVersion, dependencies.overrides, dependencies.removeShims)
50+
new BasicSettings(
51+
new BasicResolvers(),
52+
versions.jdk,
53+
scalaVersion,
54+
dependencies.overrides,
55+
dependencies.removeShims
56+
)
4057
override lazy val dependencies: EMR613Dependencies = new EMR613Dependencies(versions)
41-
lazy val postfix: Option[String] = Some("emr613")
42-
private lazy val versions = new EMR613Versions()
43-
override val id: String = "EMR_6_13"
58+
lazy val postfix: Option[String] = Some("emr613")
59+
private lazy val versions = new EMR613Versions()
60+
override val id: String = "EMR_6_13"
4461
}
4562

4663
val DEFAULT: Flavor = Vanilla2_2_12
4764

4865
def parse(s: String): Either[String, Flavor] = {
4966
s.toUpperCase match {
5067
case "VANILLA2_2_12" => Right(Vanilla2_2_12)
51-
case "CDP719" => Right(CDP719)
52-
case "EMR_6_13" => Right(EMR613)
53-
case _ => Left(s"Cannot parse flavor [${s}]")
68+
case "CDP719" => Right(CDP719)
69+
case "EMR_6_13" => Right(EMR613)
70+
case _ => Left(s"Cannot parse flavor [${s}]")
5471
}
5572
}
5673

@@ -63,7 +80,7 @@ object Flavor {
6380
}
6481

6582
case class ScalaVersion(major: Int, minor: Int, revision: Int) {
66-
val raw: String = s"$major.$minor.$revision"
83+
val raw: String = s"$major.$minor.$revision"
6784
def isMajorMinor(maj: Int, min: Int): Boolean = maj == major && min == minor
6885
}
6986
object ScalaVersion {

project/Settings.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ class BasicSettings(
7878
scalacOptions ++= Seq(
7979
"-encoding",
8080
"UTF-8",
81-
s"-target:jvm-${jdkVersionValue}",
81+
s"-target:${jdkVersionValue}",
82+
s"-release:${jdkVersionValue}",
8283
"-feature",
8384
"-language:_",
8485
"-deprecation",
8586
"-unchecked",
86-
//"-Ylog-classpath",
8787
"-Xlint",
8888
"-Ywarn-dead-code",
8989
"-Xfatal-warnings",
@@ -94,16 +94,14 @@ class BasicSettings(
9494
javacOptions ++= Seq(
9595
"-encoding",
9696
"UTF-8",
97-
"-source",
98-
jdkVersionValue,
99-
"-target",
100-
jdkVersionValue,
97+
"--release",
98+
s"${jdkVersionValue}",
10199
"-Xlint:deprecation",
102100
"-Xlint:unchecked"
103101
),
104102
doc / javacOptions --= Seq(
105-
"-target",
106-
jdkVersionValue,
103+
"--release",
104+
s"${jdkVersionValue}",
107105
"-Xlint:deprecation",
108106
"-Xlint:unchecked"
109107
),

project/Vanilla2Dependencies.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Vanilla2Dependencies(val versions: Vanilla2Versions)
4545
lazy val jettySecurity = "org.eclipse.jetty" % "jetty-security" % versions.jettySecurity
4646
lazy val mongoTest = "de.flapdoodle.embed" % "de.flapdoodle.embed.mongo" % "3.5.4" % Test
4747
lazy val shapeless = "com.chuusai" %% "shapeless" % "2.3.3"
48+
lazy val hadoopClientApi = "org.apache.hadoop" % "hadoop-client-api" % versions.hadoop
4849

4950
val jacksonTestDependencies = Seq(
5051
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.1" % Test force (),

project/Vanilla2Versions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Vanilla2Versions {
1111
val httpcomponents = "4.3.3"
1212
val httpcomponentsMime = "4.3.1"
1313
val javaxMail = "1.4"
14-
val jdk = "1.8"
14+
val jdk = "8"
1515
val jetty = "9.3.20.v20170531"
1616
val jopt = "3.2"
1717
val json4s = "3.5.3"

0 commit comments

Comments
 (0)