Skip to content

Commit

Permalink
Fix configuration for suppressing obvious functions (#1789)
Browse files Browse the repository at this point in the history
* Fix suppressObviousFunctions not being present in task configuration

* Docs
  • Loading branch information
MarcinAman authored Mar 26, 2021
1 parent 8166370 commit 4ddaafb
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/src/doc/docs/user_guide/cli/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Dokka supports the following command line arguments:
* `-globalPackageOptions` - per package options added to all source sets
* `-globalLinks` - external documentation links added to all source sets
* `-globalSrcLink` - source links added to all source sets
* `-noSuppressObviousFunctions` - don't suppress obvious functions like default `toString` or `equals`
* `-sourceSet` - (repeatable) - configuration for a single source set. Following this argument, you can pass other arguments:
* `-sourceSetName` - source set name as a part of source set ID when declaring dependent source sets
* `-displayName` - source set name displayed in the generated documentation
Expand Down
4 changes: 4 additions & 0 deletions docs/src/doc/docs/user_guide/gradle/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ dokkaHtml {
// to enable package-list caching
// When this is set to default, caches are stored in $USER_HOME/.cache/dokka
cacheRoot.set(file("default"))

// Suppress obvious functions like default toString or equals. Defaults to true
suppressObviousFunctions.set(false)

dokkaSourceSets {
configureEach { // Or source set name, for single-platform the default source sets are `main` and `test`

Expand Down
5 changes: 4 additions & 1 deletion docs/src/doc/docs/user_guide/maven/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ The available configuration options are shown below:
<samples>
<dir>src/test/samples</dir>
</samples>


<!-- Suppress obvious functions like default toString or equals. Defaults to true -->
<suppressObviousFunctions>false</suppressObviousFunctions>

<!-- Used for linking to JDK, default: 6 -->
<jdkVersion>6</jdkVersion>

Expand Down
2 changes: 2 additions & 0 deletions integration-tests/gradle/projects/it-basic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ tasks.withType<DokkaTask> {
kotlinSourceSet(kotlin.sourceSets["test"])
}
}
suppressObviousFunctions.set(false)

pluginsMapConfiguration.set(mapOf(DokkaBase::class.qualifiedName to """{ "customStyleSheets": ["${file("customResources/logo-styles.css")}", "${file("customResources/custom-style-to-add.css")}"], "customAssets" : ["${file("customResources/custom-resource.svg")}"] }"""))
}
2 changes: 2 additions & 0 deletions integration-tests/maven/projects/it-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@
<!-- Disable linking to online JDK documentation -->
<noJdkLink>false</noJdkLink>

<suppressObviousFunctions>false</suppressObviousFunctions>

<!-- Allows to customize documentation generation options on a per-package basis -->
<perPackageOptions>
<packageOptions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ abstract class AbstractDokkaTask : DefaultTask() {
val failOnWarning: Property<Boolean> = project.objects.safeProperty<Boolean>()
.safeConvention(DokkaDefaults.failOnWarning)

@Input
val suppressObviousFunctions: Property<Boolean> = project.objects.safeProperty<Boolean>()
.safeConvention(DokkaDefaults.suppressObviousFunctions)

@Input
val offlineMode: Property<Boolean> = project.objects.safeProperty<Boolean>()
.safeConvention(DokkaDefaults.offlineMode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ abstract class DokkaTask : AbstractDokkaTask() {
failOnWarning = failOnWarning.getSafe(),
sourceSets = unsuppressedSourceSets.build(),
pluginsConfiguration = buildPluginsConfiguration(),
pluginsClasspath = plugins.resolve().toList()
pluginsClasspath = plugins.resolve().toList(),
suppressObviousFunctions = suppressObviousFunctions.getSafe(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ abstract class DokkaTaskPartial : AbstractDokkaTask() {
sourceSets = unsuppressedSourceSets.build(),
pluginsConfiguration = buildPluginsConfiguration(),
pluginsClasspath = plugins.resolve().toList(),
delayTemplateSubstitution = true
delayTemplateSubstitution = true,
suppressObviousFunctions = suppressObviousFunctions.getSafe(),
)
}
}
15 changes: 9 additions & 6 deletions runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
@Parameter
var reportUndocumented: Boolean = DokkaDefaults.reportUndocumented

@Parameter
var impliedPlatforms: List<String> = emptyList()

@Parameter
var perPackageOptions: List<PackageOptions> = emptyList()

Expand Down Expand Up @@ -159,6 +156,9 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
@Parameter
var failOnWarning: Boolean = DokkaDefaults.failOnWarning

@Parameter(defaultValue = "${DokkaDefaults.suppressObviousFunctions}")
var suppressObviousFunctions: Boolean = DokkaDefaults.suppressObviousFunctions

@Parameter
var dokkaPlugins: List<Dependency> = emptyList()
get() = field + defaultDokkaPlugins
Expand Down Expand Up @@ -216,7 +216,7 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
noStdlibLink = noStdlibLink,
noJdkLink = noJdkLink,
suppressedFiles = suppressedFiles.map(::File).toSet(),
analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT
analysisPlatform = if (platform.isNotEmpty()) Platform.fromString(platform) else Platform.DEFAULT,
).let {
it.copy(
externalDocumentationLinks = defaultLinks(it) + it.externalDocumentationLinks
Expand Down Expand Up @@ -247,6 +247,7 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
pluginsConfiguration = pluginsConfiguration.toMutableList(),
modules = emptyList(),
failOnWarning = failOnWarning,
suppressObviousFunctions = suppressObviousFunctions,
)

val gen = DokkaGenerator(configuration, logger)
Expand All @@ -270,8 +271,10 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
servers = session!!.request.servers
mirrors = session!!.request.mirrors
proxies = session!!.request.proxies
artifact = DefaultArtifact(groupId, artifactId, version, "compile", "jar", null,
DefaultArtifactHandler("jar"))
artifact = DefaultArtifact(
groupId, artifactId, version, "compile", "jar", null,
DefaultArtifactHandler("jar")
)
}

log.debug("Resolving $groupId:$artifactId:$version ...")
Expand Down

0 comments on commit 4ddaafb

Please sign in to comment.