Add projectSpecificSources back to the DackkaPlugin#4110
Conversation
Size Report 1Affected ProductsNo changes between base commit (607dafc) and merge commit (8354df8).Test Logs
|
Coverage Report 1Affected Products
Test Logs
|
buildSrc/src/main/java/com/google/firebase/gradle/plugins/DackkaPlugin.kt
Show resolved
Hide resolved
buildSrc/src/main/java/com/google/firebase/gradle/plugins/DackkaPlugin.kt
Show resolved
Hide resolved
buildSrc/src/main/java/com/google/firebase/gradle/plugins/ProjectUtils.kt
Show resolved
Hide resolved
| 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) dependsOnAndMustRunAfter(docStubs) |
There was a problem hiding this comment.
isn't it cleaner to wire this dependency up via javaSources.set(docStubs.flatMap { it.output })?
There was a problem hiding this comment.
Yeah, but you'd be invoking docStubs for kotlin modules as well.
There was a problem hiding this comment.
sure, but it can be conditional right?
javaSources.set(if(isKotlin) sourcesForJava else docStubs.flatMap { it.output })There was a problem hiding this comment.
Sure, but I would argue that's less readable. Especially when all the other inputs are being defined in their own variables for readability. Because under that practice, we could restructure this section to this:
docsTask.configure {
if (!isKotlin) dependsOnAndMustRunAfter(docStubs)
javaSources.set(if (!isKotlin) listOf(project.docStubs) else sourcesForJava)
suppressedFiles.set(projectSpecificSuppressedFiles(project))
packageListFiles.set(fetchPackageLists(project))
kotlinSources.set(projectSpecificSources(project))
dependencies.set(classpath)
applyCommonConfigurations()
}which I would argue is less readable than this:
docsTask.configure {
if (!isKotlin) dependsOnAndMustRunAfter(docStubs)
val sourcesForKotlin = emptyList<File>() + projectSpecificSources(project)
val packageLists = fetchPackageLists(project)
val excludedFiles = projectSpecificSuppressedFiles(project)
val fixedJavaSources = if (!isKotlin) listOf(project.docStubs) else sourcesForJava
javaSources.set(fixedJavaSources)
suppressedFiles.set(excludedFiles)
packageListFiles.set(packageLists)
kotlinSources.set(sourcesForKotlin)
dependencies.set(classpath)
applyCommonConfigurations()
}But if you feel strongly about inlining it, I'm comfortable with it.
* Added extra method for TaskProviders * Added specificSources method back * Revert to dependsOn for docstubs dep
This fixes: b/246972998
Removing
projectSpecificSourceswas an over-sight, and led tocom.google.firebase.Timestampnot being generated during doc generation. Adding the method back fixes this.Additionally, I removed the
isKotlincheck forexcludedFilesas it was redundant (since the method checks for a specific project, it would be ignored when needed as a by-product).I also added an additional util method for
dependsOnAndMustRunAfterand changed ourdependsOn(docStubs)as such. We needdocStubsto run beforegenerateDackkaDocumentation, and not havingmustRunAfterwas leading to not-so-fun gradle "optimizations".And some restructuring for readability and consistency :')