Skip to content

Fix Scala test compile Java home usage #1481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spark/sql-13/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ configurations.all { Configuration conf ->
tasks.withType(ScalaCompile) { ScalaCompile task ->
task.sourceCompatibility = project.ext.minimumRuntimeVersion
task.targetCompatibility = project.ext.minimumRuntimeVersion
task.options.forkOptions.executable = new File(project.ext.runtimeJavaHome, 'bin/java').canonicalPath
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a compelling reason to use canonicalPath here? There's a performance cost to doing so as resolving a canonical path involves file IO at configuration time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll put up a quick fix for this then. I was following the same approach that the Gradle internals are doing, but I suppose if they're already getting the canonical file, we don't have to here.

}

compileScala {
options.forkOptions.executable = new File(project.ext.runtimeJavaHome, 'bin/java').canonicalPath
configure(scalaCompileOptions.forkOptions) {
memoryMaximumSize = '1g'
jvmArgs = ['-XX:MaxPermSize=512m']
Expand Down
2 changes: 1 addition & 1 deletion spark/sql-20/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ if (project.ext.scalaMajorVersion == '2.10') {
tasks.withType(ScalaCompile) { ScalaCompile task ->
task.sourceCompatibility = project.ext.minimumRuntimeVersion
task.targetCompatibility = project.ext.minimumRuntimeVersion
task.options.forkOptions.executable = new File(project.ext.runtimeJavaHome, 'bin/java').canonicalPath
}

compileScala {
options.forkOptions.executable = new File(project.ext.runtimeJavaHome, 'bin/java').canonicalPath
configure(scalaCompileOptions.forkOptions) {
memoryMaximumSize = '1g'
jvmArgs = ['-XX:MaxPermSize=512m']
Expand Down