-
Notifications
You must be signed in to change notification settings - Fork 617
Add projectSpecificSources back to the DackkaPlugin #4110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it cleaner to wire this dependency up via javaSources.set(docStubs.flatMap { it.output })
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but you'd be invoking docStubs for kotlin
modules as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, but it can be conditional right?
javaSources.set(if(isKotlin) sourcesForJava else docStubs.flatMap { it.output })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
projectSpecificSources
was an over-sight, and led tocom.google.firebase.Timestamp
not being generated during doc generation. Adding the method back fixes this.Additionally, I removed the
isKotlin
check forexcludedFiles
as 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
dependsOnAndMustRunAfter
and changed ourdependsOn(docStubs)
as such. We needdocStubs
to run beforegenerateDackkaDocumentation
, and not havingmustRunAfter
was leading to not-so-fun gradle "optimizations".And some restructuring for readability and consistency :')