Skip to content

Commit

Permalink
Propagate java options for run
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Feb 20, 2024
1 parent 546e814 commit d235a7f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ val commonSettings = Def.settings(
resolvers ++= Resolver.sonatypeOssRepos("public"),
fork := true,
run / outputStrategy := Some(OutputStrategy.StdoutOutput),
run / javaOptions ++= JavaOptions.runDefaults(javaMajorVersion),
Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat,
Test / javaOptions ++= JavaOptions.testDefaults(javaMajorVersion),
Test / testOptions += Tests.Argument("-oD"),
Expand Down
16 changes: 16 additions & 0 deletions project/JavaOptions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,20 @@ object JavaOptions {
"cloudsql.sqlserver.password"
).flatMap(prop => sys.props.get(prop).map(value => property(prop, value)))
)

def runDefaults(javaVersion: Int): Seq[String] =
tokensForVersion(
javaVersion,
Set(
minHeapSize("512m"),
maxHeapSize("2G"),
advanced("+UseParallelGC"),
property("scio.ignoreVersionWarning", "true"),
property("org.slf4j.simpleLogger.defaultLogLevel", "info")
) ++ Set(
"bigquery.project",
"bigquery.secret",
"cloudsql.sqlserver.password"
).flatMap(prop => sys.props.get(prop).map(value => property(prop, value)))
)
}

0 comments on commit d235a7f

Please sign in to comment.