atlantis210
06/09/2022, 12:32 PMKotlinPoet
and implemented it in the same project on IntelliJ and everything works fine. Now, I'm trying to import my compiled processor into my android project, but I don't succeed... I do the ./gradlew build
and retrieve the processor.jar
. I imported this into the libs
folder, but when I'm trying to run the android project, I have a NoClassDefFound
on com.squareup.kotlinpoet.FileSpec
. I tried excluding the transitivity because I have a use of another version of KotlinPoet, 1.11 vs 1.10.2, but in both FileSpec
exists... It's as if the jar is not including dependencies... I didn't find anything similar on the internet... I'm quite in a struggle here ^^"Vladimir Tagakov
06/09/2022, 8:03 PMabstract class BaseClass<TypeParam>
abstract class IntermediateClass<TypeParam> : BaseClass<TypeParam>
@MyAnnotation class MyClass: IntermediateClass<String>
abstract class AnotherIntermediateClass: BaseClass<Int>
@MyAnnotation class AnotherMyClass: AnotherIntermediateClass
All classes having @MyAnnotation
are extending BaseClass
in one way or another. Can’t figure out how to get the types parametrizing BaseClass
for MyClass
and AnotherMyClass
can someone help me here please?Paul Woitaschek
06/09/2022, 8:47 PMVladimir Tagakov
06/09/2022, 11:38 PMval annotation: KSAnnotation = //...
annotation.annotationType.resolve() // only resolves when annotation is not nested in a class
Jiaxiang
06/10/2022, 6:20 AMMichal Klimczak
06/15/2022, 1:07 PMiosMain
source set? I'm using ksp 1.6.21-1.0.5 and even if I do
configurations
.filter { it.name.startsWith("ksp") }
.forEach {
add(it.name, "com.example...")
}
all I get is android source sets. If I try to add to ios configs, it doesn't complain but no code is generated. (the annotated files are in commonMain
btw).
An example of os library which generates code for different source sets would be awesome.David Rawson
06/19/2022, 1:13 AMWhenWhy is this the case? Ifis removed, nothing needs to be reprocessed.sourceA
outputB
is aggregating then changes in sourceA
will mean reprocessing but why not removal of sourceA
?Robert Jaros
06/19/2022, 4:27 PMRobert Jaros
06/19/2022, 5:17 PMVladimir Tagakov
06/23/2022, 11:49 PMDoni Winata
06/28/2022, 7:51 AMGustavo Gelape
06/28/2022, 6:13 PMkotlin {
sourceSets.debug {
kotlin.srcDirs += 'src/androidTest/java/com/example/project'
}
}
But then everything build related starts to fail since we use a lot of testImplementation, Dagger Hilt, etc.
So, my question is, by any chance anyone know a way to include test folders in symbol processing (KSP) without adding them as sourceSets?Jake Woods
06/29/2022, 7:01 AMKSType
? I’m doing the resolution with a hand-written algorithm right now and it feels wrongMichal Klimczak
06/29/2022, 10:58 AMCompilation failed: IrPropertyPublicSymbolImpl for com.example/myProperty|-7852496772092453113[0] is already bound: PROPERTY name:myProperty visibility:public modality:FINAL [val]
* Source files:
* Compiler version info: Konan: 1.6.21 / Kotlin: 1.6.21
* Output kind: PROGRAM
myProperty
is a top level property generated via ksp.
This happens when trying to add ksp generated src dirs to different apple targets. The code is generated only once in kspCommonMainKotlinMetadata
. Then if I add kotlin.srcDir("${project.buildDir.absolutePath}/generated/ksp/metadata/commonMain/kotlin")
to each configuration, this error appears.
It works fine if I only add it to the aggregating configuration (e.g. appleMain
), but it's something that can only get me so far, because I'm trying to automate it with a compiler plugin.Norbi
07/06/2022, 8:32 AMelihart
07/07/2022, 11:09 PMJiaxiang
07/07/2022, 11:39 PMLukasz Kalnik
07/09/2022, 11:07 AMdevDebug
, sprintRelease
, playRelease
). So there is no ksp generated code in main
, only in the respective flavor directories.
How do I make Android Studio aware of the generated code to have it recognize generated symbols and provide autocompletion?
This doesn't work, as there is no generated code in `main`: https://kotlinlang.org/docs/ksp-quickstart.html#make-ide-aware-of-generated-codeNorbi
07/11/2022, 7:26 PMproject-processor
), and it depends on another local project (project-annotations
) containing the annotation class triggering my processor to be applied.
When I try to build or clean the whole project, I often run into that the JAR file of project-annotations
is locked and therefore cannot be deleted.
After I stop all Gradle daemons using gradlew --stop
and retry the build/clean then it always succeeds.
So it seems that the build artifact of project-annotations
is locked by a Gradle daemon(s) which executed my processor from project-processor
- and not only during the build but for longer term.
(I use Kotlin 1.7.10 and the latest compatible KSP plugin.)
Unable to delete directory '...\project-annotations\build'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
- ...\project-annotations\build\libs\project-annotations-jvm-1.0.0-SNAPSHOT.jar
- ...\project-annotations\build\libs
Haven't you run into a similar problem?changd
07/12/2022, 3:45 AMprocess
function? Not saying it's the right thing to do, but our existing code writes to other directories in a multi-module project.jameskleeh
07/13/2022, 2:38 AMenvironment.codeGenerator.createNewFile(
and create a file in a directory that contains .
in it. Example path: META-INF/services/a.b.c/d.e.f
where d.e.f
is a file name. Is this possible? Currently passing that path as the package name results in META-INF/services/a/b/c/d.e.f
changd
07/13/2022, 8:49 PMSnail
07/15/2022, 6:24 AMv79
07/17/2022, 7:51 AMmain
function. B contains a class with a DSL that I'm very interested in interrogating. Is that something #ksp can do for me? So when A main
runs, it can iterate over some values in the DSL class in B? I'm probably not even clear what I want...juliocbcotta
07/18/2022, 1:38 PMRoberto Leinardi
07/19/2022, 2:41 PM@MyAnnotation
data class MyDataClass(
val foo: Boolean = true,
val bar: Int = 123,
val buz: String? = "abc",
)
Is it possible to get the default values out of the KSPropertyDeclaration
or in some other way?rcd27
07/21/2022, 10:14 AM@TriggerLoggingOnCall fun foo()
. As soon as KSP
does not modify the source code, I can't call just logThat()
in the function body. The question is: can close my task with KSP
?Ting-Yuan Huang
08/02/2022, 7:40 AMHamza GATTAL
08/02/2022, 10:52 PMZac Sweers
08/02/2022, 11:17 PMZac Sweers
08/02/2022, 11:17 PMJiaxiang
08/02/2022, 11:25 PM