-
Notifications
You must be signed in to change notification settings - Fork 2
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
Component generator #65
base: develop
Are you sure you want to change the base?
Conversation
# Conflicts: # gradle/libs.versions.toml
# Conflicts: # iosApp/iosApp/Views/Screen/FirstView.swift
…generator # Conflicts: # gradle/libs.versions.toml # gradle/wrapper/gradle-wrapper.properties
Co-authored-by: Matej Semančík <[email protected]>
Add support for Kotlin 2.0.0 🚀🚀🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs some ironing out, otherwise, this is a nice idea, wonder what other use-cases can we cover with this.
|
||
// setup for component processor | ||
arg("viewModel", "app.futured.kmptemplate.util.arch.ViewModelComponent") | ||
arg("viewModelExt", "app.futured.kmptemplate.util.ext.viewModel") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this configuration actually relate to Koin, or is it just a shortcut to configure KSP for different thing?
//internal class LoginComponent( | ||
// componentContext: ComponentContext, | ||
//) : ViewModelComponent<LoginViewModel>(componentContext), LoginScreen { | ||
// override val viewModel: LoginViewModel by viewModel() | ||
// override val viewState: StateFlow<LoginViewState> = viewModel.viewState | ||
// override val actions: LoginScreen.Actions = viewModel | ||
// override val suspendActions: LoginScreen.SuspendActions = viewModel | ||
//} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably delete entire file, or just add a comment why this is actually commented out. Might be confusing for user.
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.SOURCE) | ||
annotation class Component(val argType: KClass<*> = Unit::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get any documentation? 🥺👉👈
iosX64() | ||
iosArm64() | ||
iosSimulatorArm64() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace with iosTargets()
like in rest of the project.
iosX64() | |
iosArm64() | |
iosSimulatorArm64() | |
iosTargets() |
sourceSets { | ||
commonMain { | ||
dependencies { } | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This empty configuration block can be removed
plugins { | ||
id(libs.plugins.kotlin.multiplatform.get().pluginId) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the processor need multiplatform plugin? I think you should be able to get it working using just jvm plugin?
@@ -0,0 +1,57 @@ | |||
package com.rudolfhladik.componentprocessor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update package name?
|
||
class ComponentProcessor( | ||
private val codeGenerator: CodeGenerator, | ||
private val logger: KSPLogger, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logger is unused, wanna keep it in? (I'm literally doing Danger's work here, which reminds me there should be ktlint
and danger
plugins added in component-processor
and component-annotations
Gradle projects)
|
||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.SOURCE) | ||
annotation class NavigationComponent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This annotation class is unused, pls remove
import com.squareup.kotlinpoet.ksp.toTypeName | ||
import com.squareup.kotlinpoet.ksp.writeTo | ||
|
||
class ComponentPoetGenerator { // TODO cant access classes from other modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is WIP version of generator using Kotlin Poet?
It appears to be unused, pls
- remove this class (we can add it later when finished)
- remove kotlin poet dependency
# Conflicts: # androidApp/build.gradle.kts # gradle/libs.versions.toml # shared/feature/build.gradle.kts # shared/feature/src/commonMain/kotlin/app/futured/kmptemplate/feature/navigation/signedin/tab/b/TabBDestinations.kt # shared/feature/src/commonMain/kotlin/app/futured/kmptemplate/feature/ui/first/FirstComponent.kt # shared/feature/src/commonMain/kotlin/app/futured/kmptemplate/feature/ui/first/FirstViewModel.kt # shared/resources/build.gradle.kts
Generated by 🚫 Danger |
Add KSP Processor for generating components from
ScreenInterface