Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from Arrow Meta to Kotlin Symbol Processor #24

Merged
merged 23 commits into from
Jun 22, 2022
Merged

Migrate from Arrow Meta to Kotlin Symbol Processor #24

merged 23 commits into from
Jun 22, 2022

Conversation

sugarmanz
Copy link
Collaborator

@sugarmanz sugarmanz commented May 13, 2022

What Changed

Migrate to KSP (also includes Kotlin 1.6+ upgrade and Gradle version catalog update)

Why

#16

Concerns

  • Assignment based -> Annotation based.

    internal abstract class GenericHooks : Hooks() {
    @Sync<(newSpeed: Int) -> Unit> abstract val sync: SyncHook<*>
    @SyncBail<(Boolean) -> BailResult<Int>> abstract val syncBail: SyncBailHook<*, *>
    @SyncLoop<(foo: Boolean) -> LoopResult> abstract val syncLoop: SyncLoopHook<*, *>
    @SyncWaterfall<(name: String) -> String> abstract val syncWaterfall: SyncWaterfallHook<*, *>
    @ExperimentalCoroutinesApi
    @AsyncParallelBail<suspend (String) -> BailResult<String>> abstract val asyncParallelBail: AsyncParallelBailHook<*, *>
    @AsyncParallel<suspend (String) -> Int> abstract val asyncParallel: AsyncParallelHook<*>
    @AsyncSeries<suspend (String) -> Int> abstract val asyncSeries: AsyncSeriesHook<*>
    @AsyncSeriesBail<suspend (String) -> BailResult<String>> abstract val asyncSeriesBail: AsyncSeriesBailHook<*, *>
    @AsyncSeriesLoop<suspend (String) -> LoopResult> abstract val asyncSeriesLoop: AsyncSeriesLoopHook<*, *>
    @AsyncSeriesWaterfall<suspend (String) -> String> abstract val asyncSeriesWaterfall: AsyncSeriesWaterfallHook<*, *>
    }

  • Still would like to migrate to Kotlin poet as well!

  • Gradle/Maven plugins wrappers tie to a specific version of KSP/Kotlin -- so if we keep those, we should release those independently to align with KSP/Kotlin version

  • Ktlint is incompatible with Maven :(

Resolutions

Still would like to migrate to Kotlin poet as well!

Postponing for another PR

Gradle/Maven plugins wrappers tie to a specific version of KSP/Kotlin -- so if we keep those, we should release those independently to align with KSP/Kotlin version

Will release in accordance with hooks for now with explicit documentation regarding what Kotlin version it is compatible with. In the future, we will fix publishing to publish against proper versions (for 1.0)

Ktlint is incompatible with Maven :(

Swapping to Kotlin poet should help with proper formatting anyways

📦 Published PR as canary version: 0.11.2-canary.24.249-SNAPSHOT

Release Notes

💥 This is a breaking change 💥

Migration to KSP from Arrow Meta because they dropped support for source generation. This does improve the overall maturity of the codegen module (compiler-plugin -> processor). However, the KSP framework doesn't support the code typing introspection that we were doing in Arrow Meta. Instead, we have to rely strictly on typings and annotations, which changes the DSL we originally had.

internal abstract class GenericHooks : Hooks() {
    @Sync<(newSpeed: Int) -> Unit> abstract val sync: SyncHook<*>
    @SyncBail<(Boolean) -> BailResult<Int>> abstract val syncBail: SyncBailHook<*, *>
    @SyncLoop<(foo: Boolean) -> LoopResult> abstract val syncLoop: SyncLoopHook<*, *>
    @SyncWaterfall<(name: String) -> String> abstract val syncWaterfall: SyncWaterfallHook<*, *>
    @AsyncParallelBail<suspend (String) -> BailResult<String>> abstract val asyncParallelBail: AsyncParallelBailHook<*, *>
    @AsyncParallel<suspend (String) -> Int> abstract val asyncParallel: AsyncParallelHook<*>
    @AsyncSeries<suspend (String) -> Int> abstract val asyncSeries: AsyncSeriesHook<*>
    @AsyncSeriesBail<suspend (String) -> BailResult<String>> abstract val asyncSeriesBail: AsyncSeriesBailHook<*, *>
    @AsyncSeriesLoop<suspend (String) -> LoopResult> abstract val asyncSeriesLoop: AsyncSeriesLoopHook<*, *>
    @AsyncSeriesWaterfall<suspend (String) -> String> abstract val asyncSeriesWaterfall: AsyncSeriesWaterfallHook<*, *>
}

@sugarmanz
Copy link
Collaborator Author

@stabbylambda would love your opinion on the new annotation-based DSL (comes from restraints of KSP over Arrow Meta)

@sugarmanz sugarmanz added the minor Increment the minor version when merged label Jun 22, 2022
@sugarmanz sugarmanz changed the title Ksp Migrate from Arrow Meta to Kotlin Symbol Processor Jun 22, 2022
@sugarmanz sugarmanz merged commit 200b606 into main Jun 22, 2022
@sugarmanz
Copy link
Collaborator Author

🚀 PR was released in v0.12.0 🚀

@sugarmanz sugarmanz added the released This issue/pull request has been released. label Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant