Skip to content

Commit

Permalink
Merge pull request #274 from bjaglin/jdk17
Browse files Browse the repository at this point in the history
fix JDK17 build
  • Loading branch information
bjaglin authored Jan 11, 2022
2 parents 53e57d5 + 30d8d4d commit 8d4bde2
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: olafurpg/setup-scala@v13
with:
java-version: 17
- run: sbt test scripted
- run: sbt "test; scripted sbt-scalafix/*"
windows:
name: Windows tests
runs-on: windows-latest
Expand Down
8 changes: 6 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ scalaVersion := "2.12.15"
// keep this as low as possible to avoid running into binary incompatibility such as https://github.com/sbt/sbt/issues/5049
pluginCrossBuild / sbtVersion := "1.2.1"

// first release that can build 2.13 (as it bring a Zinc version with a compiler-bridge published for 2.13)
scriptedSbt := "1.2.7"
scriptedSbt := {
if (System.getProperty("java.specification.version").toDouble < 17)
"1.2.7" // first release that can build 2.13 (as it bring a Zinc version with a compiler-bridge published for 2.13)
else
"1.5.5" // first release that supports JDK17
}

libraryDependencies += compilerPlugin(scalafixSemanticdb)

Expand Down
2 changes: 0 additions & 2 deletions src/sbt-test/sbt-scalafix/scalafixEnable/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ lazy val scala213 = project.settings(
TaskKey[Unit]("check") := {
// nothing should change for the 2.10 project
assert((scala210 / scalaVersion).value == "2.10.4")
assert((scala210 / libraryDependencies).value.isEmpty)
assert((scala210 / Compile / compile / scalacOptions).value.isEmpty)

// 2.12.0 should be overidden to 2.12.X
assert((overridesSettings / scalaVersion).value == V.scala212)
assert((overridesSettings / libraryDependencies).value.nonEmpty)
assert(
(overridesSettings / Compile / compile / scalacOptions).value
.contains("-Yrangepos")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ object FatalWarningsPlugin extends AutoPlugin {
override def requires: Plugins = ScalafixPlugin

override def projectSettings: Seq[Def.Setting[_]] = Seq(
Test / compile / scalacOptions := Seq(
"-Xfatal-warnings",
"-Ywarn-unused"
)
Test / compile / scalacOptions := {
val old = (Test / compile / scalacOptions).value
val strict = Seq(
"-Xfatal-warnings",
"-Ywarn-unused"
)
// For sbt 1.3+ where SemanticdbPlugin is available and preferred to manual tweaking,
// scalafixEnable does not manage to enable Semanticdb when scalacOptions are overriden
if (sbtVersion.value.split("\\.")(1).toInt >= 3) old ++ strict else strict
}
)
}

0 comments on commit 8d4bde2

Please sign in to comment.