[Gradle] Remove deprecated ways to specify compiler classpath

This change removes options to specify compiler classpath using
deprecated properties that were deprecated for more than 2 years.
This commit is contained in:
Ivan Gavrilovic
2021-04-26 16:31:59 +01:00
committed by teamcityserver
parent 61e21ef6a2
commit b3d8187df4
6 changed files with 2 additions and 90 deletions
@@ -103,25 +103,6 @@ class KotlinDaemonIT : BaseGradleIT() {
}
}
@Test
fun testGradleBuildClasspathShouldNotBeLeakedIntoDaemonClasspathOnUsingCustomCompilerJar() {
val testProject = Project(
projectName = "customCompilerFile",
)
testProject.setupWorkingDir()
// copy compiler embeddable into project dir using custom name
val classpath = System.getProperty("java.class.path").split(File.pathSeparator)
val kotlinEmbeddableJar = File(classpath.find { it.contains("kotlin-compiler-embeddable") }!!)
val compilerJar = File(testProject.projectDir, "compiler.jar")
kotlinEmbeddableJar.copyTo(compilerJar)
testProject.build("build") {
assertGradleClasspathNotLeaked()
}
}
private fun CompiledProject.assertGradleClasspathNotLeaked() {
assertContains("Kotlin compiler classpath:")
val daemonClasspath = output.lineSequence().find {
@@ -367,23 +367,6 @@ class KotlinGradleIT : BaseGradleIT() {
}
}
@Test
fun testCustomCompilerFile() {
val project = Project("customCompilerFile")
project.setupWorkingDir()
// copy compiler embeddable to project dir using custom name
val classpath = System.getProperty("java.class.path").split(File.pathSeparator)
val kotlinEmbeddableJar = File(classpath.find { it.contains("kotlin-compiler-embeddable") })
val compilerJar = File(project.projectDir, "compiler.jar")
kotlinEmbeddableJar.copyTo(compilerJar)
project.build("build") {
assertSuccessful()
assertContains("Kotlin compiler classpath: $compilerJar")
}
}
@Test
fun testFreeCompilerArgs() {
val project = Project("kotlinProject")
@@ -85,9 +85,9 @@ class UpToDateIT : BaseGradleIT() {
buildGradle.appendText("""${'\n'}
// Add Kapt to the project to test its input checks as well:
apply plugin: 'kotlin-kapt'
compileKotlin.compilerClasspath = files($originalPaths).toList()
compileKotlin.getDefaultCompilerClasspath${'$'}kotlin_gradle_plugin().setFrom(files($originalPaths).toList())
afterEvaluate {
kaptGenerateStubsKotlin.compilerClasspath = files($originalPaths).toList()
kaptGenerateStubsKotlin.getDefaultCompilerClasspath${'$'}kotlin_gradle_plugin().setFrom(files($originalPaths).toList())
}
""".trimIndent())
}
@@ -1,23 +0,0 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: "kotlin"
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
testImplementation 'junit:junit:4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
compileKotlin.compilerJarFile = project.file("compiler.jar")
@@ -64,32 +64,6 @@ abstract class AbstractKotlinCompileTool<T : CommonToolArguments>
CompilerArgumentAwareWithInput<T>,
TaskWithLocalState {
private fun useCompilerClasspathConfigurationMessage(propertyName: String) {
logger.kotlinWarn(
"'$path.$propertyName' is deprecated and will be removed soon. " +
"Use '$COMPILER_CLASSPATH_CONFIGURATION_NAME' " +
"configuration for customizing compiler classpath."
)
}
// TODO: remove
@get:Internal
var compilerJarFile: File? = null
@Deprecated("Use $COMPILER_CLASSPATH_CONFIGURATION_NAME configuration")
set(value) {
useCompilerClasspathConfigurationMessage("compilerJarFile")
field = value
}
// TODO: remove
@get:Internal
var compilerClasspath: List<File>? = null
@Deprecated("Use $COMPILER_CLASSPATH_CONFIGURATION_NAME configuration")
set(value) {
useCompilerClasspathConfigurationMessage("compilerClasspath")
field = value
}
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
override fun getSource() = super.getSource()
@@ -114,8 +88,6 @@ abstract class AbstractKotlinCompileTool<T : CommonToolArguments>
@get:InputFiles
internal val computedCompilerClasspath: FileCollection = project.objects.fileCollection().from({
when {
!compilerClasspath.isNullOrEmpty() -> compilerClasspath!!
compilerJarFile != null -> classpathWithCompilerJar
useFallbackCompilerSearch -> findKotlinCompilerClasspath(project)
else -> defaultCompilerClasspath
}