Skip to content

Commit fb93dcc

Browse files
masseykemark-vieira
authored andcommitted
Setting java boot classpath so that scala 2.10 works on gradle 7.2 (#1800)
Gradle 7.2 broke scala 2.10 compilation. The problem seems to be that the java boot classpath jars are no longer getting into the scala boot classpath. This commit sets it in two ways: (1) it is explicitly set it in scalaCompileOptions.additionalParameters (to prevent the build from failing) and (2) it is set in options.bootstrapClasspath to prevent warnings from javac that its boot classpath is incompatible with the source version.
1 parent d5bf03e commit fb93dcc

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

spark/core/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ if (JavaVersion.current() >= JavaVersion.VERSION_17) {
154154

155155
// Set minimum compatibility and java home for compiler task
156156
tasks.withType(ScalaCompile) { ScalaCompile task ->
157+
task.scalaCompileOptions.additionalParameters = ["-javabootclasspath", new File(project.ext.runtimeJavaHome, 'jre/lib/rt.jar').absolutePath]
158+
task.options.bootstrapClasspath = layout.files(new File(project.ext.runtimeJavaHome, 'jre/lib/rt.jar'))
157159
task.sourceCompatibility = project.ext.minimumRuntimeVersion
158160
task.targetCompatibility = project.ext.minimumRuntimeVersion
159161
task.options.forkOptions.executable = new File(project.ext.runtimeJavaHome, 'bin/java').absolutePath

spark/sql-13/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ configurations.matching { it.name.contains('CompilerPlugin') == false }.all { Co
168168
}
169169

170170
tasks.withType(ScalaCompile) { ScalaCompile task ->
171+
task.scalaCompileOptions.additionalParameters = ["-javabootclasspath", new File(project.ext.runtimeJavaHome, 'jre/lib/rt.jar').absolutePath]
172+
task.options.bootstrapClasspath = layout.files(new File(project.ext.runtimeJavaHome, 'jre/lib/rt.jar'))
171173
task.sourceCompatibility = project.ext.minimumRuntimeVersion
172174
task.targetCompatibility = project.ext.minimumRuntimeVersion
173175
task.options.forkOptions.executable = new File(project.ext.runtimeJavaHome, 'bin/java').absolutePath

spark/sql-20/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ configurations.matching{ it.name.contains('CompilerPlugin') == false }.all { Con
188188
}
189189

190190
tasks.withType(ScalaCompile) { ScalaCompile task ->
191+
task.scalaCompileOptions.additionalParameters = ["-javabootclasspath", new File(project.ext.runtimeJavaHome, 'jre/lib/rt.jar').absolutePath]
192+
task.options.bootstrapClasspath = layout.files(new File(project.ext.runtimeJavaHome, 'jre/lib/rt.jar'))
191193
task.sourceCompatibility = project.ext.minimumRuntimeVersion
192194
task.targetCompatibility = project.ext.minimumRuntimeVersion
193195
task.options.forkOptions.executable = new File(project.ext.runtimeJavaHome, 'bin/java').absolutePath

spark/sql-30/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ configurations.matching{ it.name.contains('CompilerPlugin') == false }.all { Con
171171
}
172172

173173
tasks.withType(ScalaCompile) { ScalaCompile task ->
174+
task.scalaCompileOptions.additionalParameters = ["-javabootclasspath", new File(project.ext.runtimeJavaHome, 'jre/lib/rt.jar').absolutePath]
175+
task.options.bootstrapClasspath = layout.files(new File(project.ext.runtimeJavaHome, 'jre/lib/rt.jar'))
174176
task.sourceCompatibility = project.ext.minimumRuntimeVersion
175177
task.targetCompatibility = project.ext.minimumRuntimeVersion
176178
task.options.forkOptions.executable = new File(project.ext.runtimeJavaHome, 'bin/java').absolutePath

0 commit comments

Comments
 (0)