solonovamax
10/16/2024, 5:01 AMDokkaSourceSetSpec.suppressedFiles
(and tbh DokkaSourceSetSpec.includes
and DokkaSourceSetSpec.samples
as well) should be ConfigurableFileTree
instead of ConfigurableFileCollection
I mention this in this issue I made: https://github.com/Kotlin/dokka/issues/3863Adam Semenenko
10/16/2024, 7:35 AMincludes
?
//includes.from(file("dokka"))
includes.from(fileTree("dokka"))
Does that produce the result you need?solonovamax
10/16/2024, 7:05 PMfileTree()
did not work, as I was using something roughly similar to:
val processDokkaIncludes by tasks.registering(ProcessResources::class) {
into(TODO("output"))
from(TODO("input")) {
expand("replacement" to "result")
}
}
dokka {
dokkaSourceSets.configureEach {
includes.from(processDokkaIncludes)
}
}
here, from(processDokkaIncludes)
resolves to grabbing the output directory of the processDokkaIncludes
task
so, the PR I submitted will properly resolve this, whereas fileTree(processDokkaIncludes)
results in an error. the docs indicate that fileTree()
will resolve files the same as file()
, which does not resolve tasks.
however, I did just check the docs for ConfigurableFileTree
and it seems that it also resolves its from()
argument the same as file()
, whereas ConfigurableFileCollection
will resolve its from()
argument according to files()
(note: the "s" at the end), which does resolve tasks.
so, perhaps the best way to do this might instead be to use a CopySpec
, for which Project.copySpec
exists.
also, since the input to the includes/etc. is transformed using .files
, I don't think that it will actually run the tasks providing the files if not explicitly added to the dependsOn
for a given task, whereas if CopySpec
were used and added as an @Input
on the gradle task, it would run the dependant tasks (edit: I checked, and it is not preserving the task dependencies properly, when extra transforms are applied such as includes.from(fileTree(processDokkaIncludes.map { it.destinationDir }))
, however if you are only doing includes.from(processDokkaIncludes)
, then it will preserve task dependencies.solonovamax
10/16/2024, 7:06 PMincludes.from(fileTree(processDokkaIncludes.map { it.destinationDir }))
as file()
will resolve a Provider<File>
solonovamax
10/16/2024, 7:08 PM.asFileTree.files
instead of .files
in the DokkaSourceSetBuilder
is a good intermediary fix, until a better class instead of ConfigurableFileCollection
can be used.solonovamax
10/18/2024, 1:22 AMCopySpec
instead might be a good idea, tbh
especially since it allows users to process the inputs to all of those without having to create a dedicated task for itAdam Semenenko
10/21/2024, 2:20 PMI checked, and it is not preserving the task dependencies properly, when extra transforms are applied such asYeah, unfortunately that will make Gradle forget about the task dependency. What about if you put the,includes.from(fileTree(processDokkaIncludes.map { it.destinationDir }))
fileTree()
inside the map {}
though?
includes.from(processDokkaIncludes.map { fileTree(it.destinationDir) })
Adam Semenenko
10/21/2024, 2:35 PMI think that making it aFrom memory, CopySpec has problems when it's used as part of a plugin's DSL. It's difficult to instantiate, and IIRC it introduces problems with Configuration Cache. I think you could try creating an instance of a CopySpec in your buildscript though, and passing it toinstead might be a good ideaCopySpec
includes
.solonovamax
10/25/2024, 1:06 AMWhat about if you put the99% sure that would not make a differenceinside thefileTree()
though?map {}
solonovamax
10/25/2024, 1:07 AMIt's difficult to instantiatefor instantiating it, you can just do
Project.copySpec
, actually (found this while looking at things for this plugin)
which is why I suggested itsolonovamax
10/25/2024, 1:08 AMincludes
a CopySpec
rather than a ConfigurableFileCollection