Skip to content

Commit b2972bd

Browse files
authored
update to jdk 11 [AS-594] (#1372)
1 parent 7b30964 commit b2972bd

File tree

14 files changed

+36
-25
lines changed

14 files changed

+36
-25
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
- name: coursier-cache-action
3636
uses: coursier/cache-action@v5
3737

38-
- name: Set up JDK 1.8
38+
- name: Set up JDK 11
3939
uses: actions/setup-java@v1
4040
with:
41-
java-version: 1.8
41+
java-version: 11
4242

4343
- name: Git secrets setup
4444
run: |

.java-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8
1+
11

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM us.gcr.io/broad-dsp-gcr-public/base/jre:8-debian
1+
FROM us.gcr.io/broad-dsp-gcr-public/base/jre:11-debian
22

33
# To run, must build the jar using ./docker/build.sh
44

automation/Dockerfile-tests

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM bigtruedata/sbt
1+
FROM broadinstitute/scala-baseimage:jdk11-2.12.12-1.4.7
22

33
COPY src /app/src
44
COPY minnie-kenny.sh /app

automation/project/Settings.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object Settings {
1515
//coreDefaultSettings + defaultConfigs = the now deprecated defaultSettings
1616
val commonBuildSettings = Defaults.coreDefaultSettings ++ Defaults.defaultConfigs ++ Seq(
1717
javaOptions += "-Xmx2G",
18-
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
18+
javacOptions ++= Seq("--release", "11"),
1919
addCompilerPlugin(scalafixSemanticdb)
2020
)
2121

@@ -24,7 +24,6 @@ object Settings {
2424
"-deprecation",
2525
"-feature",
2626
"-encoding", "utf8",
27-
"-target:jvm-1.8",
2827
"-Xmax-classfile-name", "100"
2928
)
3029

automation/project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version = 1.4.6
1+
sbt.version = 1.4.7

build.sbt

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ lazy val rawls = project.in(file("."))
5050
// This appears to do some magic to configure itself. It consistently fails in some environments
5151
// unless it is loaded after the settings definitions above.
5252
Revolver.settings
53+
Global / excludeLintKeys += debugSettings // To avoid lint warning
5354

5455
mainClass in reStart := Some("org.broadinstitute.dsde.rawls.Boot")
5556

core/src/test/scala/org/broadinstitute/dsde/rawls/RawlsTestUtils.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package org.broadinstitute.dsde.rawls
33
import akka.http.scaladsl.model.{StatusCode, StatusCodes}
44
import org.broadinstitute.dsde.rawls.dataaccess.slick.TestDriverComponent
55
import org.broadinstitute.dsde.rawls.model.Workspace
6-
import org.mockserver.model.StringBody
6+
import org.mockserver.model.RegexBody
77
import org.scalatest.exceptions.TestFailedException
88
import org.scalatest.Suite
99

@@ -71,8 +71,8 @@ trait RawlsTestUtils extends Suite with TestDriverComponent with Matchers {
7171
}
7272

7373
// MockServer's .withBody doesn't have a built-in string contains feature. This serves that purpose.
74-
def mockServerContains(text: String): StringBody = {
75-
val anythingWithNewlines = "((.|\n|\r)*)"
76-
StringBody.regex(anythingWithNewlines + Regex.quote(text.toString) + anythingWithNewlines)
74+
def mockServerContains(text: String): RegexBody = {
75+
// "(?s)" turns on DOTALL mode, where a "." matches a line break as well as any character
76+
new RegexBody("(?s).*" + Regex.quote(text) + ".*")
7777
}
7878
}

docker/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function make_jar()
108108
if [ "$SKIP_TESTS" != "skip-tests" ]; then
109109
DOCKER_RUN="$DOCKER_RUN --link mysql:mysql"
110110
fi
111-
DOCKER_RUN="$DOCKER_RUN -e SKIP_TESTS=$SKIP_TESTS -e GIT_MODEL_HASH=$GIT_MODEL_HASH -e GIT_COMMIT -e BUILD_NUMBER -v $PWD:/working -v sbt-cache:/root/.sbt -v jar-cache:/root/.ivy2 -v coursier-cache:/root/.cache/coursier broadinstitute/scala-baseimage /working/docker/install.sh /working"
111+
DOCKER_RUN="$DOCKER_RUN -e SKIP_TESTS=$SKIP_TESTS -e GIT_MODEL_HASH=$GIT_MODEL_HASH -e GIT_COMMIT -e BUILD_NUMBER -v $PWD:/working -v sbt-cache:/root/.sbt -v jar-cache:/root/.ivy2 -v coursier-cache:/root/.cache/coursier broadinstitute/scala-baseimage:jdk11-2.12.11-1.4.7 /working/docker/install.sh /working"
112112
JAR_CMD=$($DOCKER_RUN 1>&2)
113113
EXIT_CODE=$?
114114

@@ -130,7 +130,7 @@ function artifactory_push()
130130
ARTIFACTORY_USERNAME=dsdejenkins
131131
ARTIFACTORY_PASSWORD=$(docker run -e VAULT_TOKEN=$VAULT_TOKEN broadinstitute/dsde-toolbox vault read -field=password secret/dsp/accts/artifactory/dsdejenkins)
132132
echo "Publishing to artifactory..."
133-
docker run --rm -v $PWD:/$PROJECT -v sbt-cache:/root/.sbt -v jar-cache:/root/.ivy2 -v coursier-cache:/root/.cache/coursier -w="/$PROJECT" -e ARTIFACTORY_USERNAME=$ARTIFACTORY_USERNAME -e ARTIFACTORY_PASSWORD=$ARTIFACTORY_PASSWORD broadinstitute/scala-baseimage:scala-2.11.8 /$PROJECT/core/src/bin/publishSnapshot.sh
133+
docker run --rm -v $PWD:/$PROJECT -v sbt-cache:/root/.sbt -v jar-cache:/root/.ivy2 -v coursier-cache:/root/.cache/coursier -w="/$PROJECT" -e ARTIFACTORY_USERNAME=$ARTIFACTORY_USERNAME -e ARTIFACTORY_PASSWORD=$ARTIFACTORY_PASSWORD broadinstitute/scala-baseimage:jdk11-2.12.11-1.4.7 /$PROJECT/core/src/bin/publishSnapshot.sh
134134
}
135135

136136
function docker_cmd()

docker/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if [ "$SKIP_TESTS" = "skip-tests" ]; then
1616
echo skipping tests
1717
else
1818
echo "starting sbt test ..."
19-
sbt -J-Xms5g -J-Xmx5g -J-XX:MaxMetaspaceSize=5g test -Dmysql.host=mysql -Dmysql.port=3306
19+
sbt -J-Xms5g -J-Xmx5g -J-XX:MaxMetaspaceSize=5g test -Dmysql.host=mysql -Dmysql.port=3306 -Dsecrets.skip=true
2020
echo "sbt test done"
2121
fi
2222

project/Dependencies.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ object Dependencies {
8787
val scalaUri: ModuleID = "io.lemonlabs" %% "scala-uri" % "3.0.0"
8888
val scalatest: ModuleID = "org.scalatest" %% "scalatest" % "3.2.2" % "test"
8989
val mockito: ModuleID = "org.scalatestplus" %% "mockito-3-4" % "3.2.2.0" % Test
90-
val mockserverNetty: ModuleID = "org.mock-server" % "mockserver-netty" % "3.9.2" % "test"
90+
val mockserverNetty: ModuleID = "org.mock-server" % "mockserver-netty" % "5.11.2" % "test"
9191
val ficus: ModuleID = "com.iheart" %% "ficus" % "1.4.0"
9292
val scalaCache: ModuleID = "com.github.cb372" %% "scalacache-caffeine" % "0.24.2"
9393
val apacheCommonsIO: ModuleID = "commons-io" % "commons-io" % "2.6"
@@ -108,8 +108,10 @@ object Dependencies {
108108

109109
val accessContextManager = "com.google.apis" % "google-api-services-accesscontextmanager" % "v1beta-rev55-1.25.0"
110110

111-
val workspaceManager = excludeGuavaJDK5("bio.terra" % "workspace-manager-client" % "0.13.0-SNAPSHOT")
112-
val dataRepo = excludeGuavaJDK5("bio.terra" % "datarepo-client" % "1.0.44-SNAPSHOT")
111+
def excludeJakartaActivationApi(m: ModuleID): ModuleID = m.exclude("jakarta.activation", "jakarta.activation-api")
112+
113+
val workspaceManager = excludeJakartaActivationApi("bio.terra" % "workspace-manager-client" % "0.13.0-SNAPSHOT")
114+
val dataRepo = excludeJakartaActivationApi("bio.terra" % "datarepo-client" % "1.0.44-SNAPSHOT")
113115

114116
val opencensusScalaCode: ModuleID = "com.github.sebruck" %% "opencensus-scala-core" % "0.7.0-M2"
115117
val opencensusAkkaHttp: ModuleID = "com.github.sebruck" %% "opencensus-scala-akka-http" % "0.7.0-M2"

project/Settings.scala

+10-5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ object Settings {
2727
javaOptions += "-Xmx2G"
2828
)
2929

30+
val java11BuildSettings = Seq( // can be wrapped into commonBuildSettings when rawls-model can publish java 11
31+
javacOptions ++= Seq("--release", "11")
32+
)
33+
3034
val commonCompilerSettings = Seq(
3135
"-unchecked",
3236
"-feature",
@@ -78,13 +82,14 @@ object Settings {
7882
val googleSettings = commonSettings ++ List(
7983
name := "workbench-google",
8084
libraryDependencies ++= googleDependencies
81-
) ++ versionSettings ++ noPublishSettings
85+
) ++ versionSettings ++ noPublishSettings ++ java11BuildSettings
8286

8387
//the full list of settings for the rawlsModel project (see build.sbt)
8488
//coreDefaultSettings (inside commonSettings) sets the project name, which we want to override, so ordering is important.
8589
//thus commonSettings needs to be added first.
8690
val modelSettings = cross212and213 ++ commonSettings ++ List(
8791
name := "rawls-model",
92+
javacOptions ++= Seq("--release", "8"), // has to publish a java 8 artifact
8893
libraryDependencies ++= modelDependencies
8994
) ++ versionSettings ++ publishSettings
9095

@@ -94,15 +99,15 @@ object Settings {
9499
val utilSettings = commonSettings ++ List(
95100
name := "workbench-util",
96101
libraryDependencies ++= utilDependencies
97-
) ++ versionSettings ++ noPublishSettings
102+
) ++ versionSettings ++ noPublishSettings ++ java11BuildSettings
98103

99104
//the full list of settings for the workbenchMetrics project (see build.sbt)
100105
//coreDefaultSettings (inside commonSettings) sets the project name, which we want to override, so ordering is important.
101106
//thus commonSettings needs to be added first.
102107
val metricsSettings = commonSettings ++ List(
103108
name := "workbench-metrics",
104109
libraryDependencies ++= metricsDependencies
105-
) ++ versionSettings ++ noPublishSettings
110+
) ++ versionSettings ++ noPublishSettings ++ java11BuildSettings
106111

107112
//the full list of settings for the rawlsCore project (see build.sbt)
108113
//coreDefaultSettings (inside commonSettings) sets the project name, which we want to override, so ordering is important.
@@ -111,7 +116,7 @@ object Settings {
111116
name := "rawls-core",
112117
version := "0.1",
113118
libraryDependencies ++= rawlsCoreDependencies
114-
) ++ antlr4CodeGenerationSettings ++ rawlsAssemblySettings ++ noPublishSettings ++ rawlsCompileSettings
119+
) ++ antlr4CodeGenerationSettings ++ rawlsAssemblySettings ++ noPublishSettings ++ rawlsCompileSettings ++ java11BuildSettings
115120
//NOTE: rawlsCoreCompileSettings above has to be last, because something in commonSettings or rawlsAssemblySettings
116121
//overwrites it if it's before them. I (hussein) don't know what that is and I don't care to poke the bear to find out.
117122

@@ -121,6 +126,6 @@ object Settings {
121126
val rootSettings = commonSettings ++ List(
122127
name := "rawls",
123128
version := "0.1"
124-
) ++ rawlsAssemblySettings ++ noPublishSettings ++ rawlsCompileSettings
129+
) ++ rawlsAssemblySettings ++ noPublishSettings ++ rawlsCompileSettings ++ java11BuildSettings
125130
//See immediately above NOTE.
126131
}

project/Testing.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import MinnieKenny.testSettings
12
import sbt.Keys._
23
import sbt._
34

@@ -22,6 +23,9 @@ object Testing {
2223

2324
val commonTestSettings: Seq[Setting[_]] = List(
2425

26+
testOptions in Test += Tests.Setup(() =>
27+
sys.props += "mockserver.logLevel" -> "WARN"
28+
),
2529
// SLF4J initializes itself upon the first logging call. Because sbt
2630
// runs tests in parallel it is likely that a second thread will
2731
// invoke a second logging call before SLF4J has completed
@@ -55,7 +59,7 @@ object Testing {
5559
(testOnly in Test) := ((testOnly in Test) dependsOn validMySqlHost).evaluated,
5660

5761
parallelExecution in Test := false
58-
) ++ MinnieKenny.testSettings
62+
) ++ (if (sys.props.getOrElse("secrets.skip", "false") != "true") MinnieKenny.testSettings else List())
5963

6064
implicit class ProjectTestSettings(val project: Project) extends AnyVal {
6165
def withTestSettings: Project = project

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.4.6
1+
sbt.version=1.4.7

0 commit comments

Comments
 (0)