Remove unneeded code from Gradle plugin

This commit is contained in:
Alexey Tsvetkov
2018-05-17 17:09:20 +03:00
parent 3dc314d509
commit 0eadc76cb7
3 changed files with 0 additions and 42 deletions
@@ -96,7 +96,6 @@ open class KaptGenerateStubsTask : KotlinCompile() {
sourceRoots.log(this.name, logger)
val args = prepareCompilerArguments()
compilerCalled = true
callCompiler(args, sourceRoots, ChangedFiles(inputs))
}
}
@@ -22,8 +22,6 @@ import org.gradle.api.invocation.Gradle
import org.gradle.api.logging.Logging
import org.jetbrains.kotlin.compilerRunner.DELETED_SESSION_FILE_PREFIX
import org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import org.jetbrains.kotlin.gradle.utils.isWindows
import org.jetbrains.kotlin.gradle.utils.relativeToRoot
import org.jetbrains.kotlin.utils.addToStdlib.sumByLong
import java.lang.management.ManagementFactory
@@ -61,7 +59,6 @@ internal class KotlinGradleBuildServices private constructor(gradle: Gradle) : B
}
private val log = Logging.getLogger(this.javaClass)
private val cleanup = CompilerServicesCleanup()
private var startMemory: Long? = null
private val shouldReportMemoryUsage = System.getProperty(SHOULD_REPORT_MEMORY_USAGE_PROPERTY) != null
@@ -73,18 +70,6 @@ internal class KotlinGradleBuildServices private constructor(gradle: Gradle) : B
override fun buildFinished(result: BuildResult) {
val gradle = result.gradle!!
val kotlinCompilerCalled = gradle.rootProject
.allprojects
.flatMap { it.tasks }
.any { it is AbstractKotlinCompile<*> && it.compilerCalled }
if (kotlinCompilerCalled) {
log.kotlinDebug("Cleanup after kotlin")
cleanup(gradle.gradleVersion)
}
else {
log.kotlinDebug("Skipping kotlin cleanup since compiler wasn't called")
}
GradleCompilerRunner.clearBuildModulesInfo()
val rootProject = gradle.rootProject
@@ -132,24 +117,3 @@ internal class KotlinGradleBuildServices private constructor(gradle: Gradle) : B
private fun getGcCount(): Long =
ManagementFactory.getGarbageCollectorMXBeans().sumByLong { Math.max(0, it.collectionCount) }
}
internal class CompilerServicesCleanup() {
private val log = Logging.getLogger(this.javaClass)
operator fun invoke(gradleVersion: String) {
log.kotlinDebug("compiler services cleanup")
// clearing jar cache to avoid problems like KT-9440 (unable to clean/rebuild a project due to locked jar file)
// problem is known to happen only on windows - the reason (seems) related to http://bugs.java.com/view_bug.do?bug_id=6357433
// clean cache only when running on windows
if (isWindows) {
cleanJarCache()
}
}
private fun cleanJarCache() {
log.kotlinDebug("Clean JAR cache")
log.kotlinDebug("JAR cache cleared")
}
}
@@ -180,9 +180,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
?: coroutinesFromGradleProperties
?: Coroutines.DEFAULT
@get:Internal
internal var compilerCalled: Boolean = false
// TODO: consider more reliable approach (see usage)
@get:Internal
internal var anyClassesCompiled: Boolean = false
@@ -256,8 +253,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
sourceRoots.log(this.name, logger)
val args = prepareCompilerArguments()
compilerCalled = true
callCompiler(args, sourceRoots, ChangedFiles(inputs))
}