aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat@beresnev.me>2021-12-23 14:32:18 +0300
committerGitHub <noreply@github.com>2021-12-23 14:32:18 +0300
commitbfd41ce2a0d43419a671961c19b7d755cffdcfc8 (patch)
tree00d1fcd75ff7c25de20c8b0621e3bfb11cd3f61a /runners/gradle-plugin
parent5c98d42ec08ca1413f920e4f5dde28d330e8837a (diff)
downloaddokka-bfd41ce2a0d43419a671961c19b7d755cffdcfc8.tar.gz
dokka-bfd41ce2a0d43419a671961c19b7d755cffdcfc8.tar.bz2
dokka-bfd41ce2a0d43419a671961c19b7d755cffdcfc8.zip
Introduce documentedVisibilities setting (#2270)
* Introduce `documentedVisibilities` setting * Remove hardcoded doc generation for Visibility.PUBLIC, correct tests * Add maven, gradle and cli integration tests for documentedVisibilities * Fix maven plugin configuration overriding the default value * Remove test debug prints * Correct an inconsistency with default values and leave a comment of intentions * Add a test for visibility of private setter
Diffstat (limited to 'runners/gradle-plugin')
-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/GradlePackageOptionsBuilder.kt8
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt1
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt1
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt1
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt17
6 files changed, 32 insertions, 0 deletions
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 de8eed77..abaa2536 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
@@ -60,6 +60,10 @@ open class GradleDokkaSourceSetBuilder(
.safeConvention(DokkaDefaults.includeNonPublic)
@Input
+ val documentedVisibilities: SetProperty<DokkaConfiguration.Visibility> = project.objects.setProperty<DokkaConfiguration.Visibility>()
+ .convention(DokkaDefaults.documentedVisibilities)
+
+ @Input
val reportUndocumented: Property<Boolean> = project.objects.safeProperty<Boolean>()
.safeConvention(DokkaDefaults.reportUndocumented)
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
index 9b6108b8..f15a6462 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
@@ -4,8 +4,11 @@ package org.jetbrains.dokka.gradle
import org.gradle.api.Project
import org.gradle.api.provider.Property
+import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
+import org.gradle.kotlin.dsl.setProperty
+import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.DokkaConfigurationBuilder
import org.jetbrains.dokka.DokkaDefaults
import org.jetbrains.dokka.PackageOptionsImpl
@@ -23,6 +26,10 @@ class GradlePackageOptionsBuilder(
.safeConvention(DokkaDefaults.includeNonPublic)
@Input
+ val documentedVisibilities: SetProperty<DokkaConfiguration.Visibility> = project.objects.setProperty<DokkaConfiguration.Visibility>()
+ .convention(DokkaDefaults.documentedVisibilities)
+
+ @Input
val reportUndocumented: Property<Boolean> = project.objects.safeProperty<Boolean>()
.safeConvention(DokkaDefaults.reportUndocumented)
@@ -37,6 +44,7 @@ class GradlePackageOptionsBuilder(
override fun build(): PackageOptionsImpl = PackageOptionsImpl(
matchingRegex = checkNotNull(matchingRegex.getSafe()) { "prefix not specified" },
includeNonPublic = includeNonPublic.getSafe(),
+ documentedVisibilities = documentedVisibilities.getSafe(),
reportUndocumented = reportUndocumented.getSafe(),
skipDeprecated = skipDeprecated.getSafe(),
suppress = suppress.getSafe()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
index 74e3d16d..56c3f071 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
@@ -13,6 +13,7 @@ internal fun GradleDokkaSourceSetBuilder.toDokkaSourceSetImpl(): DokkaSourceSetI
samples = samples.toSet(),
includes = includes.toSet(),
includeNonPublic = includeNonPublic.getSafe(),
+ documentedVisibilities = documentedVisibilities.getSafe(),
reportUndocumented = reportUndocumented.getSafe(),
skipEmptyPackages = skipEmptyPackages.getSafe(),
skipDeprecated = skipDeprecated.getSafe(),
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt
index 68506876..877d3b37 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationJsonTest.kt
@@ -39,6 +39,7 @@ class DokkaConfigurationJsonTest {
packageOption.includeNonPublic by true
packageOption.reportUndocumented by true
packageOption.skipDeprecated by true
+ packageOption.documentedVisibilities by setOf(DokkaConfiguration.Visibility.PRIVATE)
}
}
}
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt
index 2887f957..811f7736 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaConfigurationSerializableTest.kt
@@ -48,6 +48,7 @@ class DokkaConfigurationSerializableTest {
packageOption.includeNonPublic by true
packageOption.reportUndocumented by true
packageOption.skipDeprecated by true
+ packageOption.documentedVisibilities by setOf(DokkaConfiguration.Visibility.PRIVATE)
}
}
}
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt
index 6216b5d7..949e4949 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/GradleDokkaSourceSetBuilderTest.kt
@@ -163,6 +163,22 @@ class GradleDokkaSourceSetBuilderTest {
}
@Test
+ fun documentedVisibilities() {
+ val sourceSet = GradleDokkaSourceSetBuilder("", project)
+ assertEquals(
+ DokkaDefaults.documentedVisibilities, sourceSet.build().documentedVisibilities,
+ "Expected default value for ${GradleDokkaSourceSetBuilder::documentedVisibilities.name}"
+ )
+
+ val visibilities = setOf(DokkaConfiguration.Visibility.PRIVATE, DokkaConfiguration.Visibility.INTERNAL)
+ sourceSet.documentedVisibilities.set(visibilities)
+ assertEquals(
+ visibilities, sourceSet.build().documentedVisibilities,
+ "Expected to see previously set value for ${GradleDokkaSourceSetBuilder::includeNonPublic.name}"
+ )
+ }
+
+ @Test
fun reportUndocumented() {
val sourceSet = GradleDokkaSourceSetBuilder("", project)
assertEquals(
@@ -261,6 +277,7 @@ class GradleDokkaSourceSetBuilderTest {
PackageOptionsImpl(
matchingRegex = matchingRegex,
includeNonPublic = DokkaDefaults.includeNonPublic,
+ documentedVisibilities = DokkaDefaults.documentedVisibilities,
reportUndocumented = DokkaDefaults.reportUndocumented,
skipDeprecated = DokkaDefaults.skipDeprecated,
suppress = DokkaDefaults.suppress