aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin/org/jetbrains
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-06-21 11:44:36 +0200
committerGitHub <noreply@github.com>2021-06-21 11:44:36 +0200
commita0b77276242ec227f98bf69ed878b9d71c1c5888 (patch)
tree796cc4638808ae26a060d3f1b17f20aa117d5af0 /runners/gradle-plugin/src/main/kotlin/org/jetbrains
parent1b918994dbfe8f4d345c11c054c8b5ffc9b65cd4 (diff)
downloaddokka-a0b77276242ec227f98bf69ed878b9d71c1c5888.tar.gz
dokka-a0b77276242ec227f98bf69ed878b9d71c1c5888.tar.bz2
dokka-a0b77276242ec227f98bf69ed878b9d71c1c5888.zip
Cachable task (#1905)
* Add tests for Gradle caching scenarios and adjust tasks to honor caching such that tests pass * Make dokka tasks cachable * Make dokka tasks cachable * Make dokka tasks cachable * Fix gradle assertion Co-authored-by: Volker Leck <volker.leck@gmail.com>
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org/jetbrains')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt1
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt3
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt4
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt7
7 files changed, 17 insertions, 4 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
index c3217722..f9f48404 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
@@ -37,6 +37,7 @@ abstract class AbstractDokkaTask : DefaultTask() {
@Optional
@InputDirectory
+ @PathSensitive(PathSensitivity.RELATIVE)
val cacheRoot: Property<File?> = project.objects.safeProperty()
@Input
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
index cfe56d52..68c4181c 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
@@ -1,7 +1,9 @@
package org.jetbrains.dokka.gradle
+import org.gradle.api.tasks.CacheableTask
import org.jetbrains.dokka.DokkaConfigurationImpl
+@CacheableTask
abstract class DokkaCollectorTask : AbstractDokkaParentTask() {
override fun generateDocumentation() {
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt
index b0683204..de503476 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt
@@ -14,9 +14,11 @@ typealias DokkaMultimoduleTask = DokkaMultiModuleTask
private typealias TaskPath = String
+@CacheableTask
abstract class DokkaMultiModuleTask : AbstractDokkaParentTask() {
@InputFiles
@Optional
+ @PathSensitive(PathSensitivity.RELATIVE)
val includes: ConfigurableFileCollection = project.files()
@Internal
@@ -24,6 +26,7 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask() {
.safeConvention(DokkaMultiModuleFileLayout.CompactInParent)
@get:InputFiles
+ @get:PathSensitive(PathSensitivity.RELATIVE)
internal val sourceChildOutputDirectories: Iterable<File>
get() = childDokkaTasks.map { task -> task.outputDirectory.getSafe() }
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index 682b2591..6bb946c3 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -2,7 +2,9 @@ package org.jetbrains.dokka.gradle
import org.jetbrains.dokka.DokkaConfigurationImpl
import org.jetbrains.dokka.build
+import org.gradle.api.tasks.*
+@CacheableTask
abstract class DokkaTask : AbstractDokkaLeafTask() {
override fun buildDokkaConfiguration(): DokkaConfigurationImpl =
DokkaConfigurationImpl(
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt
index ce779c99..eaee68a2 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTaskPartial.kt
@@ -2,7 +2,9 @@ package org.jetbrains.dokka.gradle
import org.jetbrains.dokka.DokkaConfigurationImpl
import org.jetbrains.dokka.build
+import org.gradle.api.tasks.*
+@CacheableTask
abstract class DokkaTaskPartial : AbstractDokkaLeafTask() {
override fun buildDokkaConfiguration(): DokkaConfigurationImpl {
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt
index 70d84dc4..de8eed77 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilder.kt
@@ -38,6 +38,7 @@ open class GradleDokkaSourceSetBuilder(
val displayName: Property<String?> = project.objects.safeProperty()
@InputFiles
+ @PathSensitive(PathSensitivity.RELATIVE)
val sourceRoots: ConfigurableFileCollection = project.objects.fileCollection()
@Input
@@ -46,10 +47,12 @@ open class GradleDokkaSourceSetBuilder(
@InputFiles
@Optional
+ @PathSensitive(PathSensitivity.RELATIVE)
val samples: ConfigurableFileCollection = project.files()
@InputFiles
@Optional
+ @PathSensitive(PathSensitivity.RELATIVE)
val includes: ConfigurableFileCollection = project.files()
@Input
@@ -111,6 +114,7 @@ open class GradleDokkaSourceSetBuilder(
.safeConvention(false)
@InputFiles
+ @PathSensitive(PathSensitivity.RELATIVE)
val suppressedFiles: ConfigurableFileCollection = project.files()
@Input
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt
index e84bfd2c..6dec5f89 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt
@@ -2,9 +2,7 @@ package org.jetbrains.dokka.gradle
import org.gradle.api.Project
import org.gradle.api.provider.Property
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.Internal
-import org.gradle.api.tasks.Optional
+import org.gradle.api.tasks.*
import org.jetbrains.dokka.DokkaConfigurationBuilder
import org.jetbrains.dokka.SourceLinkDefinitionImpl
import java.io.File
@@ -14,7 +12,8 @@ class GradleSourceLinkBuilder(
@Transient @get:Internal internal val project: Project
) : DokkaConfigurationBuilder<SourceLinkDefinitionImpl> {
- @Input
+ @InputDirectory
+ @PathSensitive(PathSensitivity.RELATIVE)
val localDirectory: Property<File?> = project.objects.safeProperty()
@Input