-
Notifications
You must be signed in to change notification settings - Fork 410
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
Fix compatibility with Gradle's configuration cache #2499
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import groovy.lang.Closure | |
import org.gradle.api.Action | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.Task | ||
import org.gradle.api.artifacts.Configuration | ||
import org.gradle.api.file.ConfigurableFileCollection | ||
import org.gradle.api.plugins.JavaBasePlugin | ||
import org.gradle.api.provider.ListProperty | ||
import org.gradle.api.provider.MapProperty | ||
|
@@ -76,10 +76,10 @@ abstract class AbstractDokkaTask : DefaultTask() { | |
} | ||
|
||
@Classpath | ||
val plugins: Configuration = project.maybeCreateDokkaPluginConfiguration(name) | ||
val plugins: ConfigurableFileCollection = project.objects.fileCollection() | ||
|
||
@Classpath | ||
val runtime: Configuration = project.maybeCreateDokkaRuntimeConfiguration(name) | ||
val runtime: ConfigurableFileCollection = project.objects.fileCollection() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
|
||
final override fun doFirst(action: Action<in Task>): Task = super.doFirst(action) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package org.jetbrains.dokka.gradle | ||
|
||
import org.gradle.kotlin.dsl.create | ||
import org.gradle.kotlin.dsl.repositories | ||
import org.gradle.kotlin.dsl.withType | ||
import org.gradle.testfixtures.ProjectBuilder | ||
import org.jetbrains.dokka.DokkaConfigurationImpl | ||
|
@@ -21,8 +22,9 @@ class DokkaCollectorTaskTest { | |
|
||
rootProject.allprojects { project -> | ||
project.plugins.apply("org.jetbrains.dokka") | ||
project.tasks.withType<AbstractDokkaTask>().configureEach { task -> | ||
task.plugins.withDependencies { dependencies -> dependencies.clear() } | ||
project.repositories { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the context for this change? I'd leave a comment why we are adding mavenLocal here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add a comment once I have guidance on what's preferred in terms of setting up the test environment with access to the required dokka dependencies and put that in place - I tried to hint at this in the PR description:
I'm not aware of any standard pattern for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Maven Local can work, but isn't great because it's possible for other dependencies to get picked up as well, and it's not easy to clean out old dependencies. A custom local file repository has significant drawback: when publishing a SNAPSHOT version, Gradle will always publish a new artifact. This is slow, and causes the local dir to grow in size when working locally, which is annoying. Anyway, I'm working on a Gradle Plugin for solving this problem, if you'd like to take a look (though it's still awaiting approval in the Plugin Portal). It will publish to a local directory, but I added some caching to prevent SNAPSHOT spam, and utilities for depending on other subprojects. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aSemy what if we start by publishing the artifacts to MavenLocal to unblock this PR and release it in 1.8.20? Once your plugin is ready, would you be able to substitute the MavenLocal publishing with it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm personally fine with publishing it to Maven Local or to a custom local file repository, doesn't seem like we have a better alternative anyway, and having the configuration cache support is I think more important So I think we can take this way for now 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah for sure, Maven Local will work, just be aware that it might cause some unexpected problems and the solution is usually 'clear Dokka artifacts from Maven Local' |
||
mavenLocal() | ||
mavenCentral() | ||
} | ||
project.tasks.withType<DokkaTask>().configureEach { task -> | ||
task.dokkaSourceSets.configureEach { sourceSet -> | ||
|
@@ -56,7 +58,7 @@ class DokkaCollectorTaskTest { | |
.map { it.sourceSets } | ||
.reduce { acc, list -> acc + list }, | ||
pluginsClasspath = task.childDokkaTasks | ||
.map { it.plugins.resolve().toList() } | ||
.map { it.plugins.toList() } | ||
.reduce { acc, mutableSet -> acc + mutableSet } | ||
), | ||
dokkaConfiguration | ||
|
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.
You can drop explicit initialization, just make this
abstract val plugins: ConfigurableFileCollection
and Gradle will initialize this for you.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.
Thanks, I'm aware, I just left it as it currently is to align with the rest of the parameters which still use manual initialisation.