Philip Dukhov
04/12/2021, 3:38 PMprocess
function. Only removing build/tmp/kapt3
helps.
If I use same annotation in my android target, this works fine.
2. In both cases (multiplatform/android modules) generated classes are not recognized by the AS - they are marked as Unresolved reference
. But the build goes fine.
My setup:
annotations/build.gradle.kts
plugins {
kotlin("multiplatform")
id("com.android.library")
}
kotlin {
android()
jvm()
ios()
}
annotationProcessor/build.gradle.kts
plugins {
kotlin("multiplatform")
}
kotlin {
jvm()
sourceSets {
val jvmMain by getting {
dependencies {
implementation("com.squareup:kotlinpoet:1.8.0")
implementation(project(":annotations"))
}
}
}
}
src/jvmMain/resources/META-INF/services/javax.annotation.processing.Processor
file contains my processor
shared/build.gradke.kts
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
kotlin("kapt")
}
kapt {
useBuildCache = false // even this didn't helped with the cash problem
}
kotlin {
android()
ios()
cocoapods {
this.frameworkName = "shared"
summary = "shared"
homepage = "-"
license = "-"
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(project(":modules:annotations"))
configurations["kapt"].dependencies.add(project(":modules:annotationProcessor"))
}
}
}
}
Have anyone faced any of these?russhwolf
04/12/2021, 3:45 PMMichal Klimczak
04/12/2021, 3:49 PMbuild/tmp/kapt3
, but to build/generated/source/kaptKotlin
. It's set here: https://github.com/FutureMind/koru/blob/master/koru-processor/src/jvmMain/kotlin/com/futuremind/koru/processor/Processor.kt#L40
And the client of the lib has to add it to srcDirs like this
kotlin.srcDir("${buildDir.absolutePath}/generated/source/kaptKotlin/")
See READMEPhilip Dukhov
04/12/2021, 5:15 PMbuild/tmp/kapt3
is a folder that contains cache files, not the generated ones. I just was looking for a way to reset cache without cleaning whole folder, and found this one. Yes, I’m saving my file using “kapt.kotlin.generated”
value
Generated files are not visible by IDE, but visible at build time. Now sure why it’s so - files generated by other plugins works fineMichal Klimczak
04/12/2021, 5:41 PMPhilip Dukhov
04/14/2021, 6:11 AM