Skip to content

Commit fd96788

Browse files
committed
Use separate settings for scalac and javac JVM versions.
1 parent 38191a1 commit fd96788

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

project/SparkBuild.scala

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ object BuildCommons {
5656

5757
val testTempDir = s"$sparkHome/target/tmp"
5858

59-
val compilerJVMVersion = settingKey[String]("source and target JVM version for java and scalac")
59+
val javacJVMVersion = settingKey[String]("source and target JVM version for javac")
60+
val scalacJVMVersion = settingKey[String]("source and target JVM version for scalac")
6061
}
6162

6263
object SparkBuild extends PomBuild {
@@ -156,16 +157,17 @@ object SparkBuild extends PomBuild {
156157
if (major.toInt >= 1 && minor.toInt >= 8) Seq("-Xdoclint:all", "-Xdoclint:-missing") else Seq.empty
157158
},
158159

159-
compilerJVMVersion := "1.7",
160+
javacJVMVersion := "1.7",
161+
scalacJVMVersion := "1.7",
160162

161163
javacOptions in Compile ++= Seq(
162164
"-encoding", "UTF-8",
163-
"-source", compilerJVMVersion.value,
164-
"-target", compilerJVMVersion.value
165+
"-source", javacJVMVersion.value,
166+
"-target", javacJVMVersion.value
165167
),
166168

167169
scalacOptions in Compile ++= Seq(
168-
s"-target:jvm-${compilerJVMVersion.value}",
170+
s"-target:jvm-${scalacJVMVersion.value}",
169171
"-sourcepath", (baseDirectory in ThisBuild).value.getAbsolutePath // Required for relative source links in scaladoc
170172
),
171173

@@ -574,7 +576,9 @@ object Java8TestSettings {
574576
import BuildCommons._
575577

576578
lazy val settings = Seq(
577-
compilerJVMVersion := "1.8"
579+
javacJVMVersion := "1.8",
580+
// Targeting Java 8 bytecode is only supported in Scala 2.11.4 and higher:
581+
scalacJVMVersion := (if (System.getProperty("scala-2.11") == "true") "1.8" else "1.7")
578582
)
579583
}
580584

0 commit comments

Comments
 (0)