Skip to content

Commit

Permalink
Add ability to configure JDK versions in test code compliation.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed Nov 10, 2015
1 parent c3e7f4a commit 59d649b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion project/SparkBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ object BuildCommons {
val sparkHome = buildLocation

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

val compilerJVMVersion = settingKey[String]("source and target JVM version for java and scalac")
}

object SparkBuild extends PomBuild {
Expand Down Expand Up @@ -154,9 +156,16 @@ object SparkBuild extends PomBuild {
if (major.toInt >= 1 && minor.toInt >= 8) Seq("-Xdoclint:all", "-Xdoclint:-missing") else Seq.empty
},

javacOptions in Compile ++= Seq("-encoding", "UTF-8"),
compilerJVMVersion := "1.7",

javacOptions in Compile ++= Seq(
"-encoding", "UTF-8",
"-source", compilerJVMVersion.value,
"-target", compilerJVMVersion.value
),

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

Expand Down Expand Up @@ -240,6 +249,7 @@ object SparkBuild extends PomBuild {

enable(Flume.settings)(streamingFlumeSink)

enable(Java8TestSettings.settings)(java8Tests)

/**
* Adds the ability to run the spark shell directly from SBT without building an assembly
Expand Down Expand Up @@ -560,6 +570,14 @@ object Unidoc {
)
}

object Java8TestSettings {
import BuildCommons._

lazy val settings = Seq(
compilerJVMVersion := "1.8"
)
}

object TestSettings {
import BuildCommons._

Expand Down

0 comments on commit 59d649b

Please sign in to comment.