https://kotlinlang.org logo
Title
b

Behzod

05/01/2023, 9:07 AM
Buildable
1.1.0 🎉 We're excited to share our new library
Buildable
, which simplifies code generation for common design pattern such as Factory and object mapping (KSP). Key features of `Buildable`:
@BuildableFactory
for efficient factory pattern implementation
@BuildableMapper
to simplify object mapping Improved maintainability and readability Reduced boilerplate code Get started with `Buildable`: https://github.com/getspherelabs/buildable
s

Stephan Schröder

05/01/2023, 1:12 PM
ok, so
@BuildableMapper
is like MapStruct for Kotlin. Interessting. Are there any plans to provide an IntelliJ plugin to take care of the IDE not knowing that those mapper functions will exist at runtime?
t

Trevor Stone

05/01/2023, 3:04 PM
Not sure if this is what you mean, but I was shared this trick that will enable your code-gen to run on the IDE's gradle sync instead of requiring a build first https://kotlinlang.slack.com/archives/C013BA8EQSE/p1681033839416219?thread_ts=1680958952.172639&cid=C013BA8EQSE
s

Stephan Schröder

05/01/2023, 7:31 PM
seems useful 🤔 so what would the "do some work!" - part look like for this KSP plugin? Into which phase is this plugin linked and how do I trigger it? (I only ever call build-phases explicitly from the cmdline.)
b

Behzod

05/01/2023, 11:38 PM
Thank you for your interest in
*@Buildable* @Stephan Schröder
. At the moment, we don't have any plans to provide an IntelliJ plugin. Additionally, we used the KSP (Kotlin Symbol Processing) API for code generation. In order to use the generated code, you need to execute the
./gradlew kspDebugKotlin
command or perform a project rebuild. This process ensures that the generated code is properly built and ready for use.
s

Stephan Schröder

05/03/2023, 8:00 AM
so i guess BuildableMapper uses the properties that have the same name and Type in source and target class!? So there's no way to wire a useX: Boolean property in one type to a doesUseX: property in another type?
b

Behzod

05/03/2023, 8:46 AM
You are correct that
@BuildableMapper
maps and generates only the properties that have the same name and type in the source and target classes. At the moment, if the property names or types do not match exactly,
@*BuildableMapper*
does not work properly. I will work on finding solution for this problem as soon as possible :)