-
Notifications
You must be signed in to change notification settings - Fork 12
[Question/Help Wanted] Running apt in the same sourceset while compiling it #18
Comments
We had the same problem on our project. We basically "solved" it by making a fake target through gradle at build time which has the same configuration like the actual target we want to build. During the compilation of the fake target, the generated code is created and added to the source set and thus available when the actual target is built. Edit: from here on we create the dummy target: https://github.com/utopia-rise/godot-kotlin/blob/521476cececfa13cbc86cb3b9e7d9eb3a3bd15be/plugins/godot-gradle-plugin/src/main/kotlin/godot/gradle/GodotPlugin.kt#L73 if you want to have a look on how to setup this |
Looks cool! But doesn't work on my side :( The reason is: you made a virtual target with custom source set name (godot[Main|Test]). Well, it still could be achieved with your's way. But I need to change whole project's structure :( I'm digging deeper to kotlinx.serialization... What do you mean saying "directly generate IR"? |
Yes depending on the size of the project that's not feasible at all. Also a good starting point might be this set of slides: https://resources.jetbrains.com/storage/products/kotlinconf2018/slides/5_Writing%20Your%20First%20Kotlin%20Compiler%20Plugin.pdf But maybe @Foso has a better idea on how to tackle this problem which is quite similar with what i eluded here: #11 |
Hi, sorry for the late answer, unfortunately i don't have a better solution yet, but i will take a look if Kotlin 1.4.0 offers some new opportunities |
Hi!
I've faced problem implementing APT with your library. Looks like it's normal behavior of kotlin's compiler, I dunno.
Project: mpp with common/frontend/backend source sets.
What I need? I have classes in backend source set, that should be weaved by my APT plugin.
And here is an egg-chicken trouble :) Kotlin code I generate with APT should be included in compiler on the current run...
On the first run APT works well, but rendered classes not includes in compiler and it fails with "Reference not resolved" error.
On the second run everything compiles fine, as compiler knows about rendered files already.
Any way this behavior could be achieved? :)
The text was updated successfully, but these errors were encountered: