Skip to content

Commit

Permalink
Factorize java options and propagate GCP settings (#4746)
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones authored Mar 13, 2023
1 parent 7b99279 commit e133eda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.lang.invoke=ALL-UNNAMED
-Dfile.encoding=UTF8
-Dscio.ignoreVersionWarning=true
-Dorg.slf4j.simpleLogger.defaultLogLevel=warn
Expand Down
15 changes: 7 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,9 @@ lazy val keepExistingHeader =
.trim()
})

lazy val java17ConfigSettings = sys.props("java.version") match {
lazy val java17Settings = sys.props("java.version") match {
case v if v.startsWith("17.") =>
Def.settings(
fork := true,
javaOptions ++= Seq(
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
Expand All @@ -245,7 +244,7 @@ lazy val java17ConfigSettings = sys.props("java.version") match {

val commonSettings = formatSettings ++
mimaSettings ++
inConfig(Test)(java17ConfigSettings) ++
java17Settings ++
Def.settings(
organization := "com.spotify",
headerLicense := Some(HeaderLicense.ALv2(currentYear.toString, "Spotify AB")),
Expand All @@ -261,8 +260,10 @@ val commonSettings = formatSettings ++
"org.apache.beam" % "beam-sdks-java-io-kafka"
),
resolvers ++= Resolver.sonatypeOssRepos("public"),
Test / javaOptions += "-Dscio.ignoreVersionWarning=true",
Test / testOptions += Tests.Argument("-oD"),
javaOptions ++= Seq("-Dscio.ignoreVersionWarning=true") ++
sys.props.get("bigquery.project").map(project => s"-Dbigquery.project=$project") ++
sys.props.get("bigquery.secret").map(secret => s"-Dbigquery.secret=$secret"),
testOptions += Tests.Argument("-oD"),
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-a"),
testOptions ++= {
if (sys.env.contains("SLOW")) {
Expand Down Expand Up @@ -353,7 +354,6 @@ lazy val publishSettings = Def.settings(
)

lazy val itSettings = Defaults.itSettings ++
inConfig(IntegrationTest)(java17ConfigSettings) ++
inConfig(IntegrationTest)(BloopDefaults.configSettings) ++
inConfig(IntegrationTest)(scalafmtConfigSettings) ++
scalafixConfigSettings(IntegrationTest) ++
Expand All @@ -368,8 +368,7 @@ lazy val itSettings = Defaults.itSettings ++
HiddenFileFilter || "*.scala"
}
},
javaOptions += "-Dscio.ignoreVersionWarning=true",
run / fork := true
fork := true
)
)

Expand Down

0 comments on commit e133eda

Please sign in to comment.