Don't produce warning when '-no-jdk' option is present.
Toolchain in such case should avoid setting '-jdk-home' option. ^KT-46626 In Progress
This commit is contained in:
+32
@@ -621,6 +621,38 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("Build should not produce warninings when '-no-jdk' option is present")
|
||||
@GradleTestVersions(minVersion = "6.7.1")
|
||||
@GradleTest
|
||||
internal fun noWarningOnNoJdkOptionPresent(gradleVersion: GradleVersion) {
|
||||
project(
|
||||
projectName = "simple".fullProjectName,
|
||||
gradleVersion = gradleVersion
|
||||
) {
|
||||
useToolchainToCompile(11)
|
||||
|
||||
//language=groovy
|
||||
rootBuildGradle.append(
|
||||
"""
|
||||
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
tasks
|
||||
.withType(KotlinCompile.class)
|
||||
.configureEach {
|
||||
kotlinOptions {
|
||||
noJdk = true
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
|
||||
build("build") {
|
||||
assertOutputDoesNotContain("w: The '-jdk-home' option is ignored because '-no-jdk' is specified")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun BuildResult.assertJdkHomeIsUsingJdk(
|
||||
javaexecPath: String
|
||||
) = assertOutputContains("[KOTLIN] Kotlin compilation 'jdkHome' argument: $javaexecPath")
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ internal open class GradleCompilerRunner(
|
||||
args.commonSources = commonSources.map { it.absolutePath }.toTypedArray()
|
||||
args.javaSourceRoots = javaSourceRoots.map { it.absolutePath }.toTypedArray()
|
||||
args.javaPackagePrefix = javaPackagePrefix
|
||||
if (args.jdkHome == null) args.jdkHome = jdkHome.absolutePath
|
||||
if (args.jdkHome == null && !args.noJdk) args.jdkHome = jdkHome.absolutePath
|
||||
loggerProvider.kotlinInfo("Kotlin compilation 'jdkHome' argument: ${args.jdkHome}")
|
||||
return runCompilerAsync(KotlinCompilerClass.JVM, args, environment)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user