Skip to content

Commit

Permalink
chore: migrate to kotlin and ksp 2 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZemtsovVU authored Aug 21, 2024
1 parent 0da9fdc commit b733aea
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 84 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Build project
Expand Down
2 changes: 1 addition & 1 deletion .jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
jdk:
- openjdk11
- openjdk17
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import com.diffplug.gradle.spotless.SpotlessExtension

plugins {
id("org.jetbrains.kotlinx.kover") version "0.5.0"
id("org.jetbrains.kotlinx.kover") version "0.8.3"
id("com.diffplug.gradle.spotless") version "6.2.0" apply false
id("org.jetbrains.kotlin.jvm") version "1.7.22" apply false
id("org.jetbrains.kotlin.jvm") version "2.0.0" apply false
}

subprojects {
Expand Down
5 changes: 3 additions & 2 deletions compiler-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -6,8 +7,8 @@ plugins {
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
5 changes: 3 additions & 2 deletions compiler-factory/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -6,8 +7,8 @@ plugins {
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ internal class FactoryGenerator(
}

FunSpec.builder("createInstance")
.addModifiers(KModifier.OVERRIDE)
.addModifiers(KModifier.PUBLIC, KModifier.OVERRIDE)
.addParameter("scope", Scope::class)
.returns(sourceClassName)
.apply {
Expand Down Expand Up @@ -210,7 +210,7 @@ internal class FactoryGenerator(
private fun TypeSpec.Builder.emitGetTargetScope(): TypeSpec.Builder = apply {
val scopeName = constructorInjectionTarget.scopeName
FunSpec.builder("getTargetScope")
.addModifiers(KModifier.OVERRIDE)
.addModifiers(KModifier.PUBLIC, KModifier.OVERRIDE)
.addParameter("scope", Scope::class)
.returns(Scope::class)
.addStatement(
Expand All @@ -236,7 +236,7 @@ internal class FactoryGenerator(
val scopeName = constructorInjectionTarget.scopeName
val hasScopeAnnotation = scopeName != null
FunSpec.builder("hasScopeAnnotation")
.addModifiers(KModifier.OVERRIDE)
.addModifiers(KModifier.PUBLIC, KModifier.OVERRIDE)
.returns(Boolean::class)
.addStatement("return %L", hasScopeAnnotation)
.build()
Expand All @@ -245,7 +245,7 @@ internal class FactoryGenerator(

private fun TypeSpec.Builder.emitHasSingletonAnnotation(): TypeSpec.Builder = apply {
FunSpec.builder("hasSingletonAnnotation")
.addModifiers(KModifier.OVERRIDE)
.addModifiers(KModifier.PUBLIC, KModifier.OVERRIDE)
.returns(Boolean::class)
.addStatement(
"return %L",
Expand All @@ -257,7 +257,7 @@ internal class FactoryGenerator(

private fun TypeSpec.Builder.emitHasReleasableAnnotation(): TypeSpec.Builder = apply {
FunSpec.builder("hasReleasableAnnotation")
.addModifiers(KModifier.OVERRIDE)
.addModifiers(KModifier.PUBLIC, KModifier.OVERRIDE)
.returns(Boolean::class)
.addStatement(
"return %L",
Expand All @@ -269,7 +269,7 @@ internal class FactoryGenerator(

private fun TypeSpec.Builder.emitHasProvidesSingletonAnnotation(): TypeSpec.Builder = apply {
FunSpec.builder("hasProvidesSingletonAnnotation")
.addModifiers(KModifier.OVERRIDE)
.addModifiers(KModifier.PUBLIC, KModifier.OVERRIDE)
.returns(Boolean::class)
.addStatement(
"return %L",
Expand All @@ -281,7 +281,7 @@ internal class FactoryGenerator(

private fun TypeSpec.Builder.emitHasProvidesReleasableAnnotation(): TypeSpec.Builder = apply {
FunSpec.builder("hasProvidesReleasableAnnotation")
.addModifiers(KModifier.OVERRIDE)
.addModifiers(KModifier.PUBLIC, KModifier.OVERRIDE)
.returns(Boolean::class)
.addStatement(
"return %L",
Expand Down
5 changes: 3 additions & 2 deletions compiler-memberinjector/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -6,8 +7,8 @@ plugins {
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal class MemberInjectorGenerator(
): TypeSpec.Builder = apply {
addFunction(
FunSpec.builder("inject")
.addModifiers(KModifier.OVERRIDE)
.addModifiers(KModifier.PUBLIC, KModifier.OVERRIDE)
.addParameter("target", sourceClassName)
.addParameter("scope", Scope::class)
.apply {
Expand Down
Loading

0 comments on commit b733aea

Please sign in to comment.