Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions firebase-dataconnect/firebase-dataconnect.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ firebaseLibrary {
libraryGroup = "dataconnect"
testLab.enabled = false
publishJavadoc = true
onlyPublishKotlindoc = true
releaseNotes {
name.set("{{data_connect_short}}")
versionName.set("data-connect")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ abstract class BaseFirebaseLibraryPlugin : Plugin<Project> {
project.gradle.sharedServices.registerIfAbsent<GMavenService, _>("gmaven")
previewMode.convention("")
publishJavadoc.convention(true)
onlyPublishKotlindoc.convention(false)
artifactId.convention(project.name)
groupId.convention(project.provider { project.group.toString() })
libraryGroup.convention(artifactId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ data class ExternalDocumentationLink(val packageList: File, val externalLink: St
abstract class GenerateDocumentationTask
@Inject
constructor(private val workerExecutor: WorkerExecutor) : GenerateDocumentationTaskExtension() {
@get:Input abstract val kotlindocOnly: Property<Boolean>

@TaskAction
fun build() {
Expand All @@ -120,7 +121,8 @@ constructor(private val workerExecutor: WorkerExecutor) : GenerateDocumentationT
"java.lang.Override",
)
val annotationsNotToDisplayKotlin = listOf("kotlin.ExtensionFunctionType")

// A null path disables javadoc generation
val javadoc: String? = "android".takeUnless { kotlindocOnly.get() }
val jsonMap =
mapOf(
"moduleName" to "",
Expand Down Expand Up @@ -152,7 +154,7 @@ constructor(private val workerExecutor: WorkerExecutor) : GenerateDocumentationT
JSONObject(
mapOf(
"docRootPath" to "/docs/reference/",
"javaDocsPath" to "android",
"javaDocsPath" to javadoc,
"kotlinDocsPath" to "kotlin",
"projectPath" to "client/${clientName.get()}",
"includedHeadTagsPathJava" to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ abstract class DackkaPlugin : Plugin<Project> {
// TODO(b/270576405): remove afterEvalutate after fixed
project.afterEvaluate {
if (weShouldPublish(this)) {
val generateDocumentation = registerGenerateDackkaDocumentationTask(project)
val kdocOnly = publishKotlindocOnly(this)
val generateDocumentation = registerGenerateDackkaDocumentationTask(project, kdocOnly)

val outputDir = generateDocumentation.flatMap { it.outputDirectory }

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

/**
* Checks if the [Project] should only release Kotlindocs
*
* This is done via the [FirebaseLibraryExtension.onlyPublishKotlindoc] property.
*/
private fun publishKotlindocOnly(project: Project) =
project.firebaseLibrary.onlyPublishKotlindoc.get()

/**
* Applies common configuration to the [javadocConfig], that is otherwise not present.
*
Expand All @@ -168,9 +177,11 @@ abstract class DackkaPlugin : Plugin<Project> {
}

private fun registerGenerateDackkaDocumentationTask(
project: Project
project: Project,
kotlindocOnly: Boolean,
): TaskProvider<GenerateDocumentationTask> =
project.tasks.register<GenerateDocumentationTask>("generateDackkaDocumentation") {
this.kotlindocOnly.set(kotlindocOnly)
with(project.extensions.getByType<LibraryExtension>()) {
libraryVariants.all {
if (name == "release") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ constructor(val project: Project, val type: LibraryType) {
*/
abstract val publishJavadoc: Property<Boolean>

/**
* Only publish Kotlindocs instead of also publishing Javadocs for this library.
*
* This property is only effective when `publishJavadoc` is `true`.
*
* Defaults to `false`.
*
* ```sh
* ./gradlew :firebase-common:kotlindoc
* ```
*
* @see [FirebaseLibraryExtension]
* @see publishJavadoc
*/
abstract val onlyPublishKotlindoc: Property<Boolean>

/**
* Indicates the library is in a preview mode (such as `alpha` or `beta`).
*
Expand Down
Loading