Skip to content

Commit

Permalink
Ksp routing (#6)
Browse files Browse the repository at this point in the history
* Initial processor module

* Added annotation module

* Basic handle path generator

* Path parameter support

* Named routing support

* @path support

* Optional path parameter support

* Tailcard parameter support

* Regex parameter support

* Body parameter support

* Method parameter and improvements

* Folder changes only

* ApplicationCall parameters support

* KSP gradle plugin single target

* KSP gradle plugin multiplatform target

* KSP custom generated file name

* Composable codegen support

* Voyager screen codegen support

* fixed core processor versioning
  • Loading branch information
programadorthi authored Nov 17, 2024
1 parent 758aa48 commit a32b3a0
Show file tree
Hide file tree
Showing 23 changed files with 972 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ plugins {
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.jetbrains.compose) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.ksp) apply false
}
12 changes: 12 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ compose = "1.6.10"

coroutines = "1.8.0"
kotlin = "2.0.10"
ksp = "2.0.10-1.0.24"
ktor = "3.0.0-beta-2"
serialization = "1.6.1" # Do not upgrade, 1.6.2 breaks maven publishing!
slf4j = "2.0.4"
voyager = "1.1.0-beta02"
kodein = "7.22.0"
koin = "4.0.0-RC1"
kotlin-poet = "1.18.1"
tomlj = "1.1.1"

junit = "4.13.2"
Expand All @@ -30,6 +32,7 @@ espresso-core = "3.5.1"
lifecycle-runtime-ktx = "2.3.1"
activity-compose = "1.5.1"
compose-bom = "2022.10.00"
routing = "2.0.0-alpha02"
# SAMPLE VERSIONS #

[libraries]
Expand All @@ -42,6 +45,7 @@ androidx-activity = { module = "androidx.activity:activity", version.ref = "andr
androidx-startup = { module = "androidx.startup:startup-runtime", version.ref = "androidx-startup" }

coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
ktor-events = { module = "io.ktor:ktor-events", version.ref = "ktor" }
ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" }
ktor-resources = { module = "io.ktor:ktor-resources", version.ref = "ktor" }
Expand All @@ -53,6 +57,8 @@ slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" }
kodein-di = { module = "org.kodein.di:kodein-di", version.ref = "kodein" }
koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
kotlin-poet = { module = "com.squareup:kotlinpoet", version.ref = "kotlin-poet" }
kotlin-poet-ksp = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlin-poet" }

tomlj = { module = "org.tomlj:tomlj", version.ref = "tomlj" }

Expand All @@ -78,10 +84,16 @@ ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview
ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
material3 = { group = "androidx.compose.material3", name = "material3" }
routing-core = { module = "dev.programadorthi.routing:core", version.ref = "routing" }
routing-compose = { module = "dev.programadorthi.routing:compose", version.ref = "routing" }
routing-voyager = { module = "dev.programadorthi.routing:voyager", version.ref = "routing" }
routing-annotations = { module = "dev.programadorthi.routing:ksp-core-annotations", version.ref = "routing" }
# SAMPLE LIBRARIES #

[plugins]
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "compose" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin"}
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "plugin-maven"}
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"}
routing = { id = "dev.programadorthi.routing", version.ref = "routing"}
1 change: 1 addition & 0 deletions ksp/core-annotations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions ksp/core-annotations/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
kotlin("multiplatform")
id("org.jetbrains.kotlinx.kover")
alias(libs.plugins.maven.publish)
}

applyBasicSetup()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dev.programadorthi.routing.annotation

@Target(AnnotationTarget.VALUE_PARAMETER)
public annotation class Body
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dev.programadorthi.routing.annotation

@Target(AnnotationTarget.VALUE_PARAMETER)
public annotation class Path(
val value: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package dev.programadorthi.routing.annotation

@Target(
AnnotationTarget.CLASS,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.FUNCTION,
)
public annotation class Route(
val path: String = "",
val name: String = "",
val regex: String = "",
val method: String = "",
)
3 changes: 3 additions & 0 deletions ksp/core-annotations/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=Ksp Core Annotations
POM_ARTIFACT_ID=ksp-core-annotations
POM_DESCRIPTION=Core annotations to generate basic behaviors
1 change: 1 addition & 0 deletions ksp/core-processor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
21 changes: 21 additions & 0 deletions ksp/core-processor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
kotlin("multiplatform")
id("org.jetbrains.kotlinx.kover")
alias(libs.plugins.maven.publish)
}

applyBasicSetup()

kotlin {
sourceSets {
jvmMain {
dependencies {
implementation(projects.core)
implementation(projects.ksp.coreAnnotations)
implementation(libs.kotlin.poet)
implementation(libs.kotlin.poet.ksp)
implementation(libs.ksp.api)
}
}
}
}
3 changes: 3 additions & 0 deletions ksp/core-processor/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=Ksp Core Processor
POM_ARTIFACT_ID=ksp-core-processor
POM_DESCRIPTION=Ksp core processor to generate basic behaviors
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev.programadorthi.routing.ksp.RoutingProcessorProvider
Loading

0 comments on commit a32b3a0

Please sign in to comment.