This message was deleted.
# community-support
s
This message was deleted.
v
Most probably not. But if you properly registered the code generation task using something like
srcDir(openApiGenerateTask)
instead of hard-wiring directory paths, you should already have the necessary dependency automatically.
c
mmm
Copy code
sourceSets {
    main {
        java {
            //            srcDir(tasks.named('openApiGenerate'))
            // need to add subfolder instead of root of the task output

            srcDir(tasks.openApiGenerate.getOutputDir().get() + "/src/main/java")
        }
    }
}
is, insufficient? what else should I be looking at?
all I see there is ant(?) glob syntax
v
Yes, that's insufficient, as you do not configure the task, but a semi-hard-coded path.
srcDir(tasks.openApiGenerate)
if it declares the outputs properly. If you need that mapping, do
srcDir(tasks.openApiGenerate.map { it.getOutputDir().get() + "/src/main/java" })
or something like that. This way the task provider still carries over the necessary task dependency.
c
yeah, it doesn't output that subdir correctly
v
Well, depends on how you configure it, I use the plugin myself, but it needs a bit of fiddling to get it right, yep
c
sigh I thought I had
getOutputDir()
right... guess not... I'm not going to play guessing games or source dive for this. Other dev can do it if it's that important to him not to use
dependsOn
. Based on the API for spotless I'm not even sure it would work anyways
Copy code
> Could not find method getOutputDir() for arguments [] on provider(task 'openApiGenerate', class org.openapitools.generator.gradle.plugin.tasks.GenerateTask) of type org.gradle.api.internal.tasks.DefaultTaskCollection$ExistingTaskProvider_
v
I probably said it before, but I cannot resist. 🙂 If you switch to Kotlin DSL, all the guessing game wents away. 🙂
c
and I said you were preaching to the choire 😉
all of my stuff does
I am not enterprise though
I'm sure you understand the "I've already been told no"
v
😞
Poor you. Sorry I cannot remember that, too many people I talk to here 🙂
c
although my response to spending further time on this is, you said 80/20, I'm not spending more time on this. I think that may be followed with, if you want me to I'm switching to kotlin to reduce that time
you know what's funny? I think when I wrote my own buildSrc version I didn't have this problem...
it tried to format the generated sources, and then I told it no, and I think it worked. This didn't happen
v
If you want to figure out the proper setup, how just going the "bad" way and defining the dependency or at least the must-run-after manually as suggested by the error?
c
oh, I did that
this was my setup
Copy code
tasks.named("spotlessJava") {
    dependsOn(tasks.named("openApiGenerate"))
}
least correct solution to the problem 😛
👌 1
just doesn't seem like a problem worth spending hours on