Skip to content

Commit

Permalink
Migrate from KAPT to KSP
Browse files Browse the repository at this point in the history
  • Loading branch information
tzugen committed Jul 31, 2023
1 parent f99fb1c commit ddf8ce7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 16 deletions.
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: 'gradle/versions.gradle'
Expand All @@ -10,6 +12,7 @@ buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
Expand All @@ -26,21 +29,29 @@ allprojects {
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
google()
}
}

repositories {
mavenCentral()
gradlePluginPortal()
google()
}

// Set Kotlin JVM target to the same for all subprojects
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "17"
}
}

tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs.add("-Xlint:deprecation")
}
}
}

wrapper {
Expand Down
7 changes: 5 additions & 2 deletions core/domain/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
plugins {
alias libs.plugins.ksp
}

apply from: bootstrap.androidModule
apply plugin: 'kotlin-kapt'

dependencies {
implementation libs.core
implementation libs.roomRuntime
implementation libs.roomKtx
kapt libs.room
ksp libs.room
}

android {
Expand Down
4 changes: 4 additions & 0 deletions core/subsonic-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
alias libs.plugins.ksp
}

apply from: bootstrap.kotlinModule

dependencies {
Expand Down
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ constraintLayout = "2.1.4"
multidex = "2.0.1"
room = "2.5.2"
kotlin = "1.8.22"
ksp = "1.8.22-1.0.11"
kotlinxCoroutines = "1.7.3"
viewModelKtx = "2.6.1"
swipeRefresh = "1.1.0"
Expand Down Expand Up @@ -100,3 +101,6 @@ kluentAndroid = { module = "org.amshove.kluent:kluent-android", versio
mockWebServer = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" }
apacheCodecs = { module = "commons-codec:commons-codec", version.ref = "apacheCodecs" }
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }

[plugins]
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
2 changes: 1 addition & 1 deletion gradle_scripts/android-module-bootstrap.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply from: "${project.rootDir}/gradle_scripts/code_quality.gradle"
apply plugin: 'org.jetbrains.kotlin.kapt'
apply plugin: 'com.google.devtools.ksp'

android {
compileSdkVersion versions.compileSdk
Expand Down
3 changes: 1 addition & 2 deletions gradle_scripts/kotlin-module-bootstrap.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This module provides a base for for pure kotlin modules
*/
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.kotlin.kapt'
apply plugin: 'com.google.devtools.ksp'
apply from: "${project.rootDir}/gradle_scripts/code_quality.gradle"

sourceSets {
Expand All @@ -12,7 +12,6 @@ sourceSets {
test.resources.srcDirs += "${projectDir}/src/integrationTest/resources"
}


dependencies {
api libs.kotlinStdlib

Expand Down
22 changes: 12 additions & 10 deletions ultrasonic/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
plugins {
alias libs.plugins.ksp
}

apply plugin: 'com.android.application'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'org.jetbrains.kotlin.kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply from: "../gradle_scripts/code_quality.gradle"

Expand Down Expand Up @@ -64,28 +67,28 @@ android {
targetCompatibility JavaVersion.VERSION_17
}

kapt {
arguments {
arg("room.schemaLocation", "$rootDir/ultrasonic/schemas".toString())
}
ksp {
arg("room.schemaLocation", "$rootDir/ultrasonic/schemas")
}

lint {
baseline = file("lint-baseline.xml")
abortOnError true
warningsAsErrors true
disable 'IconMissingDensityFolder', 'VectorPath'
ignore 'MissingTranslation', 'UnusedQuantity', 'MissingQuantity'
warning 'ImpliedQuantity'
disable 'IconMissingDensityFolder', 'VectorPath'
disable 'MissingTranslation', 'UnusedQuantity', 'MissingQuantity'
disable 'ObsoleteLintCustomCheck'
// We manage dependencies on Gitlab with RenovateBot
disable 'GradleDependency'
textReport true
checkDependencies true
}
namespace 'org.moire.ultrasonic'

}

tasks.withType(Test) {
tasks.withType(Test).configureEach {
useJUnitPlatform()
}

Expand Down Expand Up @@ -129,7 +132,7 @@ dependencies {
implementation libs.rxAndroid
implementation libs.multiType

kapt libs.room
ksp libs.room

testImplementation libs.kotlinReflect
testImplementation libs.junit
Expand All @@ -141,6 +144,5 @@ dependencies {
testImplementation libs.robolectric

implementation libs.timber

}

0 comments on commit ddf8ce7

Please sign in to comment.