Remove unneeded code from Gradle plugin
This commit is contained in:
-1
@@ -96,7 +96,6 @@ open class KaptGenerateStubsTask : KotlinCompile() {
|
|||||||
sourceRoots.log(this.name, logger)
|
sourceRoots.log(this.name, logger)
|
||||||
val args = prepareCompilerArguments()
|
val args = prepareCompilerArguments()
|
||||||
|
|
||||||
compilerCalled = true
|
|
||||||
callCompiler(args, sourceRoots, ChangedFiles(inputs))
|
callCompiler(args, sourceRoots, ChangedFiles(inputs))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-36
@@ -22,8 +22,6 @@ import org.gradle.api.invocation.Gradle
|
|||||||
import org.gradle.api.logging.Logging
|
import org.gradle.api.logging.Logging
|
||||||
import org.jetbrains.kotlin.compilerRunner.DELETED_SESSION_FILE_PREFIX
|
import org.jetbrains.kotlin.compilerRunner.DELETED_SESSION_FILE_PREFIX
|
||||||
import org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner
|
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.gradle.utils.relativeToRoot
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.sumByLong
|
import org.jetbrains.kotlin.utils.addToStdlib.sumByLong
|
||||||
import java.lang.management.ManagementFactory
|
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 log = Logging.getLogger(this.javaClass)
|
||||||
private val cleanup = CompilerServicesCleanup()
|
|
||||||
private var startMemory: Long? = null
|
private var startMemory: Long? = null
|
||||||
private val shouldReportMemoryUsage = System.getProperty(SHOULD_REPORT_MEMORY_USAGE_PROPERTY) != 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) {
|
override fun buildFinished(result: BuildResult) {
|
||||||
val gradle = result.gradle!!
|
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()
|
GradleCompilerRunner.clearBuildModulesInfo()
|
||||||
|
|
||||||
val rootProject = gradle.rootProject
|
val rootProject = gradle.rootProject
|
||||||
@@ -132,24 +117,3 @@ internal class KotlinGradleBuildServices private constructor(gradle: Gradle) : B
|
|||||||
private fun getGcCount(): Long =
|
private fun getGcCount(): Long =
|
||||||
ManagementFactory.getGarbageCollectorMXBeans().sumByLong { Math.max(0, it.collectionCount) }
|
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")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
-5
@@ -180,9 +180,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
|||||||
?: coroutinesFromGradleProperties
|
?: coroutinesFromGradleProperties
|
||||||
?: Coroutines.DEFAULT
|
?: Coroutines.DEFAULT
|
||||||
|
|
||||||
@get:Internal
|
|
||||||
internal var compilerCalled: Boolean = false
|
|
||||||
|
|
||||||
// TODO: consider more reliable approach (see usage)
|
// TODO: consider more reliable approach (see usage)
|
||||||
@get:Internal
|
@get:Internal
|
||||||
internal var anyClassesCompiled: Boolean = false
|
internal var anyClassesCompiled: Boolean = false
|
||||||
@@ -256,8 +253,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
|||||||
|
|
||||||
sourceRoots.log(this.name, logger)
|
sourceRoots.log(this.name, logger)
|
||||||
val args = prepareCompilerArguments()
|
val args = prepareCompilerArguments()
|
||||||
|
|
||||||
compilerCalled = true
|
|
||||||
callCompiler(args, sourceRoots, ChangedFiles(inputs))
|
callCompiler(args, sourceRoots, ChangedFiles(inputs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user