Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ abstract class DackkaPlugin : Plugin<Project> {
val classpath = compileConfiguration.getJars() + project.javadocConfig.getJars() + project.files(bootClasspath)

val sourcesForJava = sourceSets.flatMap {
// TODO(b/246984444): Investigate why kotlinDirectories includes javaDirectories
it.javaDirectories.map { it.absoluteFile }
}

Expand All @@ -177,13 +178,12 @@ abstract class DackkaPlugin : Plugin<Project> {
}

docsTask.configure {
clientName.set(project.firebaseConfigValue { artifactId })
// this will become useful with the agp upgrade, as they're separate in 7.x+
val sourcesForKotlin = emptyList<File>()
if (!isKotlin) dependsOn(docStubs)

val sourcesForKotlin = emptyList<File>() + projectSpecificSources(project)
val packageLists = fetchPackageLists(project)

if (!isKotlin) dependsOn(docStubs)
val excludedFiles = if (!isKotlin) projectSpecificSuppressedFiles(project) else emptyList()
val excludedFiles = projectSpecificSuppressedFiles(project)
val fixedJavaSources = if (!isKotlin) listOf(project.docStubs) else sourcesForJava

javaSources.set(fixedJavaSources)
Expand All @@ -206,11 +206,20 @@ abstract class DackkaPlugin : Plugin<Project> {
include("**/package-list")
}.toList()

// TODO(b/243534168): Remove when fixed
private fun projectSpecificSources(project: Project) =
when (project.name) {
"firebase-common" -> {
project.project(":firebase-firestore").files("src/main/java/com/google/firebase").toList()
}
else -> emptyList()
}

// TODO(b/243534168): Remove when fixed
private fun projectSpecificSuppressedFiles(project: Project): List<File> =
when (project.name) {
"firebase-common" -> {
project.files("${project.docStubs}/com/google/firebase/firestore").toList()
project.project(":firebase-firestore").files("src/main/java/com/google/firebase/firestore").toList()
}
"firebase-firestore" -> {
project.files("${project.docStubs}/com/google/firebase/Timestamp.java").toList()
Expand All @@ -226,6 +235,7 @@ abstract class DackkaPlugin : Plugin<Project> {

dackkaJarFile.set(dackkaFile)
outputDirectory.set(dackkaOutputDirectory)
clientName.set(project.firebaseConfigValue { artifactId })
}

// TODO(b/243833009): Make task cacheable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
import org.gradle.api.attributes.Attribute
import org.gradle.api.provider.Provider

fun Project.isAndroid(): Boolean =
listOf("com.android.application", "com.android.library", "com.android.test")
Expand Down Expand Up @@ -63,6 +64,14 @@ fun <T : Task, R : Task> T.dependsOnAndMustRunAfter(otherTask: R) {
dependsOn(otherTask)
}

/**
* Utility method to call [Task.mustRunAfter] and [Task.dependsOn] on the specified task
*/
fun <T : Task, R : Task> T.dependsOnAndMustRunAfter(otherTask: Provider<R>) {
mustRunAfter(otherTask)
dependsOn(otherTask)
}

/**
* Utility method to call [Task.mustRunAfter] and [Task.dependsOn] on the specified task name
*/
Expand Down