Skip to content

Commit f847241

Browse files
committed
feat: add new symbol processor
1 parent 240de95 commit f847241

File tree

19 files changed

+240
-140
lines changed

19 files changed

+240
-140
lines changed

build.gradle.kts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
import co.anitrend.support.query.builder.buildSrc.plugins.resolver.handleDependencySelection
2-
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
33

44
plugins {
5-
id("com.github.ben-manes.versions")
5+
id("org.jetbrains.dokka")
66
}
77

88
buildscript {
9+
repositories {
10+
google()
11+
mavenCentral()
12+
}
913
dependencies {
1014
classpath(libs.android.gradle.plugin)
1115
classpath(libs.jetbrains.kotlin.gradle)
@@ -28,17 +32,7 @@ tasks {
2832
}
2933
}
3034

31-
tasks.named(
32-
"dependencyUpdates",
33-
DependencyUpdatesTask::class.java
34-
).configure {
35-
checkForGradleUpdate = false
36-
outputFormatter = "json"
37-
outputDir = "build/dependencyUpdates"
38-
reportfileName = "report"
39-
resolutionStrategy {
40-
componentSelection {
41-
all { handleDependencySelection() }
42-
}
43-
}
44-
}
35+
tasks.withType(DokkaMultiModuleTask::class.java) {
36+
outputDirectory.set(rootProject.file("dokka-docs"))
37+
failOnWarning.set(false)
38+
}

buildSrc/build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
`kotlin-dsl`
33
`maven-publish`
4-
`version-catalog`
54
}
65

76
repositories {
@@ -25,9 +24,6 @@ dependencies {
2524
/* Depend on the dokka plugin, since we want to access it in our plugin */
2625
implementation(libs.jetbrains.dokka.gradle)
2726

28-
/** Dependency management */
29-
implementation(libs.gradle.versions)
30-
3127
/** Spotless */
3228
implementation(libs.spotless.gradle)
3329

buildSrc/src/main/java/co/anitrend/support/query/builder/buildSrc/module/Modules.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ internal object Modules {
1616
}
1717

1818
enum class Processor(override val id: String) : Module {
19-
Kapt("processor")
19+
Kapt("processor"),
20+
Ksp("processor")
2021
}
2122

2223
enum class Common(override val id: String) : Module {

buildSrc/src/main/java/co/anitrend/support/query/builder/buildSrc/plugins/components/ProjectConfiguration.kt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
package co.anitrend.support.query.builder.buildSrc.plugins.components
22

3-
import co.anitrend.support.query.builder.buildSrc.extension.*
43
import co.anitrend.support.query.builder.buildSrc.extension.baseAppExtension
54
import co.anitrend.support.query.builder.buildSrc.extension.baseExtension
5+
import co.anitrend.support.query.builder.buildSrc.extension.isSampleModule
6+
import co.anitrend.support.query.builder.buildSrc.extension.props
67
import com.android.build.gradle.internal.dsl.DefaultConfig
78
import org.gradle.api.JavaVersion
89
import org.gradle.api.Project
9-
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
10+
import org.gradle.api.tasks.testing.Test
11+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
12+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
1013
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
1114
import java.io.File
1215

13-
14-
@Suppress("UnstableApiUsage")
1516
private fun DefaultConfig.applyAdditionalConfiguration(project: Project) {
1617
if (project.isSampleModule()) {
1718
applicationId = "co.anitrend.support.query.builder.sample"
@@ -93,18 +94,22 @@ internal fun Project.configureAndroid(): Unit = baseExtension().run {
9394
targetCompatibility = JavaVersion.VERSION_17
9495
}
9596

96-
tasks.withType(KotlinCompile::class.java) {
97+
tasks.withType(KotlinCompilationTask::class.java) {
9798
val compilerArgumentOptions = emptyList<String>()
9899

99-
kotlinOptions {
100-
allWarningsAsErrors = false
101-
freeCompilerArgs = compilerArgumentOptions
100+
compilerOptions {
101+
allWarningsAsErrors.set(false)
102+
freeCompilerArgs.addAll(compilerArgumentOptions)
102103
}
103104
}
104105

106+
tasks.withType(Test::class.java) {
107+
useJUnitPlatform()
108+
}
109+
105110
tasks.withType(KotlinJvmCompile::class.java) {
106-
kotlinOptions {
107-
jvmTarget = "17"
111+
compilerOptions {
112+
jvmTarget.set(JvmTarget.JVM_17)
108113
}
109114
}
110115
}

buildSrc/src/main/java/co/anitrend/support/query/builder/buildSrc/plugins/components/ProjectPlugins.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package co.anitrend.support.query.builder.buildSrc.plugins.components
22

3+
import co.anitrend.support.query.builder.buildSrc.extension.isKotlinLibraryGroup
4+
import co.anitrend.support.query.builder.buildSrc.extension.isProcessorModule
5+
import co.anitrend.support.query.builder.buildSrc.extension.isSampleModule
36
import org.gradle.api.Project
47
import org.gradle.api.plugins.PluginContainer
5-
import co.anitrend.support.query.builder.buildSrc.extension.isSampleModule
6-
import co.anitrend.support.query.builder.buildSrc.extension.isProcessorModule
7-
import co.anitrend.support.query.builder.buildSrc.extension.isKotlinLibraryGroup
88

99
private fun addAndroidPlugin(project: Project, pluginContainer: PluginContainer) {
1010
when {
@@ -29,13 +29,14 @@ private fun addKotlinAndroidPlugin(project: Project, pluginContainer: PluginCont
2929
}
3030

3131
private fun addAnnotationProcessor(project: Project, pluginContainer: PluginContainer) {
32-
if (project.isSampleModule() || project.isProcessorModule())
32+
if (project.isSampleModule() || project.isProcessorModule()) {
3333
pluginContainer.apply("kotlin-kapt")
34+
}
3435
}
3536

3637

3738
internal fun Project.configurePlugins() {
3839
addAndroidPlugin(project, plugins)
3940
addKotlinAndroidPlugin(project, plugins)
40-
addAnnotationProcessor(project, plugins)
41+
//addAnnotationProcessor(project, plugins)
4142
}

buildSrc/src/main/java/co/anitrend/support/query/builder/buildSrc/plugins/components/ProjectProperties.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ enum class PropertyTypes(val key: String) {
1010
VERSION("version"),
1111
}
1212

13-
class PropertiesReader(project: Project) {
13+
class PropertiesReader(project: Project, path: String = "gradle/version.properties") {
1414
private val properties = Properties(2)
1515

1616
init {
17-
val releaseFile = File(project.rootDir, "gradle/version.properties")
17+
val releaseFile = File(project.rootDir, path)
1818
if (!releaseFile.exists()) {
1919
project.logger.error("Release file cannot be found in path: $releaseFile")
2020
}
@@ -28,4 +28,4 @@ class PropertiesReader(project: Project) {
2828
return properties.getProperty(type.key)
2929
?: throw IllegalStateException("$type properties were not initialized")
3030
}
31-
}
31+
}
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
11
package co.anitrend.support.query.builder.buildSrc.plugins.resolver
2-
3-
import com.github.benmanes.gradle.versions.updates.resolutionstrategy.ComponentSelectionWithCurrent
4-
5-
fun ComponentSelectionWithCurrent.handleDependencySelection() {
6-
val reject = listOf("preview", "m", "rc", "alpha", "beta")
7-
.map { qualifier ->
8-
val pattern = "(?i).*[.-]$qualifier[.\\d-]*"
9-
Regex(pattern, RegexOption.IGNORE_CASE)
10-
}
11-
.any { it.matches(candidate.version) }
12-
if (reject)
13-
reject("$candidate version does not fit acceptance criteria")
14-
}

buildSrc/src/main/java/co/anitrend/support/query/builder/buildSrc/plugins/strategy/DependencyStrategy.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package co.anitrend.support.query.builder.buildSrc.plugins.strategy
22

3-
import co.anitrend.support.query.builder.buildSrc.extension.*
3+
import co.anitrend.support.query.builder.buildSrc.extension.implementation
4+
import co.anitrend.support.query.builder.buildSrc.extension.isSampleModule
5+
import co.anitrend.support.query.builder.buildSrc.extension.libs
6+
import co.anitrend.support.query.builder.buildSrc.extension.test
47
import org.gradle.api.Project
58
import org.gradle.api.artifacts.dsl.DependencyHandler
69

@@ -12,13 +15,14 @@ internal class DependencyStrategy(private val project: Project) {
1215

1316
test(project.libs.junit)
1417
test(project.libs.mockk)
18+
test(project.libs.jetbrains.kotlin.test)
1519
}
1620

1721
private fun DependencyHandler.applyLifeCycleDependencies() {
1822
implementation(project.libs.androidx.lifecycle.extensions)
19-
implementation(project.libs.androidx.lifecycle.runTimeKtx)
20-
implementation(project.libs.androidx.lifecycle.liveDataKtx)
21-
implementation(project.libs.androidx.lifecycle.liveDataCoreKtx)
23+
implementation(project.libs.androidx.lifecycle.runTime.ktx)
24+
implementation(project.libs.androidx.lifecycle.liveData.ktx)
25+
implementation(project.libs.androidx.lifecycle.liveDataCore.ktx)
2226
}
2327

2428
fun applyDependenciesOn(handler: DependencyHandler) {

core-ext/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ tasks.withType<com.android.build.gradle.internal.lint.AndroidLintAnalysisTask> {
1313
dependencies {
1414
implementation(project(":core"))
1515

16-
implementation(libs.androidx.sqliteKtx)
16+
implementation(libs.androidx.sqlite.ktx)
1717
}

gradle/libs.versions.toml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
ktlint = "1.1.1"
2+
ktlint = "1.5.0"
33

44
gradle-plugin = "8.9.1"
55

@@ -19,71 +19,76 @@ io-mockk = "1.13.17"
1919

2020
spek2-spek = "2.0.19"
2121

22+
google-devtools-ksp = "2.0.0-1.0.22"
2223

2324
[plugins]
2425
android-junit5 = { id = "de.mannodermaus.android-junit5", version = "1.12.0.0" }
26+
google-devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "google-devtools-ksp" }
27+
2528

2629

2730
[libraries]
28-
timber = "com.jakewharton.timber:timber:5.0.1"
29-
junit = "junit:junit:4.13.2"
31+
timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" }
32+
junit = { module ="junit:junit", version = "4.13.2" }
3033

3134
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "gradle-plugin" }
3235

33-
androidx-activityKtx = "androidx.activity:activity-ktx:1.10.1"
36+
androidx-activity = { module = "androidx.activity:activity", version = "1.10.1" }
37+
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.10.1" }
3438

3539
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
3640
androidx-appcompatResources = { module = "androidx.appcompat:appcompat-resources", version.ref = "androidx-appcompat" }
3741

3842
androidx-constraintLayout = "androidx.constraintlayout:constraintlayout:2.2.1"
3943

40-
androidx-fragmentKtx = "androidx.fragment:fragment-ktx:1.8.6"
44+
androidx-fragment = { module = "androidx.fragment:fragment", version = "1.8.6" }
45+
androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version = "1.8.6" }
4146

42-
androidx-lifecycle-extensions = "androidx.lifecycle:lifecycle-extensions:2.2.0"
43-
androidx-lifecycle-runTimeKtx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
44-
androidx-lifecycle-liveDataKtx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidx-lifecycle" }
45-
androidx-lifecycle-liveDataCoreKtx = { module = "androidx.lifecycle:lifecycle-livedata-core-ktx", version.ref = "androidx-lifecycle" }
47+
androidx-lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version = "2.2.0" }
48+
androidx-lifecycle-runTime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
49+
androidx-lifecycle-liveData-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidx-lifecycle" }
50+
androidx-lifecycle-liveDataCore-ktx = { module = "androidx.lifecycle:lifecycle-livedata-core-ktx", version.ref = "androidx-lifecycle" }
4651

47-
androidx-navigation-fragmentKtx = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "androidx-navigation" }
48-
androidx-navigation-uiKtx = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "androidx-navigation" }
52+
androidx-navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "androidx-navigation" }
53+
androidx-navigation-fragment = { module = "androidx.navigation:navigation-fragment", version.ref = "androidx-navigation" }
54+
androidx-navigation-ui = { module = "androidx.navigation:navigation-ui", version.ref = "androidx-navigation" }
55+
androidx-navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "androidx-navigation" }
4956

5057
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "androidx-room" }
5158
androidx-room-common = { module = "androidx.room:room-common", version.ref = "androidx-room" }
5259
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "androidx-room" }
5360
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "androidx-room" }
5461

5562
androidx-sqlite = { module = "androidx.sqlite:sqlite", version.ref = "androidx-sqlite" }
56-
androidx-sqliteKtx = { module = "androidx.sqlite:sqlite-ktx", version.ref = "androidx-sqlite" }
63+
androidx-sqlite-ktx = { module = "androidx.sqlite:sqlite-ktx", version.ref = "androidx-sqlite" }
5764

5865
androidx-test-core = { module = "androidx.test:core", version = "1.6.1" }
59-
androidx-test-coreKtx = { module = "androidx.test:core-ktx", version = "1.6.1" }
66+
androidx-test-core-ktx = { module = "androidx.test:core-ktx", version = "1.6.1" }
6067
androidx-test-runner = { module = "androidx.test:runner", version = "1.6.2" }
6168
androidx-test-rules = { module = "androidx.test:rules", version = "1.6.1" }
6269

63-
androidx-junitKtx = { module = "androidx.test.ext:junit-ktx", version.ref = "androidx-test-ext" }
64-
6570
google-auto-service = "com.google.auto.service:auto-service:1.1.1"
6671
google-android-material = "com.google.android.material:material:1.12.0"
6772

6873
jetbrains-dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "jetbrains-dokka" }
6974
jetbrains-kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "jetbrains-kotlin" }
7075
jetbrains-kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "jetbrains-kotlin" }
7176
jetbrains-kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "jetbrains-kotlin" }
77+
jetbrains-kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "jetbrains-kotlin" }
7278

