-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added Androidx Room integration for mobile and desktop targets. - Slightly updated CacheSource API. - Cleaned up some dependencies from versions catalog to have only what is included.
- Loading branch information
1 parent
dc1584f
commit 41578b3
Showing
85 changed files
with
1,076 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[versions] | ||
kotli = "0.5.2" | ||
kotli = "0.5.3" | ||
kotlin = "1.9.23" | ||
kotlinxCoroutines = "1.8.0" | ||
logback = "1.5.6" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apply from: "${project.rootDir}/gradle/kotlin/processor.gradle" | ||
|
||
group = 'com.kotlitecture.kotli' | ||
version = '0.5.2' | ||
version = '0.6.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
processor/src/main/kotlin/kotli/template/multiplatform/compose/common/CommonKspProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package kotli.template.multiplatform.compose.common | ||
|
||
import kotli.engine.BaseFeatureProcessor | ||
import kotli.engine.TemplateState | ||
import kotli.engine.template.VersionCatalogRules | ||
import kotli.engine.template.rule.CleanupMarkedBlock | ||
import kotli.engine.template.rule.CleanupMarkedLine | ||
import kotli.engine.template.rule.RemoveMarkedBlock | ||
import kotli.engine.template.rule.RemoveMarkedLine | ||
import kotli.template.multiplatform.compose.Rules | ||
|
||
object CommonKspProcessor : BaseFeatureProcessor() { | ||
|
||
override fun getId(): String = "common.ksp" | ||
override fun isInternal(): Boolean = true | ||
|
||
override fun doApply(state: TemplateState) { | ||
state.onApplyRules( | ||
Rules.BuildGradleApp, | ||
CleanupMarkedLine("{common.ksp}"), | ||
CleanupMarkedBlock("{common.ksp.config}") | ||
) | ||
} | ||
|
||
override fun doRemove(state: TemplateState) { | ||
state.onApplyRules( | ||
VersionCatalogRules( | ||
RemoveMarkedLine("ksp") | ||
) | ||
) | ||
state.onApplyRules( | ||
Rules.BuildGradleApp, | ||
RemoveMarkedLine("{common.ksp}"), | ||
RemoveMarkedBlock("{common.ksp.config}") | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...in/kotlin/kotli/template/multiplatform/compose/dataflow/database/SqliteLinkerProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package kotli.template.multiplatform.compose.dataflow.database | ||
|
||
import kotli.engine.BaseFeatureProcessor | ||
import kotli.engine.TemplateState | ||
import kotli.engine.template.rule.CleanupMarkedLine | ||
import kotli.engine.template.rule.RemoveMarkedLine | ||
import kotli.template.multiplatform.compose.Rules | ||
|
||
object SqliteLinkerProcessor : BaseFeatureProcessor() { | ||
|
||
const val ID = "dataflow.database.sqlite-linker" | ||
override fun isInternal(): Boolean = true | ||
|
||
override fun getId(): String = ID | ||
|
||
override fun doApply(state: TemplateState) { | ||
state.onApplyRules( | ||
Rules.BuildGradleApp, | ||
CleanupMarkedLine("{dataflow.database.sqlite-linker}") | ||
) | ||
} | ||
|
||
override fun doRemove(state: TemplateState) { | ||
state.onApplyRules( | ||
Rules.BuildGradleApp, | ||
RemoveMarkedLine("{dataflow.database.sqlite-linker}") | ||
) | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...src/main/kotlin/kotli/template/multiplatform/compose/dataflow/database/SqliteProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package kotli.template.multiplatform.compose.dataflow.database | ||
|
||
import kotli.engine.BaseFeatureProcessor | ||
import kotli.engine.FeatureProcessor | ||
import kotli.engine.TemplateState | ||
import kotli.engine.template.VersionCatalogRules | ||
import kotli.engine.template.rule.CleanupMarkedLine | ||
import kotli.engine.template.rule.RemoveMarkedLine | ||
import kotli.template.multiplatform.compose.Rules | ||
|
||
object SqliteProcessor : BaseFeatureProcessor() { | ||
|
||
const val ID = "dataflow.database.sqlite" | ||
override fun isInternal(): Boolean = true | ||
override fun dependencies(): List<Class<out FeatureProcessor>> = listOf( | ||
SqliteLinkerProcessor::class.java | ||
) | ||
|
||
override fun getId(): String = ID | ||
|
||
override fun doApply(state: TemplateState) { | ||
state.onApplyRules( | ||
Rules.BuildGradleApp, | ||
CleanupMarkedLine("{dataflow.database.sqlite}") | ||
) | ||
} | ||
|
||
override fun doRemove(state: TemplateState) { | ||
state.onApplyRules( | ||
Rules.BuildGradleApp, | ||
RemoveMarkedLine("{dataflow.database.sqlite}") | ||
) | ||
state.onApplyRules( | ||
VersionCatalogRules( | ||
RemoveMarkedLine("sqlite-bundled") | ||
) | ||
) | ||
} | ||
|
||
} |
101 changes: 101 additions & 0 deletions
101
.../main/kotlin/kotli/template/multiplatform/compose/dataflow/database/room/RoomProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package kotli.template.multiplatform.compose.dataflow.database.room | ||
|
||
import kotli.engine.BaseFeatureProcessor | ||
import kotli.engine.FeatureProcessor | ||
import kotli.engine.FeatureTag | ||
import kotli.engine.TemplateState | ||
import kotli.engine.template.VersionCatalogRules | ||
import kotli.engine.template.rule.CleanupMarkedBlock | ||
import kotli.engine.template.rule.CleanupMarkedLine | ||
import kotli.engine.template.rule.RemoveFile | ||
import kotli.engine.template.rule.RemoveMarkedBlock | ||
import kotli.engine.template.rule.RemoveMarkedLine | ||
import kotli.template.multiplatform.compose.Rules | ||
import kotli.template.multiplatform.compose.Tags | ||
import kotli.template.multiplatform.compose.common.CommonKspProcessor | ||
import kotli.template.multiplatform.compose.dataflow.database.SqliteProcessor | ||
import kotli.template.multiplatform.compose.platform.client.MobileAndDesktopProcessor | ||
import kotli.template.multiplatform.compose.platform.client.android.AndroidPlatformProcessor | ||
import kotli.template.multiplatform.compose.platform.client.ios.IOSPlatformProcessor | ||
import kotli.template.multiplatform.compose.platform.client.jvm.JvmPlatformProcessor | ||
import kotlin.time.Duration.Companion.hours | ||
|
||
object RoomProcessor : BaseFeatureProcessor() { | ||
|
||
const val ID = "dataflow.database.room" | ||
|
||
override fun getId(): String = ID | ||
override fun getTags(): List<FeatureTag> = Tags.MobileAndDesktop | ||
override fun getIntegrationEstimate(state: TemplateState): Long = 4.hours.inWholeMilliseconds | ||
override fun getWebUrl(state: TemplateState): String = | ||
"https://developer.android.com/kotlin/multiplatform/room" | ||
|
||
override fun getIntegrationUrl(state: TemplateState): String = | ||
"https://developer.android.com/kotlin/multiplatform/room#defining-database" | ||
|
||
override fun canApply(state: TemplateState): Boolean { | ||
return listOfNotNull( | ||
state.getFeature(AndroidPlatformProcessor.ID), | ||
state.getFeature(IOSPlatformProcessor.ID), | ||
state.getFeature(JvmPlatformProcessor.ID) | ||
).isNotEmpty() | ||
} | ||
|
||
override fun dependencies(): List<Class<out FeatureProcessor>> = listOf( | ||
MobileAndDesktopProcessor::class.java, | ||
CommonKspProcessor::class.java, | ||
SqliteProcessor::class.java, | ||
) | ||
|
||
override fun doApply(state: TemplateState) { | ||
state.onApplyRules( | ||
Rules.BuildGradleApp, | ||
CleanupMarkedBlock("{dataflow.database.room.config}"), | ||
CleanupMarkedLine("{dataflow.database.room}") | ||
) | ||
} | ||
|
||
override fun doRemove(state: TemplateState) { | ||
state.onApplyRules( | ||
Rules.BuildGradleApp, | ||
RemoveMarkedBlock("{dataflow.database.room.config}"), | ||
RemoveMarkedLine("{dataflow.database.room}") | ||
) | ||
state.onApplyRules( | ||
VersionCatalogRules( | ||
RemoveMarkedLine("androidx-room") | ||
) | ||
) | ||
state.onApplyRules( | ||
Rules.RoomSource, | ||
RemoveFile() | ||
) | ||
state.onApplyRules( | ||
Rules.RoomDir, | ||
RemoveFile() | ||
) | ||
state.onApplyRules( | ||
"app/schemas", | ||
RemoveFile() | ||
) | ||
state.onApplyRules( | ||
Rules.DIKt, | ||
RemoveMarkedLine("RoomSource") | ||
) | ||
|
||
// showcases | ||
state.onApplyRules( | ||
Rules.ShowcasesKt, | ||
RemoveMarkedLine("Room") | ||
) | ||
state.onApplyRules( | ||
Rules.ShowcasesRoomDir, | ||
RemoveFile() | ||
) | ||
state.onApplyRules( | ||
Rules.AppModuleKt, | ||
RemoveMarkedLine("createRoom") | ||
) | ||
} | ||
|
||
} |
Oops, something went wrong.