Skip to content

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

Merged
merged 3 commits into from
Sep 19, 2022

Conversation

daymxn
Copy link
Member

@daymxn daymxn commented Sep 15, 2022

This fixes: b/246972998

Removing projectSpecificSources was an over-sight, and led to com.google.firebase.Timestamp not being generated during doc generation. Adding the method back fixes this.

Additionally, I removed the isKotlin check for excludedFiles 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 our dependsOn(docStubs) as such. We need docStubs to run before generateDackkaDocumentation, and not having mustRunAfter was leading to not-so-fun gradle "optimizations".

And some restructuring for readability and consistency :')

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2022

buildSrc Test Results

18 tests   18 ✔️  3m 9s ⏱️
  4 suites    0 💤
  4 files      0

Results for commit 05d1108.

♻️ This comment has been updated with latest results.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 15, 2022

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2022

Unit Test Results

   394 files  +   343     394 suites  +343   17m 13s ⏱️ + 15m 27s
4 713 tests +3 741  4 691 ✔️ +3 719  22 💤 +22  0 ±0 
4 729 runs  +3 757  4 707 ✔️ +3 735  22 💤 +22  0 ±0 

Results for commit 05d1108. ± Comparison against base commit 6df92b9.

♻️ This comment has been updated with latest results.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 15, 2022

Coverage Report 1

Affected Products

  • firebase-database

    Overall coverage changed from 50.21% (607dafc) to 50.18% (8354df8) by -0.03%.

    FilenameBase (607dafc)Merge (8354df8)Diff
    DefaultPersistenceManager.java74.76%75.73%+0.97%
    WebsocketConnection.java35.03%32.77%-2.26%

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/YhkfFDHE6p.html

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)
Copy link
Member

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 })?

Copy link
Member Author

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.

Copy link
Member

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 })

Copy link
Member Author

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.

@daymxn daymxn requested a review from vkryachko September 19, 2022 19:11
@daymxn daymxn merged commit 65356d8 into master Sep 19, 2022
@daymxn daymxn deleted the daymon-fix-timestamp-not-generating branch September 19, 2022 19:21
qdpham13 pushed a commit that referenced this pull request Sep 20, 2022
* Added extra method for TaskProviders

* Added specificSources method back

* Revert to dependsOn for docstubs dep
@firebase firebase locked and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants