Skip to content

Commit

Permalink
Keep it simple, fork tests for java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
clairemcginty committed Feb 6, 2023
1 parent db9a560 commit 71a39cf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
fetch-depth: 0
- name: cache SBT
uses: coursier/cache-action@v6
- name: Java 11 setup
- name: Java 17 setup
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
- uses: olafurpg/setup-gpg@v3
- name: Publish ${{ github.ref }}
run: sbt ci-release
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
with:
distribution: temurin
java-version: ${{matrix.java}}
- if: ${{ matrix.java == 17 }}
run: scripts/set_java_17_opts.sh
- if: ${{ !matrix.coverage }}
run: sbt "++${{matrix.scala}} test"
- if: ${{ matrix.coverage }}
Expand Down
19 changes: 12 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ val commonSettings = Def
// this setting is not derived in sbt-tpolecat
// https://github.com/typelevel/sbt-tpolecat/issues/36
inTask(doc)(TpolecatPlugin.projectSettings),
scalacOptions ++= Seq("-release", "8"),
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint:unchecked"),
Compile / doc / javacOptions := Seq("-source", "1.8"),
excludeDependencies ++= Seq(
Expand Down Expand Up @@ -453,16 +454,20 @@ def splitTests(tests: Seq[TestDefinition], filter: Seq[String], forkOptions: For
}
}

lazy val java17Settings = Seq(Test / javaOptions ++= (sys.props("java.version") match {
lazy val java17Settings = sys.props("java.version") match {
case v if v.startsWith("17.") =>
println("Setting java 17 opts")
Seq(
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang.invoke=ALL-UNNAMED"
Test / fork := true,
Test / javaOptions ++= Seq(
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang.invoke=ALL-UNNAMED"
)
)
case _ => Seq.empty
}))
case _ => Seq()
}

lazy val root: Project = Project("scio", file("."))
.settings(commonSettings)
Expand Down
8 changes: 0 additions & 8 deletions scripts/set_java_17_opts.sh

This file was deleted.

0 comments on commit 71a39cf

Please sign in to comment.