[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:
committed by
teamcityserver
parent
61e21ef6a2
commit
b3d8187df4
-19
@@ -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() {
|
private fun CompiledProject.assertGradleClasspathNotLeaked() {
|
||||||
assertContains("Kotlin compiler classpath:")
|
assertContains("Kotlin compiler classpath:")
|
||||||
val daemonClasspath = output.lineSequence().find {
|
val daemonClasspath = output.lineSequence().find {
|
||||||
|
|||||||
-17
@@ -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
|
@Test
|
||||||
fun testFreeCompilerArgs() {
|
fun testFreeCompilerArgs() {
|
||||||
val project = Project("kotlinProject")
|
val project = Project("kotlinProject")
|
||||||
|
|||||||
+2
-2
@@ -85,9 +85,9 @@ class UpToDateIT : BaseGradleIT() {
|
|||||||
buildGradle.appendText("""${'\n'}
|
buildGradle.appendText("""${'\n'}
|
||||||
// Add Kapt to the project to test its input checks as well:
|
// Add Kapt to the project to test its input checks as well:
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
compileKotlin.compilerClasspath = files($originalPaths).toList()
|
compileKotlin.getDefaultCompilerClasspath${'$'}kotlin_gradle_plugin().setFrom(files($originalPaths).toList())
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
kaptGenerateStubsKotlin.compilerClasspath = files($originalPaths).toList()
|
kaptGenerateStubsKotlin.getDefaultCompilerClasspath${'$'}kotlin_gradle_plugin().setFrom(files($originalPaths).toList())
|
||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent())
|
||||||
}
|
}
|
||||||
|
|||||||
-23
@@ -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")
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
class Dummy
|
|
||||||
-28
@@ -64,32 +64,6 @@ abstract class AbstractKotlinCompileTool<T : CommonToolArguments>
|
|||||||
CompilerArgumentAwareWithInput<T>,
|
CompilerArgumentAwareWithInput<T>,
|
||||||
TaskWithLocalState {
|
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
|
@InputFiles
|
||||||
@PathSensitive(PathSensitivity.RELATIVE)
|
@PathSensitive(PathSensitivity.RELATIVE)
|
||||||
override fun getSource() = super.getSource()
|
override fun getSource() = super.getSource()
|
||||||
@@ -114,8 +88,6 @@ abstract class AbstractKotlinCompileTool<T : CommonToolArguments>
|
|||||||
@get:InputFiles
|
@get:InputFiles
|
||||||
internal val computedCompilerClasspath: FileCollection = project.objects.fileCollection().from({
|
internal val computedCompilerClasspath: FileCollection = project.objects.fileCollection().from({
|
||||||
when {
|
when {
|
||||||
!compilerClasspath.isNullOrEmpty() -> compilerClasspath!!
|
|
||||||
compilerJarFile != null -> classpathWithCompilerJar
|
|
||||||
useFallbackCompilerSearch -> findKotlinCompilerClasspath(project)
|
useFallbackCompilerSearch -> findKotlinCompilerClasspath(project)
|
||||||
else -> defaultCompilerClasspath
|
else -> defaultCompilerClasspath
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user