has anyone used jOOQ, with the gradle plugin to tr...
# gradle
c
has anyone used jOOQ, with the gradle plugin to trigger code gen, in a kotlin multiplatform project? The jOOQ code generator gradle plugin expects a SourceSet instance in its configuration, and I can't figure out how to get one from a KotlinSourceSet (is that possible?)
o
a SourceSet is the thing you get from
sourceSets
, which iirc
KotlinSourceSet
is an extension on that, so it should be easy to acquire one
e.g.
sourceSets["main"]
in kdsl
c
Well
kotlin.sourceSets.jvmMain
exists but isn't the wrong type since KotlinSourceSet isn't a subtype of SourceSet.
sourceSets["main"]
gives me
> SourceSet with name 'main' not found.
"jvmMain" gives similar results.
o
that's extremely surprising for me, what does your build.gradle look like?
c
o
hmm, I've never played around with MPP. I wonder if for some reason it doesn't apply the
java
plugin? that's what usually sets up the
sourceSets
stuff
c
yeah I figured this was a multiplatform issue. I asked in there first but didn't get any bites. I wonder if it's possible to put the entire jooq block inside of something that's specific to the jvm context
I've been trying really hard to understand gradle but multiplatform makes it extra confusing
o
yea, the MPP stuff is very confusing, esp. because it keeps changing
c
think I should try asking again in multiplatform?
o
probably
c
okay. well thanks for taking a look!
o
the other thing I would recommend, if possible, is generating it in a separate module
then you can just configure that as a normal JVM thing, and ignore the whole MPP business there
c
yeah that seems reasonable. it actually annoyed me that the jooq plugin requires a source set at all, because as far as I can tell, the code generator should be able to be run standalone
I will read up on modules
because if I can have a standalone gradle build that runs this, and I can run it from a task in my main gradle script, then I'm happy
o
it's a little different from that, it won't be exactly "standalone", but it will have an entirely different configuration on the actual Project instance -- gradle will handle the task execution for you as long as you declare a dependency on it, e.g.
implementation(project(":jooq"))
if you made a
jooq
directory with a
build.gradle
with the appropriate configuration inside
you also have to add
include(":jooq")
to
settings.gradle
c
ok! it took some more grappling with other issues, but I have it working now and running the codegen in the module! Thank you very much for your help.