-
Notifications
You must be signed in to change notification settings - Fork 415
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
Remove the dependency on internal Gradle API #2822
Comments
For This internal storage of child tasks is used in cases when the list of all dependency tasks is requested with the We can eliminate the logic and replace the internal storage with
|
This is related to #2700 Currently the Dokka Gradle plugin uses task references to access generated docs between subprojects, which is not recommended by Gradle
Directly referencing other tasks from other projects causes problems with the Gradle Configuration Cache #2231 and prevents docs aggregation #2612. To migrate to the recommended Gradle method of sharing output between subprojects, the Dokka Gradle Plugin should
Then, the aggregation task can use the consuming configuration as a task input. Gradle will automatically retrieve the docs, and trigger the docs generation tasks as needed. There is a practical example, based on aggregating JaCoCo test reports, in the Gradle docs: https://docs.gradle.org/7.3/samples/sample_jvm_multi_project_with_code_coverage.html |
@aSemy indeed, what you're proposing sounds very reasonable, and would help with the mentioned issues 👍 As you've probably understood by now, we are not Gradle experts and there are many issues with the plugin, so implementing and reviewing it will take time. At the moment I'm concerned by the fact that the internal API can be removed/changed in any release, which can limit our compatibility with the previous/future versions of Gradle. So I'd like to first try to get rid of the internal API by using the stable After that, the more general issue of task reference/dependency can be addressed. I believe there's some discussion about it in #1752 Do you see any problems with this approach or maybe you have some concerns that we don't see? I don't think any of your current PRs cover this problem, right? |
I'm not saying "don't do it", because pragmatically trying to patch the existing setup is less work than trying overhaul it. The critique I have is that replacing an internal API with a misuse of the task dependency API doesn't really help the Dokka Gradle plugin - it's still incompatible with projects that follow the Gradle spec. I want to use it, but I can't.
All of the Gradle Plugin PRs have been building up to fixing this :) |
For sure, it's not meant to be a replacement for the proper fix. Replacing |
@aSemy we have a question, maybe you can help us and explain what the proper way of doing it is
When it's refactored the proper way with Configurations, I understand that it will be impossible to support these methods ( If we'll have to delete them, it might break some user projects, for instance in this case. So we want to deprecate these methods now with warning, to give people time to migrate. But we don't know what solution to propose instead. Or is there none? How is this situation usually handled the idiomatic way? |
Yes, That makes sense, so if a quick-fix works for now then go for it. Although the Dokka Gradle plugin shouldn't be so closely tied to the Dokka generator version. Currently the Dokka Gradle plugin is in lock-step with the Dokka project, but really the Dokka Gradle plugin basically a fancy wrapper to help create the configuration that is supplied to the actual Dokka generator. It's not even like it's a wrapper for the Dokka CLI (which embeds the Dokka generator) - it's a step removed. That's why #2740 is important - it breaks the link between Dokka Gradle Plugin and Dokka Generator. If that's done, then there shouldn't be any problem with quickly releasing a new Dokka Plugin, even if Dokka Generator isn't changed.
Correct... although some overlap might be possible
How it will work is
A similar example for JaCoCo aggregation is available here: https://docs.gradle.org/7.3/samples/sample_jvm_multi_project_with_code_coverage.html I've been trying to develop a new Dokka plugin that works in 'new way'. Here's an example integration test: https://github.com/aSemy/dokka/blob/feat/gradle-plugin-2/runners/gradle-plugin-2/src/testFunctional/kotlin/MultiModuleFunctionalTest.kt. It runs, but there's some problem with the Dokka Generator runtime classpath... The old and new way might be able to work in parallel, and it might be possible to have some compatibility utils. For example, files are added to the val dokkaConfigurationTask by tasks.registering {}
val dokkaConfigurationElements by configurations.registering {
// this configuration is...
isCanBeResolved = false // NOT resolved by the source-project
isCanBeConsumed = true // IS consumed by other projects
// This will cause the dokkaGeneratorTask task to run if the dokkaConfigurationTask requested by the aggregation task
outgoing.artifact(dokkaConfigurationTask.map { task ->
task.dokkaConfigurationFile
})
} This could be wrapped in a function... maybe - I'm unsure about how it will work in practice abstract DokkaConfig {
val dokkaConfiguration: Configuration
fun addChildTask(task: DokkaTask) = dokkaConfiguration.configure { outgoing.artifact(task.map {...}) }
} I don't think it's possible to handle the |
Should be not an issue in Dokka 2.0.0 in Dokka Gradle plugin v2 |
Dokka depends on classes from
org.gradle.api.internal
for which there are no guarantees about backward compatibility and proper deprecation as demonstrated by #2816It looks like
TaskDependencyInternalWithAdditions
can be replaced with Gradle'sdependsOn
for setting up task dependencies.The text was updated successfully, but these errors were encountered: