mcarleio / konvert

This kotlin compiler plugin is using KSP API and generates kotlin code to map one class to another
https://mcarleio.github.io/konvert/
Apache License 2.0
93 stars 8 forks source link

feat: register generated konverter functions of other modules or libraries #15

Closed mcarleio closed 1 year ago

mcarleio commented 1 year ago

This PR enables to use previously generated konverters from other modules or libraries.

To do this, each function is written into a file in META-INF/konvert/ during generation. On startup of processing, these functions are loaded and registered as TypeConverters and can therefore be used as normal.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 91.85% and project coverage change: +0.32 :tada:

Comparison is base (ff7720a) 83.38% compared to head (46722de) 83.71%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #15 +/- ## ========================================== + Coverage 83.38% 83.71% +0.32% ========================================== Files 65 66 +1 Lines 2088 2167 +79 Branches 278 283 +5 ========================================== + Hits 1741 1814 +73 - Misses 183 186 +3 - Partials 164 167 +3 ``` | [Impacted Files](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel) | Coverage Δ | | |---|---|---| | [.../io/mcarle/konvert/processor/AnnotatedConverter.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-cHJvY2Vzc29yL3NyYy9tYWluL2tvdGxpbi9pby9tY2FybGUva29udmVydC9wcm9jZXNzb3IvQW5ub3RhdGVkQ29udmVydGVyLmt0) | `0.00% <0.00%> (ø)` | | | [...onvert/processor/konvert/KonverterCodeGenerator.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-cHJvY2Vzc29yL3NyYy9tYWluL2tvdGxpbi9pby9tY2FybGUva29udmVydC9wcm9jZXNzb3Iva29udmVydC9Lb252ZXJ0ZXJDb2RlR2VuZXJhdG9yLmt0) | `98.24% <75.00%> (-1.76%)` | :arrow_down: | | [.../processor/konvertfrom/KonvertFromTypeConverter.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-cHJvY2Vzc29yL3NyYy9tYWluL2tvdGxpbi9pby9tY2FybGUva29udmVydC9wcm9jZXNzb3Iva29udmVydGZyb20vS29udmVydEZyb21UeXBlQ29udmVydGVyLmt0) | `84.21% <85.71%> (+9.21%)` | :arrow_up: | | [...arle/konvert/processor/GeneratedKonverterLoader.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-cHJvY2Vzc29yL3NyYy9tYWluL2tvdGxpbi9pby9tY2FybGUva29udmVydC9wcm9jZXNzb3IvR2VuZXJhdGVkS29udmVydGVyTG9hZGVyLmt0) | `87.50% <87.50%> (ø)` | | | [...io/mcarle/konvert/processor/codegen/CodeBuilder.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-cHJvY2Vzc29yL3NyYy9tYWluL2tvdGxpbi9pby9tY2FybGUva29udmVydC9wcm9jZXNzb3IvY29kZWdlbi9Db2RlQnVpbGRlci5rdA==) | `89.47% <90.90%> (+3.75%)` | :arrow_up: | | [...arle/konvert/processor/GeneratedKonverterWriter.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-cHJvY2Vzc29yL3NyYy9tYWluL2tvdGxpbi9pby9tY2FybGUva29udmVydC9wcm9jZXNzb3IvR2VuZXJhdGVkS29udmVydGVyV3JpdGVyLmt0) | `96.29% <96.29%> (ø)` | | | [...rle/konvert/converter/api/config/KonvertOptions.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-Y29udmVydGVyLWFwaS9zcmMvbWFpbi9rb3RsaW4vaW8vbWNhcmxlL2tvbnZlcnQvY29udmVydGVyL2FwaS9jb25maWcvS29udmVydE9wdGlvbnMua3Q=) | `100.00% <100.00%> (ø)` | | | [.../mcarle/konvert/converter/api/config/extensions.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-Y29udmVydGVyLWFwaS9zcmMvbWFpbi9rb3RsaW4vaW8vbWNhcmxlL2tvbnZlcnQvY29udmVydGVyL2FwaS9jb25maWcvZXh0ZW5zaW9ucy5rdA==) | `80.00% <100.00%> (+5.00%)` | :arrow_up: | | [...in/io/mcarle/konvert/processor/KonvertProcessor.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-cHJvY2Vzc29yL3NyYy9tYWluL2tvdGxpbi9pby9tY2FybGUva29udmVydC9wcm9jZXNzb3IvS29udmVydFByb2Nlc3Nvci5rdA==) | `97.50% <100.00%> (+0.35%)` | :arrow_up: | | [...io/mcarle/konvert/processor/konvert/KonvertData.kt](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel#diff-cHJvY2Vzc29yL3NyYy9tYWluL2tvdGxpbi9pby9tY2FybGUva29udmVydC9wcm9jZXNzb3Iva29udmVydC9Lb252ZXJ0RGF0YS5rdA==) | `87.50% <100.00%> (+0.40%)` | :arrow_up: | | ... and [7 more](https://app.codecov.io/gh/mcarleio/konvert/pull/15?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel) | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/mcarleio/konvert/pull/15/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Marcel)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.