Add @LocalState of buildServicesWorkingDir to KotlinCompile
This commit is contained in:
+1
-1
@@ -72,7 +72,7 @@ internal class KotlinGradleBuildServices private constructor(gradle: Gradle): Bu
|
||||
private val log = Logging.getLogger(this.javaClass)
|
||||
private val cleanup = CompilerServicesCleanup()
|
||||
private var startMemory: Long? = null
|
||||
private val workingDir: File by lazy { File(gradle.rootProject.buildDir, "kotlin-build").apply { mkdirs() } }
|
||||
internal val workingDir: File by lazy { File(gradle.rootProject.buildDir, "kotlin-build").apply { mkdirs() } }
|
||||
private val buildCacheStorage: BuildCacheStorage by lazy { BuildCacheStorage(workingDir) }
|
||||
private val shouldReportMemoryUsage = System.getProperty(SHOULD_REPORT_MEMORY_USAGE_PROPERTY) != null
|
||||
|
||||
|
||||
+3
@@ -203,6 +203,9 @@ internal class Kotlin2JvmSourceSetProcessor(
|
||||
|
||||
registerKotlinOutputForJavaLibrary(classesDirectory, classesProviderTask)
|
||||
}
|
||||
|
||||
// To make Gradle read this location from the task's @LocalState property and clean it on cache hit:
|
||||
kotlinTask.buildServicesWorkingDir = Callable { kotlinGradleBuildServices.workingDir }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -47,6 +47,7 @@ import org.jetbrains.kotlin.incremental.multiproject.ArtifactDifferenceRegistryP
|
||||
import org.jetbrains.kotlin.utils.LibraryUtils
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import java.util.concurrent.Callable
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
const val ANNOTATIONS_PLUGIN_NAME = "org.jetbrains.kotlin.kapt"
|
||||
@@ -276,6 +277,9 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
||||
logger.kotlinDebug { "Set $this.usePreciseJavaTracking=$value" }
|
||||
}
|
||||
|
||||
@get:LocalState @get:Optional
|
||||
internal var buildServicesWorkingDir: Callable<File>? = null
|
||||
|
||||
init {
|
||||
incremental = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user