Where does files with extensions, other than `.kt`...
# ksp
a
Where does files with extensions, other than
.kt
and
.java
, get placed, when crating them using CodeGenerator? Will they get included in apk (in android project)? Use-case: I would like to transfer processed info from one compilation module to another in this file (just text file), and use it while processing another module. Right now I just place this "transfer file" in
/module-name/build/generated/myProcessorName/transferFile
, but I have A LOT of problems with gradle: after
gradle clean
my processor doesn't run (presumably gets in gradle cache) and, consequently, doesn't produce this transfer file. In gradle logs I see
> Task :module-name:kspDebugKotlin FROM-CACHE
. Will this problem go away if I will use CodeGenerator to create this transfer file? If yes, how can I do so without including the transfer file in final build artifact (apk)?
@Jiaxiang
j
they are placed in resource output directory, specified by your build system.
only .class, .kt, .java files go to their correspondent directories, all other files go to resource directory.
you should try with CodeGenerator for any generated files from KSP in my opinion
a
I just found out (by experimenting) that files in this directory are not included in apk. But how can I read those files from another module? CodeGenerator does not provide a path to a generated file, and I dont want to rely on specific dir ksp uses right now (might change in the future).
I guess i will use this for now
Copy code
fun OutputStream.filename(): String? = runCatching {
    val pathField = FileOutputStream::class.java.getDeclaredField("path")
    pathField.isAccessible = true
    pathField.get(this as FileOutputStream) as String
}.getOrNull()
Ugly, but works