Maybe dumb question. But, can I output generated f...
# ksp
e
Maybe dumb question. But, can I output generated files into another Gradle project's build dir? Let's say I have two projects:
Copy code
root/
  one
  two
two
depends on
one
. Now, I'd like
one
to generate an interface that can be used in
two
. However that interface should only be available in
two
. Or can I move the KSP generation in
two
and look up annotated classes of
one
?
👀 1
j
it is across different gradle projects? Then I don’t think you should do that, you can write one off build script to move file with absolute path if you really want, but that is on your own, much like moving the file manually with file explorer.
e
it is across different gradle projects
Yup! And what about looking up project `one`'s classes by package name from project
two
, is it possible with KSP? This less manual scripting/custom tasks I have, the better.
I've found this issue https://github.com/google/ksp/issues/1075 Maybe that's what I need to do?
a
Why not just add this generated directory as sources via Gradle?
e
That actually seems like a pretty good idea
Need to verify if I can make it work
a
It is the simpler solution I’d say.
e
Yeah. But then I'd ask, why not just outputting it in the default source set?
I get that the separation is cleaner, but still a valid question
a
Because you don’t want to mix actual sources with generated sources
But that’s my 2 cents
e
Makes sense know that I recalled I'm versioning my code lol
m
Not sure how similar it's to your use case but I've had success generating sources in resources in 1 that module 2 can extract and compile
There's some amount of Gradle required, it's here if you want to take a look
e
So basically you've implemented a "manual" move operation. Correct?
m
Yes, kind of. The nice thing is that it survives publishing, etc...
module1.jar is self contained
The bad thing is that kmp doesn't have resources 😅
In all cases, I think you'll have to do some Gradle magic
🥲 1
e
At this point I have more Kotlin code for Gradle than actual production sources
😂 1
true story 1