pekko/project/Jdk9CompileDirectoriesPlugin.scala
Konrad `ktoso` Malawski 349a5f749a =jdk9,str JDK9 ready classes, in special directories (#23650)
* =jdk9,str JDK9 ready classes, in special directories

* =str,jdk9 prepare for releasing using JDK9 (needs sbt 1.0+ though)

* =str,jdk9 passing TCK spec touching some JDK9 types internally

* make sure to include linting options
2017-09-20 21:06:49 +09:00

47 lines
1.2 KiB
Scala

/*
* Copyright (C) 2017 Lightbend Inc. <http://www.lightbend.com/>
*/
import java.io.File
import sbt._
import sbt.Keys._
object Jdk9CompileDirectoriesPlugin extends AutoPlugin {
val jdkVersion: String = System.getProperty("java.version")
override def trigger = allRequirements
override lazy val projectSettings = Seq(
javacOptions in Compile ++= {
// making sure we're really targeting 1.8
if (isJDK9) Seq("-target", "1.8", "-source", "1.8", "-Xdoclint:none")
else Seq("-Xdoclint:none")
},
unmanagedSourceDirectories in Compile ++= {
if (isJDK9) {
println(s"[JDK9] Enabled [...-jdk9-only] directories to be compiled.")
Seq(
(sourceDirectory in Compile).value / "java-jdk9-only",
(sourceDirectory in Compile).value / "scala-jdk9-only"
)
} else Seq.empty
},
unmanagedSourceDirectories in Test ++= {
if (isJDK9) {
Seq(
(sourceDirectory in Test).value / "java-jdk9-only",
(sourceDirectory in Test).value / "scala-jdk9-only"
)
} else Seq.empty
}
)
private def isJDK9 = {
jdkVersion startsWith "9"
}
}