KT-45777: Change classpath-snapshot directory location
Incremental states for Kotlin compilation are stored inside the `<project>/build/kotlin/<task-name>` directory. Previously, that directory was @LocalState, so we had to keep the `classpath-snapshot` @OutputDirectory outside it. Now, that directory has been made a parent containing @OutputDirectory's @LocalState's, so we can safely move the `classpath-snapshot` directory to it. Test: Existing tests should pass (location change has no functional impact) ^KT-45777 In Progress
This commit is contained in:
+1
-8
@@ -245,8 +245,6 @@ class Kapt3GradleSubplugin @Inject internal constructor(private val registry: To
|
||||
|
||||
private fun Kapt3SubpluginContext.getKaptIncrementalDataDir() = temporaryKaptDirectory("incrementalData")
|
||||
|
||||
private fun Kapt3SubpluginContext.getKaptClasspathSnapshotDir() = temporaryKaptDirectory("classpath-snapshot")
|
||||
|
||||
private fun Kapt3SubpluginContext.getKaptIncrementalAnnotationProcessingCache() = temporaryKaptDirectory("incApCache")
|
||||
|
||||
private fun Kapt3SubpluginContext.temporaryKaptDirectory(
|
||||
@@ -672,12 +670,7 @@ class Kapt3GradleSubplugin @Inject internal constructor(private val registry: To
|
||||
val kaptTaskName = getKaptTaskName("kaptGenerateStubs")
|
||||
val kaptTaskProvider = project.registerTask<KaptGenerateStubsTask>(kaptTaskName)
|
||||
|
||||
val configurator = KaptGenerateStubsTask.Configurator(
|
||||
kotlinCompile,
|
||||
kotlinCompilation,
|
||||
properties,
|
||||
getKaptClasspathSnapshotDir()
|
||||
)
|
||||
val configurator = KaptGenerateStubsTask.Configurator(kotlinCompile, kotlinCompilation, properties)
|
||||
configurator.runAtConfigurationTime(kaptTaskProvider, project)
|
||||
|
||||
kaptTaskProvider.configure { kaptTask ->
|
||||
|
||||
+1
-5
@@ -47,13 +47,9 @@ abstract class KaptGenerateStubsTask @Inject constructor(
|
||||
internal class Configurator(
|
||||
private val kotlinCompileTaskProvider: TaskProvider<KotlinCompile>,
|
||||
kotlinCompilation: KotlinCompilationData<*>,
|
||||
properties: PropertiesProvider,
|
||||
private val classpathSnapshotDir: File
|
||||
properties: PropertiesProvider
|
||||
) : KotlinCompile.Configurator<KaptGenerateStubsTask>(kotlinCompilation, properties) {
|
||||
|
||||
override fun getClasspathSnapshotDir(task: KaptGenerateStubsTask): Provider<Directory> =
|
||||
task.project.objects.directoryProperty().fileValue(classpathSnapshotDir)
|
||||
|
||||
override fun configure(task: KaptGenerateStubsTask) {
|
||||
super.configure(task)
|
||||
|
||||
|
||||
+2
-2
@@ -292,8 +292,8 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments> @Inject constr
|
||||
private fun getKotlinBuildDir(task: T): Provider<Directory> =
|
||||
task.project.layout.buildDirectory.dir("$KOTLIN_BUILD_DIR_NAME/${task.name}")
|
||||
|
||||
protected open fun getClasspathSnapshotDir(task: T): Provider<Directory> =
|
||||
task.project.layout.buildDirectory.dir("$KOTLIN_BUILD_DIR_NAME/classpath-snapshot/${task.name}")
|
||||
protected fun getClasspathSnapshotDir(task: T): Provider<Directory> =
|
||||
getKotlinBuildDir(task).map { it.dir("classpath-snapshot") }
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
Reference in New Issue
Block a user