7379
mockk = { module = "io.mockk:mockk", version.ref = "io-mockk" }
7480
mockk-android = { module = "io.mockk:mockk-android", version.ref = "io-mockk" }
7581

76-
gradle-versions = "com.github.ben-manes:gradle-versions-plugin:0.52.0"
82+
spotless-gradle = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "7.0.2" }
7783

78-
spotless-gradle = "com.diffplug.spotless:spotless-plugin-gradle:7.0.2"
84+
pintrest-ktlint = { module = "com.pinterest:ktlint", version.ref = "ktlint" }
7985

80-
squareup-kotlinpoet = "com.squareup:kotlinpoet:2.1.0"
86+
squareup-kotlinpoet = { module = "com.squareup:kotlinpoet", version = "2.1.0" }
8187

82-
tschuchortdev-kotlin-compile-testing = "com.github.tschuchortdev:kotlin-compile-testing:1.6.0"
88+
google-devtools-ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "google-devtools-ksp" }
89+
kotlin-compile-testing-ksp = { module = "com.github.tschuchortdev:kotlin-compile-testing-ksp", version = "1.6.0" }
8390

8491
gradle-plugins-android-junit5 = "de.mannodermaus.gradle.plugins:android-junit5:1.12.0.0"
8592

8693
spek2-spek-dsl-jvm = { module = "org.spekframework.spek2:spek-dsl-jvm", version.ref = "spek2-spek" }
8794
spek2-spek-runner-junit5 = { module = "org.spekframework.spek2:spek-runner-junit5", version.ref = "spek2-spek" }
88-
89-
pintrest-ktlint = { module = "com.pinterest:ktlint", version.ref = "ktlint" }

0 commit comments

Comments
 (0)