Skip to content

Commit e845dac

Browse files
committed
Remove argument configuration
1 parent 0eaec93 commit e845dac

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

plugins/src/main/java/com/google/firebase/gradle/plugins/DackkaGenerationTask.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package com.google.firebase.gradle.plugins
1919
import java.io.File
2020
import javax.inject.Inject
2121
import org.gradle.api.DefaultTask
22+
import org.gradle.api.Project
2223
import org.gradle.api.file.FileCollection
2324
import org.gradle.api.file.RegularFileProperty
2425
import org.gradle.api.provider.ListProperty
@@ -98,7 +99,6 @@ data class ExternalDocumentationLink(val packageList: File, val externalLink: St
9899
abstract class GenerateDocumentationTask
99100
@Inject
100101
constructor(private val workerExecutor: WorkerExecutor) : GenerateDocumentationTaskExtension() {
101-
@get:Input abstract val kotlindocOnly: Property<Boolean>
102102

103103
@TaskAction
104104
fun build() {
@@ -122,7 +122,7 @@ constructor(private val workerExecutor: WorkerExecutor) : GenerateDocumentationT
122122
)
123123
val annotationsNotToDisplayKotlin = listOf("kotlin.ExtensionFunctionType")
124124
// A null path disables javadoc generation
125-
val javadoc: String? = "android".takeUnless { kotlindocOnly.get() }
125+
val javadocPath: String? = "android".takeUnless { publishKotlindocOnly(project) }
126126
val jsonMap =
127127
mapOf(
128128
"moduleName" to "",
@@ -154,7 +154,7 @@ constructor(private val workerExecutor: WorkerExecutor) : GenerateDocumentationT
154154
JSONObject(
155155
mapOf(
156156
"docRootPath" to "/docs/reference/",
157-
"javaDocsPath" to javadoc,
157+
"javaDocsPath" to javadocPath,
158158
"kotlinDocsPath" to "kotlin",
159159
"projectPath" to "client/${clientName.get()}",
160160
"includedHeadTagsPathJava" to
@@ -173,6 +173,14 @@ constructor(private val workerExecutor: WorkerExecutor) : GenerateDocumentationT
173173
return JSONObject(jsonMap)
174174
}
175175

176+
/**
177+
* Checks if the [Project] should only release Kotlindocs
178+
*
179+
* This is done via the [FirebaseLibraryExtension.onlyPublishKotlindoc] property.
180+
*/
181+
private fun publishKotlindocOnly(project: Project) =
182+
project.firebaseLibrary.onlyPublishKotlindoc.get()
183+
176184
private fun createExternalLinks(
177185
packageLists: ListProperty<File>
178186
): List<ExternalDocumentationLink> {

plugins/src/main/java/com/google/firebase/gradle/plugins/DackkaPlugin.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ abstract class DackkaPlugin : Plugin<Project> {
123123
// TODO(b/270576405): remove afterEvalutate after fixed
124124
project.afterEvaluate {
125125
if (weShouldPublish(this)) {
126-
val kdocOnly = publishKotlindocOnly(this)
127-
val generateDocumentation = registerGenerateDackkaDocumentationTask(project, kdocOnly)
126+
val generateDocumentation = registerGenerateDackkaDocumentationTask(project)
128127

129128
val outputDir = generateDocumentation.flatMap { it.outputDirectory }
130129

@@ -154,14 +153,6 @@ abstract class DackkaPlugin : Plugin<Project> {
154153
*/
155154
private fun weShouldPublish(project: Project) = project.firebaseLibrary.publishJavadoc.get()
156155

157-
/**
158-
* Checks if the [Project] should only release Kotlindocs
159-
*
160-
* This is done via the [FirebaseLibraryExtension.onlyPublishKotlindoc] property.
161-
*/
162-
private fun publishKotlindocOnly(project: Project) =
163-
project.firebaseLibrary.onlyPublishKotlindoc.get()
164-
165156
/**
166157
* Applies common configuration to the [javadocConfig], that is otherwise not present.
167158
*
@@ -177,11 +168,9 @@ abstract class DackkaPlugin : Plugin<Project> {
177168
}
178169

179170
private fun registerGenerateDackkaDocumentationTask(
180-
project: Project,
181-
kotlindocOnly: Boolean,
171+
project: Project
182172
): TaskProvider<GenerateDocumentationTask> =
183173
project.tasks.register<GenerateDocumentationTask>("generateDackkaDocumentation") {
184-
this.kotlindocOnly.set(kotlindocOnly)
185174
with(project.extensions.getByType<LibraryExtension>()) {
186175
libraryVariants.all {
187176
if (name == "release") {

0 commit comments

Comments
 (0)